fix: 三端联调测试 2 P0 + 6 P1 + 2 P2 修复
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
P0-1: SaaS relay 模型别名解析 — "glm-4-flash" → "glm-4-flash-250414" (resolve_model)
P0-2: config.rs interpolate_env_vars UTF-8 修复 (chars 迭代器替代 bytes as char)
+ DB 启动编码检查 + docker-compose UTF-8 编码参数
P1-3: UI 模型选择器覆盖 Agent 默认模型 (model_override 全链路: TS→Tauri→Rust kernel)
P1-6: 知识搜索管道修复 — seed_knowledge 创建 chunks + 默认分类 (seed/uploaded/distillation)
P1-7: 用量限额从当前 Plan 读取 (非 stale usage 表)
P1-8: relay 双维度配额检查 (relay_requests + input_tokens)
P2-9: SSE 路径 token 计数修复 — 流结束检测替代固定 500ms sleep + billing increment
This commit is contained in:
@@ -30,6 +30,9 @@ pub struct ChatRequest {
|
||||
/// Enable sub-agent delegation (Ultra mode only)
|
||||
#[serde(default)]
|
||||
pub subagent_enabled: Option<bool>,
|
||||
/// Model override — UI 选择的模型优先于 Agent 配置的默认模型
|
||||
#[serde(default)]
|
||||
pub model: Option<String>,
|
||||
}
|
||||
|
||||
/// Chat response
|
||||
@@ -76,6 +79,9 @@ pub struct StreamChatRequest {
|
||||
/// Enable sub-agent delegation (Ultra mode only)
|
||||
#[serde(default)]
|
||||
pub subagent_enabled: Option<bool>,
|
||||
/// Model override — UI 选择的模型优先于 Agent 配置的默认模型
|
||||
#[serde(default)]
|
||||
pub model: Option<String>,
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -116,7 +122,7 @@ pub async fn agent_chat(
|
||||
None
|
||||
};
|
||||
|
||||
let response = kernel.send_message_with_chat_mode(&id, request.message, chat_mode)
|
||||
let response = kernel.send_message_with_chat_mode(&id, request.message, chat_mode, request.model)
|
||||
.await
|
||||
.map_err(|e| format!("Chat failed: {}", e))?;
|
||||
|
||||
@@ -257,6 +263,7 @@ pub async fn agent_chat_stream(
|
||||
prompt_arg,
|
||||
session_id_parsed,
|
||||
Some(chat_mode_config),
|
||||
request.model.clone(),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
|
||||
@@ -60,6 +60,7 @@ export function installChatMethods(ClientClass: { prototype: KernelClient }): vo
|
||||
reasoning_effort?: string;
|
||||
plan_mode?: boolean;
|
||||
subagent_enabled?: boolean;
|
||||
model?: string;
|
||||
}
|
||||
): Promise<{ runId: string }> {
|
||||
const runId = crypto.randomUUID();
|
||||
@@ -199,6 +200,7 @@ export function installChatMethods(ClientClass: { prototype: KernelClient }): vo
|
||||
reasoningEffort: opts?.reasoning_effort,
|
||||
planMode: opts?.plan_mode,
|
||||
subagentEnabled: opts?.subagent_enabled,
|
||||
model: opts?.model,
|
||||
},
|
||||
});
|
||||
} catch (err: unknown) {
|
||||
|
||||
@@ -303,6 +303,9 @@ export const useStreamStore = create<StreamState>()(
|
||||
.map(m => ({ role: m.role, content: m.content }))
|
||||
.slice(-20);
|
||||
|
||||
// UI 模型选择器应覆盖 Agent 默认模型
|
||||
const currentModel = useConversationStore.getState().currentModel;
|
||||
|
||||
const result = await client.chatStream(
|
||||
content,
|
||||
{
|
||||
@@ -534,6 +537,7 @@ export const useStreamStore = create<StreamState>()(
|
||||
set({ isStreaming: false, activeRunId: null });
|
||||
},
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
{
|
||||
sessionKey: effectiveSessionKey,
|
||||
agentId: effectiveAgentId,
|
||||
@@ -542,7 +546,8 @@ export const useStreamStore = create<StreamState>()(
|
||||
plan_mode: get().getChatModeConfig().plan_mode,
|
||||
subagent_enabled: get().getChatModeConfig().subagent_enabled,
|
||||
history,
|
||||
}
|
||||
model: currentModel || undefined,
|
||||
} as Parameters<typeof client.chatStream>[2]
|
||||
);
|
||||
|
||||
if (result?.runId) {
|
||||
|
||||
Reference in New Issue
Block a user