From c5cd47adc2ffa142cb49fe6b5f10b2ff64f72fcc Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Mon, 4 May 2026 13:50:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=A8=A1=E5=9E=8B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=AB=98=E7=BA=A7=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/src/lib/pack-api.ts | 1 + dashboard/src/routes/config/model.tsx | 25 +++++++++++++---- src/config/config.py | 2 +- src/config/default_model_config.py | 39 +++++---------------------- src/config/model_configs.py | 12 ++++++++- src/learners/expression_learner.py | 2 +- src/learners/jargon_miner.py | 2 +- src/llm_models/utils_model.py | 4 +++ 8 files changed, 46 insertions(+), 41 deletions(-) diff --git a/dashboard/src/lib/pack-api.ts b/dashboard/src/lib/pack-api.ts index c56b732f..2ca9b7b4 100644 --- a/dashboard/src/lib/pack-api.ts +++ b/dashboard/src/lib/pack-api.ts @@ -53,6 +53,7 @@ export interface PackTaskConfigs { utils_small?: PackTaskConfig tool_use?: PackTaskConfig replyer?: PackTaskConfig + learner?: PackTaskConfig planner?: PackTaskConfig vlm?: PackTaskConfig voice?: PackTaskConfig diff --git a/dashboard/src/routes/config/model.tsx b/dashboard/src/routes/config/model.tsx index d7a3d0cf..52388bd1 100644 --- a/dashboard/src/routes/config/model.tsx +++ b/dashboard/src/routes/config/model.tsx @@ -106,6 +106,7 @@ function ModelConfigPageContent() { const [jumpToPage, setJumpToPage] = useState('') const [advancedTemperatureMode, setAdvancedTemperatureMode] = useState(false) + const [advancedTaskSettingsVisible, setAdvancedTaskSettingsVisible] = useState(false) // 模型 Combobox 状态 const [modelComboboxOpen, setModelComboboxOpen] = useState(false) @@ -155,7 +156,9 @@ function ModelConfigPageContent() { // 检查是否有模型 if (!task.model_list || task.model_list.length === 0) { - emptyTaskList.push(key) + if (key !== 'learner') { + emptyTaskList.push(key) + } continue } @@ -939,14 +942,26 @@ function ModelConfigPageContent() { {/* 模型任务配置标签页 */} -

- 为不同的任务配置使用的模型和参数 -

+
+

+ 为不同的任务配置使用的模型和参数 +

+ {taskConfigSchema?.fields.some((field) => field.advanced) && ( + + )} +
{taskConfig && taskConfigSchema && (
{taskConfigSchema.fields - .filter(f => f.type === 'object') + .filter(f => f.type === 'object' && (advancedTaskSettingsVisible || !f.advanced)) .map((field, index) => { const desc = field.description || field.name const commaIdx = desc.search(/[,,]/) diff --git a/src/config/config.py b/src/config/config.py index 6cf3ac08..135604b2 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -59,7 +59,7 @@ LEGACY_ENV_PATH: Path = (PROJECT_ROOT / ".env").resolve().absolute() A_MEMORIX_LEGACY_CONFIG_PATH: Path = (CONFIG_DIR / "a_memorix.toml").resolve().absolute() MMC_VERSION: str = "1.0.0" CONFIG_VERSION: str = "8.10.1" -MODEL_CONFIG_VERSION: str = "1.14.6" +MODEL_CONFIG_VERSION: str = "1.14.8" logger = get_logger("config") diff --git a/src/config/default_model_config.py b/src/config/default_model_config.py index e74653ae..5a7dd6d8 100644 --- a/src/config/default_model_config.py +++ b/src/config/default_model_config.py @@ -32,6 +32,13 @@ DEFAULT_TASK_CONFIG_TEMPLATES: dict[str, dict[str, Any]] = { "slow_threshold": 120.0, "selection_strategy": "random", }, + "learner": { + "model_list": [], + "max_tokens": 4096, + "temperature": 0.5, + "slow_threshold": 15.0, + "selection_strategy": "random", + }, "planner": { "model_list": ["deepseek-v4-flash"], "max_tokens": 8000, @@ -39,13 +46,6 @@ DEFAULT_TASK_CONFIG_TEMPLATES: dict[str, dict[str, Any]] = { "slow_threshold": 12.0, "selection_strategy": "random", }, - "vlm": { - "model_list": ["qwen3.5-flash"], - "max_tokens": 512, - "temperature": 0.3, - "slow_threshold": 15.0, - "selection_strategy": "random", - }, "voice": { "model_list": [""], "max_tokens": 1024, @@ -53,13 +53,6 @@ DEFAULT_TASK_CONFIG_TEMPLATES: dict[str, dict[str, Any]] = { "slow_threshold": 12.0, "selection_strategy": "random", }, - "embedding": { - "model_list": ["qwen3-embedding"], - "max_tokens": 1024, - "temperature": 0.3, - "slow_threshold": 5.0, - "selection_strategy": "random", - }, } DEFAULT_MODEL_TEMPLATES: list[dict[str, Any]] = [ @@ -89,24 +82,6 @@ DEFAULT_MODEL_TEMPLATES: list[dict[str, Any]] = [ "price_out": 2.0, "visual": False, "extra_params": {"enable_thinking": "false"}, - }, - { - "model_identifier": "qwen3.5-flash", - "name": "qwen3.5-flash", - "api_provider": "BaiLian", - "price_in": 0.2, - "price_out": 2.0, - "visual": True, - "extra_params": {"enable_thinking": "false"}, - }, - { - "model_identifier": "text-embedding-v4", - "name": "qwen3-embedding", - "api_provider": "BaiLian", - "price_in": 0.5, - "price_out": 0.5, - "visual": False, - "extra_params": {}, } ] diff --git a/src/config/model_configs.py b/src/config/model_configs.py index 447eadf2..8c1a5da9 100644 --- a/src/config/model_configs.py +++ b/src/config/model_configs.py @@ -436,8 +436,18 @@ class ModelTaskConfig(ConfigBase): "x-icon": "message-square", }, ) - """首要回复模型配置, 还用于表达器和表达方式学习""" + """首要回复模型配置""" + learner: TaskConfig = Field( + default_factory=TaskConfig, + json_schema_extra={ + "x-widget": "custom", + "x-icon": "graduation-cap", + "advanced": True, + }, + ) + """学习模型配置,用于表达方式学习和黑话学习;留空时自动继用 utils 模型""" + planner: TaskConfig = Field( default_factory=TaskConfig, json_schema_extra={ diff --git a/src/learners/expression_learner.py b/src/learners/expression_learner.py index b7e1c97c..d96c451c 100644 --- a/src/learners/expression_learner.py +++ b/src/learners/expression_learner.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: logger = get_logger("expressor") express_learn_model = LLMServiceClient( - task_name="replyer", request_type="expression.learner" + task_name="learner", request_type="expression.learner" ) summary_model = LLMServiceClient(task_name="utils", request_type="expression.summary") diff --git a/src/learners/jargon_miner.py b/src/learners/jargon_miner.py index bccdde1a..735f07e1 100644 --- a/src/learners/jargon_miner.py +++ b/src/learners/jargon_miner.py @@ -23,7 +23,7 @@ from .expression_utils import is_single_char_jargon logger = get_logger("jargon") -llm_inference = LLMServiceClient(task_name="utils", request_type="jargon.inference") +llm_inference = LLMServiceClient(task_name="learner", request_type="jargon.inference") class JargonEntry(TypedDict): diff --git a/src/llm_models/utils_model.py b/src/llm_models/utils_model.py index 922d049d..95cc1d66 100644 --- a/src/llm_models/utils_model.py +++ b/src/llm_models/utils_model.py @@ -111,6 +111,10 @@ class LLMOrchestrator: task_config = getattr(model_task_config, self.task_name, None) if not isinstance(task_config, TaskConfig): raise ValueError(f"未找到名为 '{self.task_name}' 的任务配置") + if self.task_name == "learner" and not any(str(model_name).strip() for model_name in task_config.model_list): + fallback_task_config = getattr(model_task_config, "utils", None) + if isinstance(fallback_task_config, TaskConfig): + return fallback_task_config return task_config def _refresh_task_config(self) -> TaskConfig: