feat(app): 适配最新版本

- 修改软件内部分提示文本
- 添加 API KEY 掩码,防止直接输出 API KEY 内容
This commit is contained in:
himeditator
2026-01-10 20:15:32 +08:00
parent 0825e48902
commit 3324b630d1
14 changed files with 112 additions and 59 deletions

View File

@@ -27,14 +27,14 @@ def ollama_translate(model: str, target: str, text: str, time_s: str, url: str =
if url:
if OpenAI:
client = OpenAI(base_url=url, api_key=key if key else "ollama")
response = client.chat.completions.create(
openai_response = client.chat.completions.create(
model=model,
messages=[
{"role": "system", "content": f"/no_think Translate the following content into {lang_map[target]}, and do not output any additional information."},
{"role": "user", "content": text}
]
)
content = response.choices[0].message.content or ""
content = openai_response.choices[0].message.content or ""
else:
client = Client(host=url)
response: ChatResponse = client.chat(