diff --git a/packages/ai-native/src/browser/chat/chat.module.less b/packages/ai-native/src/browser/chat/chat.module.less index 43626a724d..23cec7f859 100644 --- a/packages/ai-native/src/browser/chat/chat.module.less +++ b/packages/ai-native/src/browser/chat/chat.module.less @@ -4,7 +4,7 @@ height: 100%; border-radius: 12px; overflow: hidden; - font-size: 14px; + font-size: 12px; user-select: text; border-top-left-radius: 12px; @@ -75,7 +75,7 @@ .header_container { height: 36px; - padding: 8px 0 8px 16px; + padding: 8px 8px 8px 16px; box-sizing: border-box; background-color: var(--editorGroupHeader-tabsBackground); user-select: none; diff --git a/packages/ai-native/src/browser/chat/chat.view.tsx b/packages/ai-native/src/browser/chat/chat.view.tsx index ec8ad40adb..38d2ef9026 100644 --- a/packages/ai-native/src/browser/chat/chat.view.tsx +++ b/packages/ai-native/src/browser/chat/chat.view.tsx @@ -83,12 +83,9 @@ export const AIChatView = () => { const promptProvider = useInjectable(ChatAgentPromptProvider); const layoutService = useInjectable(IMainLayoutService); - const mcpServerProxyService = useInjectable(TokenMCPServerProxyService); const msgHistoryManager = aiChatService.sessionModel.history; const containerRef = React.useRef(null); const chatInputRef = React.useRef<{ setInputValue: (v: string) => void } | null>(null); - const dialogService = useInjectable(IDialogService); - const aiNativeConfigService = useInjectable(AINativeConfigService); const [shortcutCommands, setShortcutCommands] = React.useState([]); @@ -110,7 +107,6 @@ export const AIChatView = () => { const [defaultAgentId, setDefaultAgentId] = React.useState(''); const [command, setCommand] = React.useState(''); const [theme, setTheme] = React.useState(null); - const [mcpToolsCount, setMcpToolsCount] = React.useState(0); React.useEffect(() => { const featureSlashCommands = chatFeatureRegistry.getAllShortcutSlashCommand(); @@ -662,25 +658,6 @@ export const AIChatView = () => { }; }, [aiChatService.sessionModel]); - useEventEffect( - mcpServerProxyService.onChangeMCPServers, - () => { - mcpServerProxyService.getAllMCPTools().then((tools) => { - setMcpToolsCount(tools.length); - }); - }, - [mcpServerProxyService], - ); - - const handleShowMCPTools = React.useCallback(async () => { - const tools = await mcpServerProxyService.getAllMCPTools(); - dialogService.open({ - message: , - type: MessageType.Empty, - buttons: ['关闭'], - }); - }, [mcpServerProxyService, dialogService]); - return (
@@ -720,13 +697,6 @@ export const AIChatView = () => { ))}
-
- {aiNativeConfigService.capabilities.supportsMCP && ( -
- {`MCP Tools: ${mcpToolsCount}`} -
- )} -
@@ -765,6 +735,9 @@ export function DefaultChatViewHeader({ handleClear: () => any; handleCloseChatView: () => any; }) { + const dialogService = useInjectable(IDialogService); + const aiNativeConfigService = useInjectable(AINativeConfigService); + const mcpServerProxyService = useInjectable(TokenMCPServerProxyService); const aiChatService = useInjectable(IChatInternalService); const [historyList, setHistoryList] = React.useState([]); const [currentTitle, setCurrentTitle] = React.useState(''); @@ -786,6 +759,15 @@ export function DefaultChatViewHeader({ [aiChatService], ); + const handleShowMCPTools = React.useCallback(async () => { + const tools = await mcpServerProxyService.getAllMCPTools(); + dialogService.open({ + message: , + type: MessageType.Empty, + buttons: ['关闭'], + }); + }, [mcpServerProxyService, dialogService]); + React.useEffect(() => { const getHistoryList = () => { const currentMessages = aiChatService.sessionModel.history.getMessages(); @@ -865,6 +847,23 @@ export function DefaultChatViewHeader({ ariaLabel={localize('aiNative.operate.clear.title')} /> + {aiNativeConfigService.capabilities.supportsMCP && ( + + + + )} { - const model = editor.getModel(); - if (!model) { - return; - } - - const crossCode = editor.getModel()?.getValueInRange(Selection.liftSelection(selection)); - this.aiChatService.sendMessage({ - message: `Explain code: \`\`\`\n${crossCode}\n\`\`\``, - prompt: `Help me, Explain code: \`\`\`\n${crossCode}\n\`\`\``, - }); - }, - }, - ); + // registry.registerEditorInlineChat( + // { + // id: 'ai-explain', + // name: EInlineOperation.Explain, + // renderType: 'button', + // codeAction: { + // isPreferred: true, + // }, + // }, + // { + // execute: async (editor: ICodeEditor, selection: ISelection, token) => { + // const model = editor.getModel(); + // if (!model) { + // return; + // } + + // const crossCode = editor.getModel()?.getValueInRange(Selection.liftSelection(selection)); + // this.aiChatService.sendMessage({ + // message: `Explain code: \`\`\`\n${crossCode}\n\`\`\``, + // prompt: `Help me, Explain code: \`\`\`\n${crossCode}\n\`\`\``, + // }); + // }, + // }, + // ); registry.registerTerminalInlineChat( { @@ -236,38 +236,38 @@ export class AINativeContribution implements AINativeCoreContribution { ], ); - registry.registerSlashCommand( - { - name: 'Explain', - description: 'Explain', - isShortcut: true, - tooltip: 'Explain', - }, - { - providerRender: SlashCommand, - providerInputPlaceholder(value, editor) { - return 'Please enter or paste the code.'; - }, - providerPrompt(value, editor) { - return `Explain code: \`\`\`\n${value}\n\`\`\``; - }, - execute: (value: string, send: TChatSlashCommandSend, editor: ICodeEditor) => { - send(value); - }, - }, - ); - - registry.registerSlashCommand( - { - name: 'Test', - description: 'Test', - }, - { - execute: (value: string, send: TChatSlashCommandSend, editor: ICodeEditor) => { - send(value); - }, - }, - ); + // registry.registerSlashCommand( + // { + // name: 'Explain', + // description: 'Explain', + // isShortcut: true, + // tooltip: 'Explain', + // }, + // { + // providerRender: SlashCommand, + // providerInputPlaceholder(value, editor) { + // return 'Please enter or paste the code.'; + // }, + // providerPrompt(value, editor) { + // return `Explain code: \`\`\`\n${value}\n\`\`\``; + // }, + // execute: (value: string, send: TChatSlashCommandSend, editor: ICodeEditor) => { + // send(value); + // }, + // }, + // ); + + // registry.registerSlashCommand( + // { + // name: 'Test', + // description: 'Test', + // }, + // { + // execute: (value: string, send: TChatSlashCommandSend, editor: ICodeEditor) => { + // send(value); + // }, + // }, + // ); } registerResolveConflictFeature(registry: IResolveConflictRegistry): void {