From 67f544ce9ef519b43c52c3a760e2048527f4bc0c Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 28 Nov 2025 14:03:04 +0800 Subject: [PATCH 1/9] add support for ModelScope API --- app/common/config.py | 6 ++++ app/core/entities.py | 1 + app/core/llm/check_llm.py | 45 ++++++++++++++++++++++------- app/core/llm/client.py | 36 +++++++++++++++++++---- app/core/task_factory.py | 4 +++ app/view/setting_interface.py | 8 +++++ resource/subtitle_style/default.txt | 2 +- 7 files changed, 84 insertions(+), 18 deletions(-) diff --git a/app/common/config.py b/app/common/config.py index 8b59c032..b64450b2 100644 --- a/app/common/config.py +++ b/app/common/config.py @@ -125,6 +125,12 @@ class Config(QConfig): "LLM", "ChatGLM_API_Base", "https://open.bigmodel.cn/api/paas/v4" ) + modelscope_model = ConfigItem("LLM", "ModelScope_Model", "Qwen/Qwen3-8B") + modelscope_api_key = ConfigItem("LLM", "ModelScope_API_Key", "") + modelscope_api_base = ConfigItem( + "LLM", "ModelScope_API_Base", "https://api-inference.modelscope.cn/v1" + ) + # ------------------- 翻译配置 ------------------- translator_service = OptionsConfigItem( "Translate", diff --git a/app/core/entities.py b/app/core/entities.py index a24872e9..acacb455 100644 --- a/app/core/entities.py +++ b/app/core/entities.py @@ -105,6 +105,7 @@ class LLMServiceEnum(Enum): LM_STUDIO = "LM Studio" GEMINI = "Gemini" CHATGLM = "ChatGLM" + MODELSCOPE = "ModelScope" class TranscribeModelEnum(Enum): diff --git a/app/core/llm/check_llm.py b/app/core/llm/check_llm.py index 572571f6..f972dd6b 100644 --- a/app/core/llm/check_llm.py +++ b/app/core/llm/check_llm.py @@ -26,17 +26,40 @@ def check_llm_connection( # 创建OpenAI客户端并发送请求到API base_url = normalize_base_url(base_url) api_key = api_key.strip() - response = openai.OpenAI( - base_url=base_url, api_key=api_key, timeout=60 - ).chat.completions.create( - model=model, - messages=[ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": 'Just respond with "Hello"!'}, - ], - timeout=30, - ) - return True, response.choices[0].message.content + # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameters + if "modelscope" in base_url: + extra_body = {"enable_thinking": True} + response_stream = openai.OpenAI( + base_url=base_url, api_key=api_key, timeout=60 + ).chat.completions.create( + model=model, + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", 'content': 'Just respond with "Hello"!'}, + ], + stream=True, + extra_body=extra_body, + timeout=30, + ) + + full_answer = "" + for chunk in response_stream: + if chunk.choices and chunk.choices[0].delta.content: + full_answer += chunk.choices[0].delta.content + + return True, full_answer.strip() + else: + response = openai.OpenAI( + base_url=base_url, api_key=api_key, timeout=60 + ).chat.completions.create( + model=model, + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": 'Just respond with "Hello"!'}, + ], + timeout=30, + ) + return True, response.choices[0].message.content except openai.APIConnectionError: return False, "API Connection Error. Please check your network or VPN." except openai.RateLimitError as e: diff --git a/app/core/llm/client.py b/app/core/llm/client.py index 327a8108..00bafb8a 100644 --- a/app/core/llm/client.py +++ b/app/core/llm/client.py @@ -17,6 +17,7 @@ from app.core.utils.cache import get_llm_cache, memoize from app.core.utils.logger import setup_logger +from types import SimpleNamespace _global_client: Optional[OpenAI] = None _client_lock = threading.Lock() @@ -135,13 +136,36 @@ def call_llm( ValueError: If response is invalid (empty choices or content) """ client = get_llm_client() + # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameters + if "modelscope" in str(client.base_url): + logger.info("Detected ModelScope API, using stream mode with enable_thinking=True.") + + extra_body = {"enable_thinking": True} + + response_stream = client.chat.completions.create( + model=model, + messages=messages, # pyright: ignore[reportArgumentType] + temperature=temperature, + stream=True, + extra_body=extra_body, + **kwargs, + ) - response = client.chat.completions.create( - model=model, - messages=messages, # pyright: ignore[reportArgumentType] - temperature=temperature, - **kwargs, - ) + full_content = "" + for chunk in response_stream: + if chunk.choices and chunk.choices[0].delta.content: + full_content += chunk.choices[0].delta.content + + fake_message = SimpleNamespace(content=full_content) + fake_choice = SimpleNamespace(message=fake_message) + response = SimpleNamespace(choices=[fake_choice]) + else: + response = client.chat.completions.create( + model=model, + messages=messages, # pyright: ignore[reportArgumentType] + temperature=temperature, + **kwargs, + ) # Validate response (exceptions are not cached by diskcache) if not ( diff --git a/app/core/task_factory.py b/app/core/task_factory.py index db493539..019504eb 100644 --- a/app/core/task_factory.py +++ b/app/core/task_factory.py @@ -142,6 +142,10 @@ def create_subtitle_task( base_url = cfg.chatglm_api_base.value api_key = cfg.chatglm_api_key.value llm_model = cfg.chatglm_model.value + elif current_service == LLMServiceEnum.MODELSCOPE: + base_url = cfg.modelscope_api_base.value + api_key = cfg.modelscope_api_key.value + llm_model = cfg.modelscope_model.value else: base_url = "" api_key = "" diff --git a/app/view/setting_interface.py b/app/view/setting_interface.py index df5db3b3..fdc37f9a 100644 --- a/app/view/setting_interface.py +++ b/app/view/setting_interface.py @@ -353,6 +353,14 @@ def __createLLMServiceCards(self): "default_base": "https://open.bigmodel.cn/api/paas/v4", "default_models": ["glm-4-plus", "glm-4-air-250414", "glm-4-flash"], }, + LLMServiceEnum.MODELSCOPE: { + "prefix": "modelscope", + "api_key_cfg": cfg.modelscope_api_key, + "api_base_cfg": cfg.modelscope_api_base, + "model_cfg": cfg.modelscope_model, + "default_base": "https://api-inference.modelscope.cn/v1", + "default_models": ["Qwen/Qwen3-8B", "Qwen/Qwen3-30B-A3B-Instruct-2507", "deepseek-ai/DeepSeek-V3.1"], + }, } # 创建服务配置映射 diff --git a/resource/subtitle_style/default.txt b/resource/subtitle_style/default.txt index 38deb631..e31ddcd1 100644 --- a/resource/subtitle_style/default.txt +++ b/resource/subtitle_style/default.txt @@ -1,4 +1,4 @@ [V4+ Styles] Format: Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,OutlineColour,BackColour,Bold,Italic,Underline,StrikeOut,ScaleX,ScaleY,Spacing,Angle,BorderStyle,Outline,Shadow,Alignment,MarginL,MarginR,MarginV,Encoding -Style: Default,Arial,42,&H005aff65,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,3.2,0,1,2.0,0,2,10,10,30,1,\q1 +Style: Default,Arial,30,&H005aff65,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,3.2,0,1,2.0,0,2,10,10,30,1,\q1 Style: Secondary,Arial,30,&H00ffffff,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0.8,0,1,2.0,0,2,10,10,30,1,\q1 \ No newline at end of file From 964b9d4c913fbff14e148b77697d0fb38d3a9255 Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 28 Nov 2025 14:08:49 +0800 Subject: [PATCH 2/9] restore default subtitle settings --- resource/subtitle_style/default.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/subtitle_style/default.txt b/resource/subtitle_style/default.txt index e31ddcd1..38deb631 100644 --- a/resource/subtitle_style/default.txt +++ b/resource/subtitle_style/default.txt @@ -1,4 +1,4 @@ [V4+ Styles] Format: Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,OutlineColour,BackColour,Bold,Italic,Underline,StrikeOut,ScaleX,ScaleY,Spacing,Angle,BorderStyle,Outline,Shadow,Alignment,MarginL,MarginR,MarginV,Encoding -Style: Default,Arial,30,&H005aff65,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,3.2,0,1,2.0,0,2,10,10,30,1,\q1 +Style: Default,Arial,42,&H005aff65,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,3.2,0,1,2.0,0,2,10,10,30,1,\q1 Style: Secondary,Arial,30,&H00ffffff,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0.8,0,1,2.0,0,2,10,10,30,1,\q1 \ No newline at end of file From bd043bddb6eac349175794b9a4e58e61fda282c8 Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 28 Nov 2025 14:27:42 +0800 Subject: [PATCH 3/9] update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2c4c8256..d8d6792d 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ LLM 大模型是用来字幕段句、字幕优化、以及字幕翻译(如果 | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | SiliconCloud | [SiliconCloud 官网](https://cloud.siliconflow.cn/i/onCHcaDx)配置方法请参考[配置文档](./docs/llm_config.md)
该并发较低,建议把线程设置为5以下。 | | DeepSeek | [DeepSeek 官网](https://platform.deepseek.com),建议使用 `deepseek-v3` 模型,
官方网站最近服务好像并不太稳定。 | +| ModelScope | [ModelScope 官网](https://modelscope.cn/models?filter=inference_type&page=1&tabKey=task)配置方法请参考[配置文档](https://modelscope.cn/docs/model-service/API-Inference/intro)
该并发较低,建议把线程设置为5以下。 | | OpenAI兼容接口 | 如果有其他服务商的API,可直接在软件中填写。base_url 和api_key [VideoCaptioner API](https://api.videocaptioner.cn) | 注:如果用的 API 服务商不支持高并发,请在软件设置中将“线程数”调低,避免请求错误。 From 8434abdfba0f8f366126bf4f56c8cbc7947e31a4 Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 28 Nov 2025 16:40:06 +0800 Subject: [PATCH 4/9] modify some details --- README.md | 2 +- app/core/llm/check_llm.py | 5 +++-- app/core/llm/client.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d8d6792d..1c58851e 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ LLM 大模型是用来字幕段句、字幕优化、以及字幕翻译(如果 | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | SiliconCloud | [SiliconCloud 官网](https://cloud.siliconflow.cn/i/onCHcaDx)配置方法请参考[配置文档](./docs/llm_config.md)
该并发较低,建议把线程设置为5以下。 | | DeepSeek | [DeepSeek 官网](https://platform.deepseek.com),建议使用 `deepseek-v3` 模型,
官方网站最近服务好像并不太稳定。 | -| ModelScope | [ModelScope 官网](https://modelscope.cn/models?filter=inference_type&page=1&tabKey=task)配置方法请参考[配置文档](https://modelscope.cn/docs/model-service/API-Inference/intro)
该并发较低,建议把线程设置为5以下。 | +| ModelScope | [ModelScope 官网](https://modelscope.cn/models?filter=inference_type&page=1&tabKey=task)配置方法请参考[配置文档](https://modelscope.cn/docs/model-service/API-Inference/intro)
该并发较低,建议把线程设置为5以下。 | | OpenAI兼容接口 | 如果有其他服务商的API,可直接在软件中填写。base_url 和api_key [VideoCaptioner API](https://api.videocaptioner.cn) | 注:如果用的 API 服务商不支持高并发,请在软件设置中将“线程数”调低,避免请求错误。 diff --git a/app/core/llm/check_llm.py b/app/core/llm/check_llm.py index f972dd6b..238d993e 100644 --- a/app/core/llm/check_llm.py +++ b/app/core/llm/check_llm.py @@ -26,7 +26,7 @@ def check_llm_connection( # 创建OpenAI客户端并发送请求到API base_url = normalize_base_url(base_url) api_key = api_key.strip() - # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameters + # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameter if "modelscope" in base_url: extra_body = {"enable_thinking": True} response_stream = openai.OpenAI( @@ -46,7 +46,8 @@ def check_llm_connection( for chunk in response_stream: if chunk.choices and chunk.choices[0].delta.content: full_answer += chunk.choices[0].delta.content - + if not full_answer: + raise ValueError("ModelScope streaming response yielded no content") return True, full_answer.strip() else: response = openai.OpenAI( diff --git a/app/core/llm/client.py b/app/core/llm/client.py index 00bafb8a..7856835f 100644 --- a/app/core/llm/client.py +++ b/app/core/llm/client.py @@ -136,7 +136,7 @@ def call_llm( ValueError: If response is invalid (empty choices or content) """ client = get_llm_client() - # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameters + # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameters if "modelscope" in str(client.base_url): logger.info("Detected ModelScope API, using stream mode with enable_thinking=True.") @@ -155,7 +155,8 @@ def call_llm( for chunk in response_stream: if chunk.choices and chunk.choices[0].delta.content: full_content += chunk.choices[0].delta.content - + if not full_content: + raise ValueError("ModelScope streaming response yielded no content") fake_message = SimpleNamespace(content=full_content) fake_choice = SimpleNamespace(message=fake_message) response = SimpleNamespace(choices=[fake_choice]) From 32dcb319934d4f7974a4ef729dff738bd0a9dbc2 Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 28 Nov 2025 16:44:21 +0800 Subject: [PATCH 5/9] change import statement position --- app/core/llm/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/llm/client.py b/app/core/llm/client.py index 7856835f..bd7a2f1c 100644 --- a/app/core/llm/client.py +++ b/app/core/llm/client.py @@ -3,6 +3,7 @@ import os import threading from typing import Any, List, Optional +from types import SimpleNamespace from urllib.parse import urlparse, urlunparse import openai @@ -17,7 +18,6 @@ from app.core.utils.cache import get_llm_cache, memoize from app.core.utils.logger import setup_logger -from types import SimpleNamespace _global_client: Optional[OpenAI] = None _client_lock = threading.Lock() From 7e650a78b732240580e3e46372a72077a61d13e4 Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 19 Dec 2025 14:50:06 +0800 Subject: [PATCH 6/9] modify extra parameter logic --- app/common/config.py | 7 ++++++ app/core/entities.py | 3 ++- app/core/llm/check_llm.py | 46 ++++++++------------------------- app/core/llm/client.py | 53 ++++++++++++++++----------------------- app/core/task_factory.py | 3 +++ 5 files changed, 45 insertions(+), 67 deletions(-) diff --git a/app/common/config.py b/app/common/config.py index b64450b2..a811a1aa 100644 --- a/app/common/config.py +++ b/app/common/config.py @@ -130,6 +130,13 @@ class Config(QConfig): modelscope_api_base = ConfigItem( "LLM", "ModelScope_API_Base", "https://api-inference.modelscope.cn/v1" ) + modelscope_extra_body = ConfigItem( + "LLM", + "ModelScope_Extra_Body", + { + "enable_thinking": False, + }, + ) # ------------------- 翻译配置 ------------------- translator_service = OptionsConfigItem( diff --git a/app/core/entities.py b/app/core/entities.py index acacb455..f1d04a6f 100644 --- a/app/core/entities.py +++ b/app/core/entities.py @@ -1,7 +1,7 @@ import datetime from dataclasses import dataclass, field from enum import Enum -from typing import TYPE_CHECKING, Literal, Optional +from typing import TYPE_CHECKING, Literal, Optional, Dict, Any if TYPE_CHECKING: from app.core.translate.types import TargetLanguage @@ -559,6 +559,7 @@ class SubtitleConfig: base_url: Optional[str] = None api_key: Optional[str] = None llm_model: Optional[str] = None + extra_body: Optional[Dict[str, Any]] = None deeplx_endpoint: Optional[str] = None # 翻译服务 translator_service: Optional[TranslatorServiceEnum] = None diff --git a/app/core/llm/check_llm.py b/app/core/llm/check_llm.py index 238d993e..572571f6 100644 --- a/app/core/llm/check_llm.py +++ b/app/core/llm/check_llm.py @@ -26,41 +26,17 @@ def check_llm_connection( # 创建OpenAI客户端并发送请求到API base_url = normalize_base_url(base_url) api_key = api_key.strip() - # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameter - if "modelscope" in base_url: - extra_body = {"enable_thinking": True} - response_stream = openai.OpenAI( - base_url=base_url, api_key=api_key, timeout=60 - ).chat.completions.create( - model=model, - messages=[ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", 'content': 'Just respond with "Hello"!'}, - ], - stream=True, - extra_body=extra_body, - timeout=30, - ) - - full_answer = "" - for chunk in response_stream: - if chunk.choices and chunk.choices[0].delta.content: - full_answer += chunk.choices[0].delta.content - if not full_answer: - raise ValueError("ModelScope streaming response yielded no content") - return True, full_answer.strip() - else: - response = openai.OpenAI( - base_url=base_url, api_key=api_key, timeout=60 - ).chat.completions.create( - model=model, - messages=[ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": 'Just respond with "Hello"!'}, - ], - timeout=30, - ) - return True, response.choices[0].message.content + response = openai.OpenAI( + base_url=base_url, api_key=api_key, timeout=60 + ).chat.completions.create( + model=model, + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": 'Just respond with "Hello"!'}, + ], + timeout=30, + ) + return True, response.choices[0].message.content except openai.APIConnectionError: return False, "API Connection Error. Please check your network or VPN." except openai.RateLimitError as e: diff --git a/app/core/llm/client.py b/app/core/llm/client.py index bd7a2f1c..6e2e8d0c 100644 --- a/app/core/llm/client.py +++ b/app/core/llm/client.py @@ -1,5 +1,6 @@ """Unified LLM client for the application.""" - +from app.core.utils.logger import setup_logger +logger = setup_logger(__name__) # 使用当前模块名作为logger名称 import os import threading from typing import Any, List, Optional @@ -136,37 +137,27 @@ def call_llm( ValueError: If response is invalid (empty choices or content) """ client = get_llm_client() - # Check whether it is the ModelScope platform, as some models require the stream and enable_thinking parameters - if "modelscope" in str(client.base_url): - logger.info("Detected ModelScope API, using stream mode with enable_thinking=True.") - - extra_body = {"enable_thinking": True} - - response_stream = client.chat.completions.create( - model=model, - messages=messages, # pyright: ignore[reportArgumentType] - temperature=temperature, - stream=True, - extra_body=extra_body, - **kwargs, - ) - full_content = "" - for chunk in response_stream: - if chunk.choices and chunk.choices[0].delta.content: - full_content += chunk.choices[0].delta.content - if not full_content: - raise ValueError("ModelScope streaming response yielded no content") - fake_message = SimpleNamespace(content=full_content) - fake_choice = SimpleNamespace(message=fake_message) - response = SimpleNamespace(choices=[fake_choice]) - else: - response = client.chat.completions.create( - model=model, - messages=messages, # pyright: ignore[reportArgumentType] - temperature=temperature, - **kwargs, - ) + # # 在需要打印的地方 + # extra_body = kwargs.get("extra_body", {}) + # logger.info(f"DEBUG: Passing extra_body to API: {extra_body}") # 使用 logger + # --- 核心:智能处理平台特定参数 --- + # 检查是否为 ModelScope 平台 + # if "modelscope" in str(client.base_url): + # logger.info("Detected ModelScope API, ensuring 'enable_thinking' is set to false.") + # # 从 kwargs 中获取现有的 extra_body,如果没有则创建一个空字典 + # extra_body = kwargs.get("extra_body", {}) + # # 强制设置 enable_thinking 为 false,以满足其 API 要求 + # extra_body["enable_thinking"] = False + # # 将修改后的 extra_body 放回 kwargs + # kwargs["extra_body"] = extra_body + + response = client.chat.completions.create( + model=model, + messages=messages, # pyright: ignore[reportArgumentType] + temperature=temperature, + **kwargs, + ) # Validate response (exceptions are not cached by diskcache) if not ( diff --git a/app/core/task_factory.py b/app/core/task_factory.py index 019504eb..8cd7c584 100644 --- a/app/core/task_factory.py +++ b/app/core/task_factory.py @@ -112,6 +112,7 @@ def create_subtitle_task( Path(file_path).parent / f"【字幕】{output_name}{suffix}.srt" ) + extra_body = None # 默认值为None # 根据当前选择的LLM服务获取对应的配置 current_service = cfg.llm_service.value if current_service == LLMServiceEnum.OPENAI: @@ -146,6 +147,7 @@ def create_subtitle_task( base_url = cfg.modelscope_api_base.value api_key = cfg.modelscope_api_key.value llm_model = cfg.modelscope_model.value + extra_body = cfg.modelscope_extra_body.value else: base_url = "" api_key = "" @@ -156,6 +158,7 @@ def create_subtitle_task( base_url=base_url, api_key=api_key, llm_model=llm_model, + extra_body=extra_body, deeplx_endpoint=cfg.deeplx_endpoint.value, # 翻译服务 translator_service=cfg.translator_service.value, From 68504b51fcc437d4603fa10815206401f283142e Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 19 Dec 2025 14:53:37 +0800 Subject: [PATCH 7/9] update --- app/core/llm/client.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/app/core/llm/client.py b/app/core/llm/client.py index 6e2e8d0c..d2c714f7 100644 --- a/app/core/llm/client.py +++ b/app/core/llm/client.py @@ -138,20 +138,6 @@ def call_llm( """ client = get_llm_client() - # # 在需要打印的地方 - # extra_body = kwargs.get("extra_body", {}) - # logger.info(f"DEBUG: Passing extra_body to API: {extra_body}") # 使用 logger - # --- 核心:智能处理平台特定参数 --- - # 检查是否为 ModelScope 平台 - # if "modelscope" in str(client.base_url): - # logger.info("Detected ModelScope API, ensuring 'enable_thinking' is set to false.") - # # 从 kwargs 中获取现有的 extra_body,如果没有则创建一个空字典 - # extra_body = kwargs.get("extra_body", {}) - # # 强制设置 enable_thinking 为 false,以满足其 API 要求 - # extra_body["enable_thinking"] = False - # # 将修改后的 extra_body 放回 kwargs - # kwargs["extra_body"] = extra_body - response = client.chat.completions.create( model=model, messages=messages, # pyright: ignore[reportArgumentType] From 5f91ca59a9f4724afe0d37bf1815a8e87dab89a1 Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 19 Dec 2025 14:55:28 +0800 Subject: [PATCH 8/9] delete some unused packages --- app/core/llm/client.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/core/llm/client.py b/app/core/llm/client.py index d2c714f7..e99bb2f6 100644 --- a/app/core/llm/client.py +++ b/app/core/llm/client.py @@ -1,10 +1,7 @@ """Unified LLM client for the application.""" -from app.core.utils.logger import setup_logger -logger = setup_logger(__name__) # 使用当前模块名作为logger名称 import os import threading from typing import Any, List, Optional -from types import SimpleNamespace from urllib.parse import urlparse, urlunparse import openai From 2c0ab2342c96703af4452155087aca42af714201 Mon Sep 17 00:00:00 2001 From: yrk <2493404415@qq.com> Date: Fri, 19 Dec 2025 15:02:01 +0800 Subject: [PATCH 9/9] restore the deleted blank lines --- app/core/llm/client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/core/llm/client.py b/app/core/llm/client.py index e99bb2f6..327a8108 100644 --- a/app/core/llm/client.py +++ b/app/core/llm/client.py @@ -1,4 +1,5 @@ """Unified LLM client for the application.""" + import os import threading from typing import Any, List, Optional