mirror of
https://github.com/linyqh/NarratoAI.git
synced 2025-12-12 11:22:51 +00:00
0.3.3 解决脚本验证问题
This commit is contained in:
parent
b37b0abaff
commit
4bafd696a1
@ -1,10 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
|
import ssl
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import asyncio
|
import asyncio
|
||||||
import traceback
|
import traceback
|
||||||
|
from requests.adapters import HTTPAdapter
|
||||||
|
from urllib3.util.retry import Retry
|
||||||
import requests
|
import requests
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
@ -432,12 +434,22 @@ def generate_script(tr, params):
|
|||||||
'llm_api_key': text_api_key,
|
'llm_api_key': text_api_key,
|
||||||
'custom_prompt': st.session_state.get('custom_prompt', '')
|
'custom_prompt': st.session_state.get('custom_prompt', '')
|
||||||
}
|
}
|
||||||
response = requests.post(
|
session = requests.Session()
|
||||||
|
retry_strategy = Retry(
|
||||||
|
total=3,
|
||||||
|
backoff_factor=1,
|
||||||
|
status_forcelist=[500, 502, 503, 504]
|
||||||
|
)
|
||||||
|
adapter = HTTPAdapter(max_retries=retry_strategy)
|
||||||
|
session.mount("https://", adapter)
|
||||||
|
|
||||||
|
response = session.post(
|
||||||
f"{config.app.get('narrato_api_url')}/video/config",
|
f"{config.app.get('narrato_api_url')}/video/config",
|
||||||
params=api_params,
|
params=api_params,
|
||||||
timeout=30,
|
timeout=30,
|
||||||
verify=False
|
verify=True # 启用证书验证
|
||||||
)
|
)
|
||||||
|
|
||||||
custom_prompt = st.session_state.get('custom_prompt', '')
|
custom_prompt = st.session_state.get('custom_prompt', '')
|
||||||
processor = ScriptProcessor(
|
processor = ScriptProcessor(
|
||||||
model_name=text_model,
|
model_name=text_model,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user