🐛 fix(ai/query-editor/mac-window): 修复模型兼容性并优化即时执行与窗口交互

- AI 兼容性:为 Anthropic Provider 补齐 tools/tool_use/tool_result 协议转换,支持工具调用与流式工具结果解析
- 降级策略:OpenAI 兼容接口在 tools 请求返回 400/422/404 时自动回退为纯文本模式
- 配置修复:调整 MiniMax 预设为 Anthropic 兼容端点并更新默认模型列表
- 状态隔离:AI 聊天面板停止将动态模型列表写回供应商配置,避免污染静态 models 数据
- 编辑器修复:QueryEditor 在 runImmediately 场景下避免重复追加 SQL,改为直接选中并执行
- 交互优化:修复 macOS 原生窗口控制切换与标题栏点击行为,避免窗口按钮状态异常
This commit is contained in:
Syngnat
2026-03-26 17:57:29 +08:00
parent 98e9e5686d
commit b958ff6481
8 changed files with 246 additions and 61 deletions

View File

@@ -333,21 +333,8 @@ export const AIChatPanel: React.FC<AIChatPanelProps> = ({
}
}, [activeProvider?.id]);
useEffect(() => {
if (activeProvider && dynamicModels.length > 0) {
const currentModels = activeProvider.models || [];
if (JSON.stringify(currentModels) !== JSON.stringify(dynamicModels)) {
try {
const Service = (window as any).go?.aiservice?.Service;
const payload = { ...activeProvider, models: dynamicModels };
Service?.AISaveProvider?.(payload);
setActiveProvider(payload);
} catch (e) {
console.warn('Failed to cache models', e);
}
}
}
}, [activeProvider, dynamicModels]);
// dynamicModels 仅在内存中使用,不再写回供应商配置,避免污染静态 models 列表
const fetchDynamicModels = useCallback(async () => {
try {