mirror of
https://github.com/harry0703/MoneyPrinterTurbo.git
synced 2026-02-21 08:27:22 +08:00
commit
fb974cefcf
@ -45,7 +45,9 @@ app = _cfg.get("app", {})
|
||||
whisper = _cfg.get("whisper", {})
|
||||
proxy = _cfg.get("proxy", {})
|
||||
azure = _cfg.get("azure", {})
|
||||
ui = _cfg.get("ui", {})
|
||||
ui = _cfg.get("ui", {
|
||||
"hide_log": False,
|
||||
})
|
||||
|
||||
hostname = socket.gethostname()
|
||||
|
||||
@ -57,7 +59,7 @@ project_description = _cfg.get(
|
||||
"project_description",
|
||||
"<a href='https://github.com/harry0703/MoneyPrinterTurbo'>https://github.com/harry0703/MoneyPrinterTurbo</a>",
|
||||
)
|
||||
project_version = _cfg.get("project_version", "1.2.3")
|
||||
project_version = _cfg.get("project_version", "1.2.4")
|
||||
reload_debug = False
|
||||
|
||||
imagemagick_path = app.get("imagemagick_path", "")
|
||||
|
||||
@ -138,7 +138,6 @@ def combine_videos(
|
||||
)
|
||||
|
||||
shuffle_side = random.choice(["left", "right", "top", "bottom"])
|
||||
logger.info(f"Using transition mode: {video_transition_mode}")
|
||||
if video_transition_mode.value == VideoTransitionMode.none.value:
|
||||
clip = clip
|
||||
elif video_transition_mode.value == VideoTransitionMode.fade_in.value:
|
||||
|
||||
@ -1,203 +1,200 @@
|
||||
[app]
|
||||
video_source = "pexels" # "pexels" or "pixabay"
|
||||
|
||||
video_source = "pexels" # "pexels" or "pixabay"
|
||||
# 是否隐藏配置面板
|
||||
hide_config = false
|
||||
|
||||
# 是否隐藏配置面板
|
||||
# hide_config = false
|
||||
# Pexels API Key
|
||||
# Register at https://www.pexels.com/api/ to get your API key.
|
||||
# You can use multiple keys to avoid rate limits.
|
||||
# For example: pexels_api_keys = ["123adsf4567adf89","abd1321cd13efgfdfhi"]
|
||||
# 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
|
||||
pexels_api_keys = []
|
||||
|
||||
[user]
|
||||
# 管理员用户名和密码,用于访问基础设置
|
||||
username = "admin"
|
||||
password = "admin"
|
||||
email = "admin@example.com" # 添加email字段,用于身份验证
|
||||
# Pexels API Key
|
||||
# Register at https://www.pexels.com/api/ to get your API key.
|
||||
# You can use multiple keys to avoid rate limits.
|
||||
# For example: pexels_api_keys = ["123adsf4567adf89","abd1321cd13efgfdfhi"]
|
||||
# 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
|
||||
pexels_api_keys = []
|
||||
# Pixabay API Key
|
||||
# Register at https://pixabay.com/api/docs/ to get your API key.
|
||||
# You can use multiple keys to avoid rate limits.
|
||||
# For example: pixabay_api_keys = ["123adsf4567adf89","abd1321cd13efgfdfhi"]
|
||||
# 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
|
||||
pixabay_api_keys = []
|
||||
|
||||
# Pixabay API Key
|
||||
# Register at https://pixabay.com/api/docs/ to get your API key.
|
||||
# You can use multiple keys to avoid rate limits.
|
||||
# For example: pixabay_api_keys = ["123adsf4567adf89","abd1321cd13efgfdfhi"]
|
||||
# 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
|
||||
pixabay_api_keys = []
|
||||
# 支持的提供商 (Supported providers):
|
||||
# openai
|
||||
# moonshot (月之暗面)
|
||||
# azure
|
||||
# qwen (通义千问)
|
||||
# deepseek
|
||||
# gemini
|
||||
# ollama
|
||||
# g4f
|
||||
# oneapi
|
||||
# cloudflare
|
||||
# ernie (文心一言)
|
||||
llm_provider = "openai"
|
||||
|
||||
# 如果你没有 OPENAI API Key,可以使用 g4f 代替,或者使用国内的 Moonshot API
|
||||
# If you don't have an OPENAI API Key, you can use g4f instead
|
||||
########## Ollama Settings
|
||||
# No need to set it unless you want to use your own proxy
|
||||
ollama_base_url = ""
|
||||
# Check your available models at https://ollama.com/library
|
||||
ollama_model_name = ""
|
||||
|
||||
# 支持的提供商 (Supported providers):
|
||||
# openai
|
||||
# moonshot (月之暗面)
|
||||
# oneapi
|
||||
# g4f
|
||||
# azure
|
||||
# qwen (通义千问)
|
||||
# gemini
|
||||
llm_provider="openai"
|
||||
########## OpenAI API Key
|
||||
# Get your API key at https://platform.openai.com/api-keys
|
||||
openai_api_key = ""
|
||||
# No need to set it unless you want to use your own proxy
|
||||
openai_base_url = ""
|
||||
# Check your available models at https://platform.openai.com/account/limits
|
||||
openai_model_name = "gpt-4o-mini"
|
||||
|
||||
########## Ollama Settings
|
||||
# No need to set it unless you want to use your own proxy
|
||||
ollama_base_url = ""
|
||||
# Check your available models at https://ollama.com/library
|
||||
ollama_model_name = ""
|
||||
########## Moonshot API Key
|
||||
# Visit https://platform.moonshot.cn/console/api-keys to get your API key.
|
||||
moonshot_api_key = ""
|
||||
moonshot_base_url = "https://api.moonshot.cn/v1"
|
||||
moonshot_model_name = "moonshot-v1-8k"
|
||||
|
||||
########## OpenAI API Key
|
||||
# Get your API key at https://platform.openai.com/api-keys
|
||||
openai_api_key = ""
|
||||
# No need to set it unless you want to use your own proxy
|
||||
openai_base_url = ""
|
||||
# Check your available models at https://platform.openai.com/account/limits
|
||||
openai_model_name = "gpt-4-turbo"
|
||||
########## OneAPI API Key
|
||||
# Visit https://github.com/songquanpeng/one-api to get your API key
|
||||
oneapi_api_key = ""
|
||||
oneapi_base_url = ""
|
||||
oneapi_model_name = ""
|
||||
|
||||
########## Moonshot API Key
|
||||
# Visit https://platform.moonshot.cn/console/api-keys to get your API key.
|
||||
moonshot_api_key=""
|
||||
moonshot_base_url = "https://api.moonshot.cn/v1"
|
||||
moonshot_model_name = "moonshot-v1-8k"
|
||||
########## G4F
|
||||
# Visit https://github.com/xtekky/gpt4free to get more details
|
||||
# Supported model list: https://github.com/xtekky/gpt4free/blob/main/g4f/models.py
|
||||
g4f_model_name = "gpt-3.5-turbo"
|
||||
|
||||
########## OneAPI API Key
|
||||
# Visit https://github.com/songquanpeng/one-api to get your API key
|
||||
oneapi_api_key=""
|
||||
oneapi_base_url=""
|
||||
oneapi_model_name=""
|
||||
########## Azure API Key
|
||||
# Visit https://learn.microsoft.com/zh-cn/azure/ai-services/openai/ to get more details
|
||||
# API documentation: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference
|
||||
azure_api_key = ""
|
||||
azure_base_url = ""
|
||||
azure_model_name = "gpt-35-turbo" # replace with your model deployment name
|
||||
azure_api_version = "2024-02-15-preview"
|
||||
|
||||
########## G4F
|
||||
# Visit https://github.com/xtekky/gpt4free to get more details
|
||||
# Supported model list: https://github.com/xtekky/gpt4free/blob/main/g4f/models.py
|
||||
g4f_model_name = "gpt-3.5-turbo"
|
||||
########## Gemini API Key
|
||||
gemini_api_key = ""
|
||||
gemini_model_name = "gemini-1.0-pro"
|
||||
|
||||
########## Azure API Key
|
||||
# Visit https://learn.microsoft.com/zh-cn/azure/ai-services/openai/ to get more details
|
||||
# API documentation: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference
|
||||
azure_api_key = ""
|
||||
azure_base_url=""
|
||||
azure_model_name="gpt-35-turbo" # replace with your model deployment name
|
||||
azure_api_version = "2024-02-15-preview"
|
||||
|
||||
########## Gemini API Key
|
||||
gemini_api_key=""
|
||||
gemini_model_name = "gemini-1.0-pro"
|
||||
|
||||
########## Qwen API Key
|
||||
# Visit https://dashscope.console.aliyun.com/apiKey to get your API key
|
||||
# Visit below links to get more details
|
||||
# https://tongyi.aliyun.com/qianwen/
|
||||
# https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction
|
||||
qwen_api_key = ""
|
||||
qwen_model_name = "qwen-max"
|
||||
########## Qwen API Key
|
||||
# Visit https://dashscope.console.aliyun.com/apiKey to get your API key
|
||||
# Visit below links to get more details
|
||||
# https://tongyi.aliyun.com/qianwen/
|
||||
# https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction
|
||||
qwen_api_key = ""
|
||||
qwen_model_name = "qwen-max"
|
||||
|
||||
|
||||
########## DeepSeek API Key
|
||||
# Visit https://platform.deepseek.com/api_keys to get your API key
|
||||
deepseek_api_key = ""
|
||||
deepseek_base_url = "https://api.deepseek.com"
|
||||
deepseek_model_name = "deepseek-chat"
|
||||
########## DeepSeek API Key
|
||||
# Visit https://platform.deepseek.com/api_keys to get your API key
|
||||
deepseek_api_key = ""
|
||||
deepseek_base_url = "https://api.deepseek.com"
|
||||
deepseek_model_name = "deepseek-chat"
|
||||
|
||||
# Subtitle Provider, "edge" or "whisper"
|
||||
# If empty, the subtitle will not be generated
|
||||
subtitle_provider = "edge"
|
||||
# Subtitle Provider, "edge" or "whisper"
|
||||
# If empty, the subtitle will not be generated
|
||||
subtitle_provider = "edge"
|
||||
|
||||
#
|
||||
# ImageMagick
|
||||
#
|
||||
# Once you have installed it, ImageMagick will be automatically detected, except on Windows!
|
||||
# On Windows, for example "C:\Program Files (x86)\ImageMagick-7.1.1-Q16-HDRI\magick.exe"
|
||||
# Download from https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-29-Q16-x64-static.exe
|
||||
#
|
||||
# ImageMagick
|
||||
#
|
||||
# Once you have installed it, ImageMagick will be automatically detected, except on Windows!
|
||||
# On Windows, for example "C:\Program Files (x86)\ImageMagick-7.1.1-Q16-HDRI\magick.exe"
|
||||
# Download from https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-29-Q16-x64-static.exe
|
||||
|
||||
# imagemagick_path = "C:\\Program Files (x86)\\ImageMagick-7.1.1-Q16\\magick.exe"
|
||||
# imagemagick_path = "C:\\Program Files (x86)\\ImageMagick-7.1.1-Q16\\magick.exe"
|
||||
|
||||
|
||||
#
|
||||
# FFMPEG
|
||||
#
|
||||
# 通常情况下,ffmpeg 会被自动下载,并且会被自动检测到。
|
||||
# 但是如果你的环境有问题,无法自动下载,可能会遇到如下错误:
|
||||
# RuntimeError: No ffmpeg exe could be found.
|
||||
# Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
|
||||
# 此时你可以手动下载 ffmpeg 并设置 ffmpeg_path,下载地址:https://www.gyan.dev/ffmpeg/builds/
|
||||
#
|
||||
# FFMPEG
|
||||
#
|
||||
# 通常情况下,ffmpeg 会被自动下载,并且会被自动检测到。
|
||||
# 但是如果你的环境有问题,无法自动下载,可能会遇到如下错误:
|
||||
# RuntimeError: No ffmpeg exe could be found.
|
||||
# Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
|
||||
# 此时你可以手动下载 ffmpeg 并设置 ffmpeg_path,下载地址:https://www.gyan.dev/ffmpeg/builds/
|
||||
|
||||
# Under normal circumstances, ffmpeg is downloaded automatically and detected automatically.
|
||||
# However, if there is an issue with your environment that prevents automatic downloading, you might encounter the following error:
|
||||
# RuntimeError: No ffmpeg exe could be found.
|
||||
# Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
|
||||
# In such cases, you can manually download ffmpeg and set the ffmpeg_path, download link: https://www.gyan.dev/ffmpeg/builds/
|
||||
# Under normal circumstances, ffmpeg is downloaded automatically and detected automatically.
|
||||
# However, if there is an issue with your environment that prevents automatic downloading, you might encounter the following error:
|
||||
# RuntimeError: No ffmpeg exe could be found.
|
||||
# Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
|
||||
# In such cases, you can manually download ffmpeg and set the ffmpeg_path, download link: https://www.gyan.dev/ffmpeg/builds/
|
||||
|
||||
# ffmpeg_path = "C:\\Users\\harry\\Downloads\\ffmpeg.exe"
|
||||
#########################################################################################
|
||||
# ffmpeg_path = "C:\\Users\\harry\\Downloads\\ffmpeg.exe"
|
||||
#########################################################################################
|
||||
|
||||
# 当视频生成成功后,API服务提供的视频下载接入点,默认为当前服务的地址和监听端口
|
||||
# 比如 http://127.0.0.1:8080/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# 如果你需要使用域名对外提供服务(一般会用nginx做代理),则可以设置为你的域名
|
||||
# 比如 https://xxxx.com/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# endpoint="https://xxxx.com"
|
||||
# 当视频生成成功后,API服务提供的视频下载接入点,默认为当前服务的地址和监听端口
|
||||
# 比如 http://127.0.0.1:8080/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# 如果你需要使用域名对外提供服务(一般会用nginx做代理),则可以设置为你的域名
|
||||
# 比如 https://xxxx.com/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# endpoint="https://xxxx.com"
|
||||
|
||||
# When the video is successfully generated, the API service provides a download endpoint for the video, defaulting to the service's current address and listening port.
|
||||
# For example, http://127.0.0.1:8080/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# If you need to provide the service externally using a domain name (usually done with nginx as a proxy), you can set it to your domain name.
|
||||
# For example, https://xxxx.com/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# endpoint="https://xxxx.com"
|
||||
endpoint=""
|
||||
# When the video is successfully generated, the API service provides a download endpoint for the video, defaulting to the service's current address and listening port.
|
||||
# For example, http://127.0.0.1:8080/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# If you need to provide the service externally using a domain name (usually done with nginx as a proxy), you can set it to your domain name.
|
||||
# For example, https://xxxx.com/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
||||
# endpoint="https://xxxx.com"
|
||||
endpoint = ""
|
||||
|
||||
|
||||
# Video material storage location
|
||||
# material_directory = "" # Indicates that video materials will be downloaded to the default folder, the default folder is ./storage/cache_videos under the current project
|
||||
# material_directory = "/user/harry/videos" # Indicates that video materials will be downloaded to a specified folder
|
||||
# material_directory = "task" # Indicates that video materials will be downloaded to the current task's folder, this method does not allow sharing of already downloaded video materials
|
||||
# Video material storage location
|
||||
# material_directory = "" # Indicates that video materials will be downloaded to the default folder, the default folder is ./storage/cache_videos under the current project
|
||||
# material_directory = "/user/harry/videos" # Indicates that video materials will be downloaded to a specified folder
|
||||
# material_directory = "task" # Indicates that video materials will be downloaded to the current task's folder, this method does not allow sharing of already downloaded video materials
|
||||
|
||||
# 视频素材存放位置
|
||||
# material_directory = "" #表示将视频素材下载到默认的文件夹,默认文件夹为当前项目下的 ./storage/cache_videos
|
||||
# material_directory = "/user/harry/videos" #表示将视频素材下载到指定的文件夹中
|
||||
# material_directory = "task" #表示将视频素材下载到当前任务的文件夹中,这种方式无法共享已经下载的视频素材
|
||||
# 视频素材存放位置
|
||||
# material_directory = "" #表示将视频素材下载到默认的文件夹,默认文件夹为当前项目下的 ./storage/cache_videos
|
||||
# material_directory = "/user/harry/videos" #表示将视频素材下载到指定的文件夹中
|
||||
# material_directory = "task" #表示将视频素材下载到当前任务的文件夹中,这种方式无法共享已经下载的视频素材
|
||||
|
||||
material_directory = ""
|
||||
material_directory = ""
|
||||
|
||||
# Used for state management of the task
|
||||
enable_redis = false
|
||||
redis_host = "localhost"
|
||||
redis_port = 6379
|
||||
redis_db = 0
|
||||
redis_password = ""
|
||||
# Used for state management of the task
|
||||
enable_redis = false
|
||||
redis_host = "localhost"
|
||||
redis_port = 6379
|
||||
redis_db = 0
|
||||
redis_password = ""
|
||||
|
||||
# 文生视频时的最大并发任务数
|
||||
max_concurrent_tasks = 5
|
||||
|
||||
# webui界面是否显示配置项
|
||||
# webui hide baisc config panel
|
||||
hide_config = false
|
||||
# 文生视频时的最大并发任务数
|
||||
max_concurrent_tasks = 5
|
||||
|
||||
|
||||
[whisper]
|
||||
# Only effective when subtitle_provider is "whisper"
|
||||
# Only effective when subtitle_provider is "whisper"
|
||||
|
||||
# Run on GPU with FP16
|
||||
# model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
||||
# Run on GPU with FP16
|
||||
# model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
||||
|
||||
# Run on GPU with INT8
|
||||
# model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
|
||||
# Run on GPU with INT8
|
||||
# model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
|
||||
|
||||
# Run on CPU with INT8
|
||||
# model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
||||
# Run on CPU with INT8
|
||||
# model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
||||
|
||||
# recommended model_size: "large-v3"
|
||||
model_size="large-v3"
|
||||
# if you want to use GPU, set device="cuda"
|
||||
device="CPU"
|
||||
compute_type="int8"
|
||||
# recommended model_size: "large-v3"
|
||||
model_size = "large-v3"
|
||||
# if you want to use GPU, set device="cuda"
|
||||
device = "CPU"
|
||||
compute_type = "int8"
|
||||
|
||||
|
||||
[proxy]
|
||||
### Use a proxy to access the Pexels API
|
||||
### Format: "http://<username>:<password>@<proxy>:<port>"
|
||||
### Example: "http://user:pass@proxy:1234"
|
||||
### Doc: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
|
||||
### Use a proxy to access the Pexels API
|
||||
### Format: "http://<username>:<password>@<proxy>:<port>"
|
||||
### Example: "http://user:pass@proxy:1234"
|
||||
### Doc: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
|
||||
|
||||
# http = "http://10.10.1.10:3128"
|
||||
# https = "http://10.10.1.10:1080"
|
||||
# http = "http://10.10.1.10:3128"
|
||||
# https = "http://10.10.1.10:1080"
|
||||
|
||||
[azure]
|
||||
# Azure Speech API Key
|
||||
# Get your API key at https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices
|
||||
speech_key=""
|
||||
speech_region=""
|
||||
# Azure Speech API Key
|
||||
# Get your API key at https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices
|
||||
speech_key = ""
|
||||
speech_region = ""
|
||||
|
||||
[ui]
|
||||
# UI related settings
|
||||
# 是否隐藏日志信息
|
||||
# Whether to hide logs in the UI
|
||||
hide_log = false
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
moviepy==2.1.1
|
||||
streamlit==1.40.2
|
||||
moviepy==2.1.2
|
||||
streamlit==1.45.0
|
||||
edge_tts==6.1.19
|
||||
fastapi==0.115.6
|
||||
uvicorn==0.32.1
|
||||
openai==1.56.1
|
||||
faster-whisper==1.1.0
|
||||
loguru==0.7.2
|
||||
loguru==0.7.3
|
||||
google.generativeai==0.8.3
|
||||
dashscope==1.20.14
|
||||
g4f==0.3.8.1
|
||||
g4f==0.5.2.2
|
||||
azure-cognitiveservices-speech==1.41.1
|
||||
redis==5.2.0
|
||||
python-multipart==0.0.19
|
||||
streamlit-authenticator==0.4.1
|
||||
pyyaml
|
||||
pyyaml
|
||||
537
webui/Main.py
537
webui/Main.py
@ -42,10 +42,15 @@ st.set_page_config(
|
||||
)
|
||||
|
||||
|
||||
hide_streamlit_style = """
|
||||
<style>#root > div:nth-child(1) > div > div > div > div > section > div {padding-top: 0rem;}</style>
|
||||
streamlit_style = """
|
||||
<style>
|
||||
h1 {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
</style>
|
||||
"""
|
||||
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
||||
st.markdown(streamlit_style, unsafe_allow_html=True)
|
||||
|
||||
# 定义资源目录
|
||||
font_dir = os.path.join(root_dir, "resource", "fonts")
|
||||
song_dir = os.path.join(root_dir, "resource", "songs")
|
||||
@ -93,8 +98,6 @@ support_locales = [
|
||||
"th-TH",
|
||||
]
|
||||
|
||||
# print(f"******** system locale: {system_locale} ********")
|
||||
|
||||
if "video_subject" not in st.session_state:
|
||||
st.session_state["video_subject"] = ""
|
||||
if "video_script" not in st.session_state:
|
||||
@ -195,311 +198,231 @@ def tr(key):
|
||||
loc = locales.get(st.session_state["ui_language"], {})
|
||||
return loc.get("Translation", {}).get(key, key)
|
||||
|
||||
|
||||
# 加载用户认证配置
|
||||
# 确保用户配置存在并包含所有必需的字段
|
||||
if "user" not in config._cfg:
|
||||
config._cfg["user"] = {
|
||||
"username": "admin",
|
||||
"password": "admin",
|
||||
"email": "admin@example.com",
|
||||
}
|
||||
config.save_config()
|
||||
elif "email" not in config._cfg["user"]:
|
||||
# 如果用户配置存在但没有email字段,添加默认email
|
||||
config._cfg["user"]["email"] = f"{config._cfg['user']['username']}@example.com"
|
||||
config.save_config()
|
||||
|
||||
# 创建认证对象
|
||||
authenticator = None
|
||||
auth_status = False
|
||||
|
||||
# 检查是否需要身份验证才能访问配置
|
||||
# 创建基础设置折叠框
|
||||
if not config.app.get("hide_config", False):
|
||||
# 创建认证配置
|
||||
credentials = {
|
||||
"usernames": {
|
||||
config._cfg["user"]["username"]: {
|
||||
"name": config._cfg["user"]["username"],
|
||||
"password": config._cfg["user"]["password"],
|
||||
"email": config._cfg["user"]["email"],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cookie_name = "mpt_auth_cookie"
|
||||
cookie_key = "mpt_auth_key_123"
|
||||
cookie_expiry_days = 30
|
||||
|
||||
authenticator = stauth.Authenticate(
|
||||
credentials, cookie_name, cookie_key, cookie_expiry_days
|
||||
)
|
||||
|
||||
# 从 session_state 获取认证状态
|
||||
auth_status = st.session_state.get("authentication_status")
|
||||
|
||||
st.write(tr("Get Help"))
|
||||
|
||||
llm_provider = config.app.get("llm_provider", "").lower()
|
||||
|
||||
if not config.app.get("hide_config", False):
|
||||
# 创建基础设置折叠框
|
||||
with st.expander(tr("Basic Settings"), expanded=False):
|
||||
# 检查用户是否已登录
|
||||
if not auth_status:
|
||||
# 用户未登录,显示登录表单
|
||||
st.warning(tr("Please login to access settings"))
|
||||
config_panels = st.columns(3)
|
||||
left_config_panel = config_panels[0]
|
||||
middle_config_panel = config_panels[1]
|
||||
right_config_panel = config_panels[2]
|
||||
|
||||
# 显示登录表单
|
||||
try:
|
||||
# 自定义登录表单文本,使用我们的翻译系统
|
||||
login_form_fields = {
|
||||
"Form name": tr("Login"),
|
||||
"Username": tr("Username"),
|
||||
"Password": tr("Password"),
|
||||
"Login": tr("Login"),
|
||||
}
|
||||
# 左侧面板 - 日志设置
|
||||
with left_config_panel:
|
||||
# 是否隐藏配置面板
|
||||
hide_config = st.checkbox(
|
||||
tr("Hide Basic Settings"), value=config.app.get("hide_config", False)
|
||||
)
|
||||
config.app["hide_config"] = hide_config
|
||||
|
||||
authenticator.login(location="main", fields=login_form_fields)
|
||||
# 是否禁用日志显示
|
||||
hide_log = st.checkbox(
|
||||
tr("Hide Log"), value=config.ui.get("hide_log", False)
|
||||
)
|
||||
config.ui["hide_log"] = hide_log
|
||||
|
||||
# 从 session_state 获取认证状态
|
||||
auth_status = st.session_state.get("authentication_status")
|
||||
# 中间面板 - LLM 设置
|
||||
|
||||
with middle_config_panel:
|
||||
st.write(tr("LLM Settings"))
|
||||
llm_providers = [
|
||||
"OpenAI",
|
||||
"Moonshot",
|
||||
"Azure",
|
||||
"Qwen",
|
||||
"DeepSeek",
|
||||
"Gemini",
|
||||
"Ollama",
|
||||
"G4f",
|
||||
"OneAPI",
|
||||
"Cloudflare",
|
||||
"ERNIE",
|
||||
]
|
||||
saved_llm_provider = config.app.get("llm_provider", "OpenAI").lower()
|
||||
saved_llm_provider_index = 0
|
||||
for i, provider in enumerate(llm_providers):
|
||||
if provider.lower() == saved_llm_provider:
|
||||
saved_llm_provider_index = i
|
||||
break
|
||||
|
||||
if auth_status is False:
|
||||
st.error(tr("Incorrect username or password"))
|
||||
elif auth_status is None:
|
||||
st.info(tr("Please enter your username and password"))
|
||||
llm_provider = st.selectbox(
|
||||
tr("LLM Provider"),
|
||||
options=llm_providers,
|
||||
index=saved_llm_provider_index,
|
||||
)
|
||||
llm_helper = st.container()
|
||||
llm_provider = llm_provider.lower()
|
||||
config.app["llm_provider"] = llm_provider
|
||||
|
||||
# 如果用户登录成功,刷新页面以显示配置面板
|
||||
if auth_status:
|
||||
st.rerun()
|
||||
except Exception as e:
|
||||
st.error(f"{tr('Login Error')}: {e}")
|
||||
llm_api_key = config.app.get(f"{llm_provider}_api_key", "")
|
||||
llm_secret_key = config.app.get(
|
||||
f"{llm_provider}_secret_key", ""
|
||||
) # only for baidu ernie
|
||||
llm_base_url = config.app.get(f"{llm_provider}_base_url", "")
|
||||
llm_model_name = config.app.get(f"{llm_provider}_model_name", "")
|
||||
llm_account_id = config.app.get(f"{llm_provider}_account_id", "")
|
||||
|
||||
# 只有在用户已登录时才显示配置面板
|
||||
if auth_status:
|
||||
config_panels = st.columns(3)
|
||||
left_config_panel = config_panels[0]
|
||||
middle_config_panel = config_panels[1]
|
||||
right_config_panel = config_panels[2]
|
||||
tips = ""
|
||||
if llm_provider == "ollama":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "qwen:7b"
|
||||
if not llm_base_url:
|
||||
llm_base_url = "http://localhost:11434/v1"
|
||||
|
||||
# 左侧面板 - 日志设置
|
||||
with left_config_panel:
|
||||
# 是否禁用日志显示
|
||||
hide_log = st.checkbox(
|
||||
tr("Hide Log"), value=config.app.get("hide_log", False)
|
||||
)
|
||||
config.ui["hide_log"] = hide_log
|
||||
|
||||
# 中间面板 - LLM 设置
|
||||
with middle_config_panel:
|
||||
# openai
|
||||
# moonshot (月之暗面)
|
||||
# oneapi
|
||||
# g4f
|
||||
# azure
|
||||
# qwen (通义千问)
|
||||
# gemini
|
||||
# ollama
|
||||
llm_providers = [
|
||||
"OpenAI",
|
||||
"Moonshot",
|
||||
"Azure",
|
||||
"Qwen",
|
||||
"DeepSeek",
|
||||
"Gemini",
|
||||
"Ollama",
|
||||
"G4f",
|
||||
"OneAPI",
|
||||
"Cloudflare",
|
||||
"ERNIE",
|
||||
]
|
||||
saved_llm_provider = config.app.get("llm_provider", "OpenAI").lower()
|
||||
saved_llm_provider_index = 0
|
||||
for i, provider in enumerate(llm_providers):
|
||||
if provider.lower() == saved_llm_provider:
|
||||
saved_llm_provider_index = i
|
||||
break
|
||||
|
||||
llm_provider = st.selectbox(
|
||||
tr("LLM Provider"),
|
||||
options=llm_providers,
|
||||
index=saved_llm_provider_index,
|
||||
)
|
||||
llm_helper = st.container()
|
||||
llm_provider = llm_provider.lower()
|
||||
config.app["llm_provider"] = llm_provider
|
||||
|
||||
llm_api_key = config.app.get(f"{llm_provider}_api_key", "")
|
||||
llm_secret_key = config.app.get(
|
||||
f"{llm_provider}_secret_key", ""
|
||||
) # only for baidu ernie
|
||||
llm_base_url = config.app.get(f"{llm_provider}_base_url", "")
|
||||
llm_model_name = config.app.get(f"{llm_provider}_model_name", "")
|
||||
llm_account_id = config.app.get(f"{llm_provider}_account_id", "")
|
||||
|
||||
tips = ""
|
||||
if llm_provider == "ollama":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "qwen:7b"
|
||||
if not llm_base_url:
|
||||
llm_base_url = "http://localhost:11434/v1"
|
||||
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Ollama配置说明
|
||||
- **API Key**: 随便填写,比如 123
|
||||
- **Base Url**: 一般为 http://localhost:11434/v1
|
||||
- 如果 `MoneyPrinterTurbo` 和 `Ollama` **不在同一台机器上**,需要填写 `Ollama` 机器的IP地址
|
||||
- 如果 `MoneyPrinterTurbo` 是 `Docker` 部署,建议填写 `http://host.docker.internal:11434/v1`
|
||||
- **Model Name**: 使用 `ollama list` 查看,比如 `qwen:7b`
|
||||
"""
|
||||
|
||||
if llm_provider == "openai":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "gpt-3.5-turbo"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### OpenAI 配置说明
|
||||
> 需要VPN开启全局流量模式
|
||||
- **API Key**: [点击到官网申请](https://platform.openai.com/api-keys)
|
||||
- **Base Url**: 可以留空
|
||||
- **Model Name**: 填写**有权限**的模型,[点击查看模型列表](https://platform.openai.com/settings/organization/limits)
|
||||
"""
|
||||
|
||||
if llm_provider == "moonshot":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "moonshot-v1-8k"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Moonshot 配置说明
|
||||
- **API Key**: [点击到官网申请](https://platform.moonshot.cn/console/api-keys)
|
||||
- **Base Url**: 固定为 https://api.moonshot.cn/v1
|
||||
- **Model Name**: 比如 moonshot-v1-8k,[点击查看模型列表](https://platform.moonshot.cn/docs/intro#%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8)
|
||||
"""
|
||||
if llm_provider == "oneapi":
|
||||
if not llm_model_name:
|
||||
llm_model_name = (
|
||||
"claude-3-5-sonnet-20240620" # 默认模型,可以根据需要调整
|
||||
)
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### OneAPI 配置说明
|
||||
- **API Key**: 填写您的 OneAPI 密钥
|
||||
- **Base Url**: 填写 OneAPI 的基础 URL
|
||||
- **Model Name**: 填写您要使用的模型名称,例如 claude-3-5-sonnet-20240620
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Ollama配置说明
|
||||
- **API Key**: 随便填写,比如 123
|
||||
- **Base Url**: 一般为 http://localhost:11434/v1
|
||||
- 如果 `MoneyPrinterTurbo` 和 `Ollama` **不在同一台机器上**,需要填写 `Ollama` 机器的IP地址
|
||||
- 如果 `MoneyPrinterTurbo` 是 `Docker` 部署,建议填写 `http://host.docker.internal:11434/v1`
|
||||
- **Model Name**: 使用 `ollama list` 查看,比如 `qwen:7b`
|
||||
"""
|
||||
|
||||
if llm_provider == "qwen":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "qwen-max"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### 通义千问Qwen 配置说明
|
||||
- **API Key**: [点击到官网申请](https://dashscope.console.aliyun.com/apiKey)
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 比如 qwen-max,[点击查看模型列表](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction#3ef6d0bcf91wy)
|
||||
"""
|
||||
if llm_provider == "openai":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "gpt-3.5-turbo"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### OpenAI 配置说明
|
||||
> 需要VPN开启全局流量模式
|
||||
- **API Key**: [点击到官网申请](https://platform.openai.com/api-keys)
|
||||
- **Base Url**: 可以留空
|
||||
- **Model Name**: 填写**有权限**的模型,[点击查看模型列表](https://platform.openai.com/settings/organization/limits)
|
||||
"""
|
||||
|
||||
if llm_provider == "g4f":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "gpt-3.5-turbo"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### gpt4free 配置说明
|
||||
> [GitHub开源项目](https://github.com/xtekky/gpt4free),可以免费使用GPT模型,但是**稳定性较差**
|
||||
- **API Key**: 随便填写,比如 123
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 比如 gpt-3.5-turbo,[点击查看模型列表](https://github.com/xtekky/gpt4free/blob/main/g4f/models.py#L308)
|
||||
"""
|
||||
if llm_provider == "azure":
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Azure 配置说明
|
||||
> [点击查看如何部署模型](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/how-to/create-resource)
|
||||
- **API Key**: [点击到Azure后台创建](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI)
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 填写你实际的部署名
|
||||
"""
|
||||
|
||||
if llm_provider == "gemini":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "gemini-1.0-pro"
|
||||
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Gemini 配置说明
|
||||
> 需要VPN开启全局流量模式
|
||||
- **API Key**: [点击到官网申请](https://ai.google.dev/)
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 比如 gemini-1.0-pro
|
||||
"""
|
||||
|
||||
if llm_provider == "deepseek":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "deepseek-chat"
|
||||
if not llm_base_url:
|
||||
llm_base_url = "https://api.deepseek.com"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### DeepSeek 配置说明
|
||||
- **API Key**: [点击到官网申请](https://platform.deepseek.com/api_keys)
|
||||
- **Base Url**: 固定为 https://api.deepseek.com
|
||||
- **Model Name**: 固定为 deepseek-chat
|
||||
"""
|
||||
|
||||
if llm_provider == "ernie":
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### 百度文心一言 配置说明
|
||||
- **API Key**: [点击到官网申请](https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application)
|
||||
- **Secret Key**: [点击到官网申请](https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application)
|
||||
- **Base Url**: 填写 **请求地址** [点击查看文档](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/jlil56u11#%E8%AF%B7%E6%B1%82%E8%AF%B4%E6%98%8E)
|
||||
"""
|
||||
|
||||
if tips and config.ui["language"] == "zh":
|
||||
st.warning(
|
||||
"中国用户建议使用 **DeepSeek** 或 **Moonshot** 作为大模型提供商\n- 国内可直接访问,不需要VPN \n- 注册就送额度,基本够用"
|
||||
if llm_provider == "moonshot":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "moonshot-v1-8k"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Moonshot 配置说明
|
||||
- **API Key**: [点击到官网申请](https://platform.moonshot.cn/console/api-keys)
|
||||
- **Base Url**: 固定为 https://api.moonshot.cn/v1
|
||||
- **Model Name**: 比如 moonshot-v1-8k,[点击查看模型列表](https://platform.moonshot.cn/docs/intro#%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8)
|
||||
"""
|
||||
if llm_provider == "oneapi":
|
||||
if not llm_model_name:
|
||||
llm_model_name = (
|
||||
"claude-3-5-sonnet-20240620" # 默认模型,可以根据需要调整
|
||||
)
|
||||
st.info(tips)
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### OneAPI 配置说明
|
||||
- **API Key**: 填写您的 OneAPI 密钥
|
||||
- **Base Url**: 填写 OneAPI 的基础 URL
|
||||
- **Model Name**: 填写您要使用的模型名称,例如 claude-3-5-sonnet-20240620
|
||||
"""
|
||||
|
||||
st_llm_api_key = st.text_input(
|
||||
tr("API Key"), value=llm_api_key, type="password"
|
||||
if llm_provider == "qwen":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "qwen-max"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### 通义千问Qwen 配置说明
|
||||
- **API Key**: [点击到官网申请](https://dashscope.console.aliyun.com/apiKey)
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 比如 qwen-max,[点击查看模型列表](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction#3ef6d0bcf91wy)
|
||||
"""
|
||||
|
||||
if llm_provider == "g4f":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "gpt-3.5-turbo"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### gpt4free 配置说明
|
||||
> [GitHub开源项目](https://github.com/xtekky/gpt4free),可以免费使用GPT模型,但是**稳定性较差**
|
||||
- **API Key**: 随便填写,比如 123
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 比如 gpt-3.5-turbo,[点击查看模型列表](https://github.com/xtekky/gpt4free/blob/main/g4f/models.py#L308)
|
||||
"""
|
||||
if llm_provider == "azure":
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Azure 配置说明
|
||||
> [点击查看如何部署模型](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/how-to/create-resource)
|
||||
- **API Key**: [点击到Azure后台创建](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI)
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 填写你实际的部署名
|
||||
"""
|
||||
|
||||
if llm_provider == "gemini":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "gemini-1.0-pro"
|
||||
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### Gemini 配置说明
|
||||
> 需要VPN开启全局流量模式
|
||||
- **API Key**: [点击到官网申请](https://ai.google.dev/)
|
||||
- **Base Url**: 留空
|
||||
- **Model Name**: 比如 gemini-1.0-pro
|
||||
"""
|
||||
|
||||
if llm_provider == "deepseek":
|
||||
if not llm_model_name:
|
||||
llm_model_name = "deepseek-chat"
|
||||
if not llm_base_url:
|
||||
llm_base_url = "https://api.deepseek.com"
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### DeepSeek 配置说明
|
||||
- **API Key**: [点击到官网申请](https://platform.deepseek.com/api_keys)
|
||||
- **Base Url**: 固定为 https://api.deepseek.com
|
||||
- **Model Name**: 固定为 deepseek-chat
|
||||
"""
|
||||
|
||||
if llm_provider == "ernie":
|
||||
with llm_helper:
|
||||
tips = """
|
||||
##### 百度文心一言 配置说明
|
||||
- **API Key**: [点击到官网申请](https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application)
|
||||
- **Secret Key**: [点击到官网申请](https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application)
|
||||
- **Base Url**: 填写 **请求地址** [点击查看文档](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/jlil56u11#%E8%AF%B7%E6%B1%82%E8%AF%B4%E6%98%8E)
|
||||
"""
|
||||
|
||||
if tips and config.ui["language"] == "zh":
|
||||
st.warning(
|
||||
"中国用户建议使用 **DeepSeek** 或 **Moonshot** 作为大模型提供商\n- 国内可直接访问,不需要VPN \n- 注册就送额度,基本够用"
|
||||
)
|
||||
st_llm_base_url = st.text_input(tr("Base Url"), value=llm_base_url)
|
||||
st_llm_model_name = ""
|
||||
if llm_provider != "ernie":
|
||||
st_llm_model_name = st.text_input(
|
||||
tr("Model Name"),
|
||||
value=llm_model_name,
|
||||
key=f"{llm_provider}_model_name_input",
|
||||
)
|
||||
if st_llm_model_name:
|
||||
config.app[f"{llm_provider}_model_name"] = st_llm_model_name
|
||||
else:
|
||||
st_llm_model_name = None
|
||||
st.info(tips)
|
||||
|
||||
if st_llm_api_key:
|
||||
config.app[f"{llm_provider}_api_key"] = st_llm_api_key
|
||||
if st_llm_base_url:
|
||||
config.app[f"{llm_provider}_base_url"] = st_llm_base_url
|
||||
st_llm_api_key = st.text_input(
|
||||
tr("API Key"), value=llm_api_key, type="password"
|
||||
)
|
||||
st_llm_base_url = st.text_input(tr("Base Url"), value=llm_base_url)
|
||||
st_llm_model_name = ""
|
||||
if llm_provider != "ernie":
|
||||
st_llm_model_name = st.text_input(
|
||||
tr("Model Name"),
|
||||
value=llm_model_name,
|
||||
key=f"{llm_provider}_model_name_input",
|
||||
)
|
||||
if st_llm_model_name:
|
||||
config.app[f"{llm_provider}_model_name"] = st_llm_model_name
|
||||
if llm_provider == "ernie":
|
||||
st_llm_secret_key = st.text_input(
|
||||
tr("Secret Key"), value=llm_secret_key, type="password"
|
||||
)
|
||||
config.app[f"{llm_provider}_secret_key"] = st_llm_secret_key
|
||||
else:
|
||||
st_llm_model_name = None
|
||||
|
||||
if llm_provider == "cloudflare":
|
||||
st_llm_account_id = st.text_input(
|
||||
tr("Account ID"), value=llm_account_id
|
||||
)
|
||||
if st_llm_account_id:
|
||||
config.app[f"{llm_provider}_account_id"] = st_llm_account_id
|
||||
if st_llm_api_key:
|
||||
config.app[f"{llm_provider}_api_key"] = st_llm_api_key
|
||||
if st_llm_base_url:
|
||||
config.app[f"{llm_provider}_base_url"] = st_llm_base_url
|
||||
if st_llm_model_name:
|
||||
config.app[f"{llm_provider}_model_name"] = st_llm_model_name
|
||||
if llm_provider == "ernie":
|
||||
st_llm_secret_key = st.text_input(
|
||||
tr("Secret Key"), value=llm_secret_key, type="password"
|
||||
)
|
||||
config.app[f"{llm_provider}_secret_key"] = st_llm_secret_key
|
||||
|
||||
# 右侧面板 - API 密钥设置
|
||||
with right_config_panel:
|
||||
if llm_provider == "cloudflare":
|
||||
st_llm_account_id = st.text_input(
|
||||
tr("Account ID"), value=llm_account_id
|
||||
)
|
||||
if st_llm_account_id:
|
||||
config.app[f"{llm_provider}_account_id"] = st_llm_account_id
|
||||
|
||||
# 右侧面板 - API 密钥设置
|
||||
with right_config_panel:
|
||||
|
||||
def get_keys_from_config(cfg_key):
|
||||
api_keys = config.app.get(cfg_key, [])
|
||||
@ -513,45 +436,21 @@ if not config.app.get("hide_config", False):
|
||||
if value:
|
||||
config.app[cfg_key] = value.split(",")
|
||||
|
||||
st.markdown("##### " + tr("Video API Keys"))
|
||||
st.write(tr("Video Source Settings"))
|
||||
|
||||
# Pexels API Key
|
||||
pexels_api_key = get_keys_from_config("pexels_api_keys")
|
||||
st.markdown(
|
||||
f"**Pexels API Key** ([{tr('点击获取')}](https://www.pexels.com/api/documentation/))"
|
||||
)
|
||||
st.markdown(
|
||||
f"<span style='color:#FF4B4B'>{tr('推荐使用')}</span>",
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
pexels_api_key = st.text_input(
|
||||
"Pexels API Key",
|
||||
value=pexels_api_key,
|
||||
type="password",
|
||||
key="pexels_api_key_input",
|
||||
label_visibility="collapsed",
|
||||
tr("Pexels API Key"), value=pexels_api_key, type="password"
|
||||
)
|
||||
save_keys_to_config("pexels_api_keys", pexels_api_key)
|
||||
|
||||
# Pixabay API Key
|
||||
pixabay_api_key = get_keys_from_config("pixabay_api_keys")
|
||||
st.markdown(
|
||||
f"**Pixabay API Key** ([{tr('点击获取')}](https://pixabay.com/api/docs/))"
|
||||
)
|
||||
st.markdown(
|
||||
f"<span style='color:#808080'>{tr('可以不用配置,如果 Pexels 无法使用,再选择Pixabay')}</span>",
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
pixabay_api_key = st.text_input(
|
||||
"Pixabay API Key",
|
||||
value=pixabay_api_key,
|
||||
type="password",
|
||||
key="pixabay_api_key_input",
|
||||
label_visibility="collapsed",
|
||||
tr("Pixabay API Key"), value=pixabay_api_key, type="password"
|
||||
)
|
||||
save_keys_to_config("pixabay_api_keys", pixabay_api_key)
|
||||
|
||||
|
||||
llm_provider = config.app.get("llm_provider", "").lower()
|
||||
panel = st.columns(3)
|
||||
left_panel = panel[0]
|
||||
middle_panel = panel[1]
|
||||
@ -978,4 +877,4 @@ if start_button:
|
||||
logger.info(tr("Video Generation Completed"))
|
||||
scroll_to_bottom()
|
||||
|
||||
config.save_config()
|
||||
config.save_config()
|
||||
@ -24,7 +24,7 @@
|
||||
"Video Concat Mode": "Videoverkettungsmodus",
|
||||
"Random": "Zufällige Verkettung (empfohlen)",
|
||||
"Sequential": "Sequentielle Verkettung",
|
||||
"Video Transition Mode": "Video Übergangsmodus",
|
||||
"Video Transition Mode": "Video Übergangsmodus",
|
||||
"None": "Kein Übergang",
|
||||
"Shuffle": "Zufällige Übergänge",
|
||||
"FadeIn": "FadeIn",
|
||||
@ -92,8 +92,8 @@
|
||||
"Synthesizing Voice": "Sprachsynthese läuft, bitte warten...",
|
||||
"TTS Provider": "Sprachsynthese-Anbieter auswählen",
|
||||
"Hide Log": "Protokoll ausblenden",
|
||||
"点击获取": "Klicken zum Abrufen",
|
||||
"推荐使用": "Empfohlen",
|
||||
"可以不用配置,如果 Pexels 无法使用,再选择Pixabay": "Kann uneingestellt bleiben. Wenn Pexels nicht funktioniert, wählen Sie Pixabay"
|
||||
"Hide Basic Settings": "Basis-Einstellungen ausblenden\n\nWenn diese Option deaktiviert ist, wird die Basis-Einstellungen-Leiste nicht auf der Seite angezeigt.\n\nWenn Sie sie erneut anzeigen möchten, setzen Sie `hide_config = false` in `config.toml`",
|
||||
"LLM Settings": "**LLM-Einstellungen**",
|
||||
"Video Source Settings": "**Videoquellen-Einstellungen**"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,6 +91,9 @@
|
||||
"Voice Example": "This is an example text for testing speech synthesis",
|
||||
"Synthesizing Voice": "Synthesizing voice, please wait...",
|
||||
"TTS Provider": "Select the voice synthesis provider",
|
||||
"Hide Log": "Hide Log"
|
||||
"Hide Log": "Hide Log",
|
||||
"Hide Basic Settings": "Hide Basic Settings\n\nHidden, the basic settings panel will not be displayed on the page.\n\nIf you need to display it again, please set `hide_config = false` in `config.toml`",
|
||||
"LLM Settings": "**LLM Settings**",
|
||||
"Video Source Settings": "**Video Source Settings**"
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,7 @@
|
||||
"Video Concat Mode": "Modo de Concatenação de Vídeo",
|
||||
"Random": "Concatenação Aleatória (Recomendado)",
|
||||
"Sequential": "Concatenação Sequencial",
|
||||
"Video Transition Mode": "Modo de Transição de Vídeo",
|
||||
"Video Transition Mode": "Modo de Transição de Vídeo",
|
||||
"None": "Nenhuma Transição",
|
||||
"Shuffle": "Transição Aleatória",
|
||||
"FadeIn": "FadeIn",
|
||||
@ -92,8 +92,8 @@
|
||||
"Synthesizing Voice": "Sintetizando voz, por favor aguarde...",
|
||||
"TTS Provider": "Selecione o provedor de síntese de voz",
|
||||
"Hide Log": "Ocultar Log",
|
||||
"点击获取": "Clique para obter",
|
||||
"推荐使用": "Recomendado",
|
||||
"可以不用配置,如果 Pexels 无法使用,再选择Pixabay": "Pode não ser configurado, se o Pexels não estiver disponível, escolha o Pixabay"
|
||||
"Hide Basic Settings": "Ocultar Configurações Básicas\n\nOculto, o painel de configurações básicas não será exibido na página.\n\nSe precisar exibi-lo novamente, defina `hide_config = false` em `config.toml`",
|
||||
"LLM Settings": "**Configurações do LLM**",
|
||||
"Video Source Settings": "**Configurações da Fonte do Vídeo**"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@
|
||||
"Random": "Nối Ngẫu Nhiên (Được Khuyến Nghị)",
|
||||
"Sequential": "Nối Theo Thứ Tự",
|
||||
"Video Transition Mode": "Chế Độ Chuyển Đổi Video",
|
||||
"None": "Không Có Chuyển Đổi",
|
||||
"None": "Không Có Chuyển Đổi",
|
||||
"Shuffle": "Chuyển Đổi Ngẫu Nhiên",
|
||||
"FadeIn": "FadeIn",
|
||||
"FadeOut": "FadeOut",
|
||||
@ -92,8 +92,8 @@
|
||||
"Synthesizing Voice": "Đang tổng hợp giọng nói, vui lòng đợi...",
|
||||
"TTS Provider": "Chọn nhà cung cấp tổng hợp giọng nói",
|
||||
"Hide Log": "Ẩn Nhật Ký",
|
||||
"点击获取": "Nhấp để lấy",
|
||||
"推荐使用": "Được khuyến nghị",
|
||||
"可以不用配置,如果 Pexels 无法使用,再选择Pixabay": "Có thể không cần cấu hình, nếu Pexels không khả dụng, hãy chọn Pixabay"
|
||||
"Hide Basic Settings": "Ẩn Cài Đặt Cơ Bản\n\nẨn, thanh cài đặt cơ bản sẽ không hiển thị trên trang web.\n\nNếu bạn muốn hiển thị lại, vui lòng đặt `hide_config = false` trong `config.toml`",
|
||||
"LLM Settings": "**Cài Đặt LLM**",
|
||||
"Video Source Settings": "**Cài Đặt Nguồn Video**"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
"Language": "简体中文",
|
||||
"Translation": {
|
||||
"Login Required": "需要登录",
|
||||
"Please login to access settings": "请登录后访问配置设置",
|
||||
"Please login to access settings": "请登录后访问配置设置 (:gray[默认用户名: admin, 密码: admin, 您可以在 config.toml 中修改])",
|
||||
"Username": "用户名",
|
||||
"Password": "密码",
|
||||
"Login": "登录",
|
||||
@ -91,6 +91,9 @@
|
||||
"Voice Example": "这是一段测试语音合成的示例文本",
|
||||
"Synthesizing Voice": "语音合成中,请稍候...",
|
||||
"TTS Provider": "语音合成提供商",
|
||||
"Hide Log": "隐藏日志"
|
||||
"Hide Log": "隐藏日志",
|
||||
"Hide Basic Settings": "隐藏基础设置\n\n隐藏后,基础设置面板将不会显示在页面中。\n\n如需要再次显示,请在 `config.toml` 中设置 `hide_config = false`",
|
||||
"LLM Settings": "**大模型设置**",
|
||||
"Video Source Settings": "**视频源设置**"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user