Auto sync connectai
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { logInfo } from '../../utils';
|
||||
import { bridgeFetch, getBridgeBaseUrl } from './bridgeClient';
|
||||
|
||||
/**
|
||||
@@ -53,6 +54,7 @@ export async function handleSlashCommand(
|
||||
const head = (spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx)).toLowerCase() as SlashCommand;
|
||||
const arg = spaceIdx === -1 ? '' : trimmed.slice(spaceIdx + 1).trim();
|
||||
|
||||
logInfo(`[SLASH] handleSlashCommand start head=${head} arg="${arg.slice(0, 60)}" bridge=${getBridgeBaseUrl()}`);
|
||||
chunk(view, `\n\n**📻 Datacollect Radio** · \`${head}\` · bridge=\`${getBridgeBaseUrl()}\`\n\n`);
|
||||
|
||||
try {
|
||||
@@ -64,11 +66,13 @@ export async function handleSlashCommand(
|
||||
}
|
||||
return true;
|
||||
} catch (e: any) {
|
||||
logInfo(`[SLASH] handleSlashCommand error head=${head}: ${e?.message || String(e)}`);
|
||||
chunk(view, `\n\n> ❌ **에러**: ${e?.message || String(e)}\n`);
|
||||
return true;
|
||||
} finally {
|
||||
// input 잠금 해제 — slashRouter 진입했으면 어떤 경로든 반드시 통과.
|
||||
view?.postMessage({ type: 'streamEnd' });
|
||||
logInfo(`[SLASH] handleSlashCommand finished head=${head} streamEnd posted`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,26 @@ export async function handleChatMessage(provider: SidebarChatProvider, data: any
|
||||
// 사용자가 채팅에서 `/research`, `/benchmark`, `/youtube`, `/blog` 같은
|
||||
// 슬래시 명령을 보내면 Datacollect bridge(3002)로 위임. 회사 모드/일반
|
||||
// chat 분기보다 먼저 잡아 LLM 토큰을 쓰지 않고 직접 처리한다.
|
||||
//
|
||||
// 진단 logging: "/benchmark 입력했는데 아무 답변도 안 옴" 같은 보고가
|
||||
// 들어왔을 때, OutputChannel(Astra)에 단계별 trace가 남으면 어디서
|
||||
// 막혔는지 (분기 진입 / view 부재 / bridge 호출 실패) 즉시 판별 가능.
|
||||
if (typeof data.value === 'string') {
|
||||
const { isSlashCommand, handleSlashCommand } = await import('../features/datacollect/slashRouter');
|
||||
if (isSlashCommand(data.value)) {
|
||||
await handleSlashCommand(data.value, provider._view?.webview);
|
||||
const matched = isSlashCommand(data.value);
|
||||
logInfo(`[SLASH] prompt received: ${JSON.stringify(data.value).slice(0, 100)} matched=${matched} hasView=${!!provider._view}`);
|
||||
if (matched) {
|
||||
if (!provider._view?.webview) {
|
||||
// webview가 비활성/닫힘 상태면 chunk가 silently drop되므로
|
||||
// 사용자가 아무 응답도 못 본다. notification으로 즉시 surface.
|
||||
const msg = '📻 Datacollect Radio: 채팅 webview가 활성 상태가 아닙니다. Astra 사이드바를 한 번 열고 다시 시도해 주세요.';
|
||||
await vscode.window.showWarningMessage(msg);
|
||||
logInfo(`[SLASH] webview not available — aborting`);
|
||||
return true;
|
||||
}
|
||||
logInfo(`[SLASH] handleSlashCommand entering`);
|
||||
await handleSlashCommand(data.value, provider._view.webview);
|
||||
logInfo(`[SLASH] handleSlashCommand returned`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user