Files
connectai/src/lib/contextBuilders/thinFollowUp.ts
T
g1nation 0a97324f1b feat: v2.2.92 → v2.2.158 — god-file 분해 + Stocks feature + 대화 연속성
R56–R59: agent.ts 2731→1529줄 god-file 분해 (25 modules)
  · attrParsers + LLM 메서드 8개 (callNonStreaming, streamChatOnce 등)
  · executeActions 415줄 → 8 handler 그룹 (file/run/list/brain/calendar/sheets/tasks)
  · handlePrompt 1100줄 → 7 phase 모듈 (system prompt + budget + autoContinue 등)

R50–R55: extension.ts 1145→349줄 (telegram/settings/provider commands 분리)

Stocks feature 신규: /stocks slash command (v2.2.152~158)
  · .astra/stocks.json 저장소 + Yahoo Finance 현재가 갱신
  · 8 키워드 필터 (ROE/성장성/유동성/수익성/영업효율/기술력/안정성/PBR)
  · Naver 시가총액 페이지 JSON API (m.stock.naver.com) 발굴
  · LLM Top 5 매력도 분석 + Telegram 자동 보고서
  · KST 09:00/15:00 watcher 자동 모니터링

대화 연속성 (v2.2.150~157):
  · [PRIOR TURN CONCLUSION] block 으로 직전 결론 anchor
  · thin follow-up 분류 → boilerplate 헤더 suppression
  · slash 명령 결과 chatHistory mirror (capture wrapper)
  · echo/parrot 금지 system prompt rule

기타: /stocks 슬래시 자동완성 dropdown UI, Naver JSON API 전환 (cheerio 제거)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 09:59:32 +09:00

40 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { ChatMessage } from '../../agent';
/**
* 현재 사용자 메시지가 "얇은 follow-up" 인지 판정 — 직전 assistant 답변에 대한
* 짧은 정정 / 사실 보강 / 확인 / 짧은 감사 등.
*
* 결과 true 면 Project Chronicle Guard 의 "요청 요약 / 사용자 의도 추론 / 핵심
* 확인 질문 / 프로젝트 기록 대상 확인" 보일러플레이트를 *생략* 한다 — 이런 짧은
* 후속 메시지에 매번 4-section 템플릿을 박는 건 응답 위생을 망친다 (R1/R3 위반).
*
* 보수적인 판정 — false-positive 가 false-negative 보다 위험 (긴 분석 요청에
* 헤더가 없으면 사용자 경험 손상). 다음 *모든* 조건 만족할 때만 true:
* (1) 직전 assistant 메시지가 history 에 존재 (즉 이게 follow-up 인 것)
* (2) 짧다 (≤ 100자, 줄바꿈 후 trim 기준)
* (3) 명확한 *질문* 신호가 없다 (?, "어떻게", "왜", "뭐", "어디", 등)
* (4) 명확한 *새 작업 요청* 신호가 없다 (분석/평가/추천/비교/만들어줘/해줘/구현해/실행해 등)
*/
export function isThinFollowUp(prompt: string | null, history: ChatMessage[]): boolean {
if (!prompt) return false;
const t = prompt.trim();
if (t.length === 0 || t.length > 100) return false;
// (1) 직전 assistant 메시지가 있어야 follow-up 임.
const visible = history.filter(m => !m.internal && (m.role === 'user' || m.role === 'assistant'));
const hasPriorAssistant = visible.some(m => m.role === 'assistant');
if (!hasPriorAssistant) return false;
// (3) 질문 신호.
if (/[?]/.test(t)) return false;
if (/(어떻게|어디|언제|왜|뭐|누구|얼마|몇)/.test(t)) return false;
if (/^\s*(what|how|why|where|when|who|which)\b/i.test(t)) return false;
// (4) 새 작업 요청 신호 (단순 명령어 / 분석 요청).
if (/(분석|평가|추천|비교|만들|짜줘|작성|구현|돌려|실행|생성|검토|리뷰|review|analyze|implement|create|build)/i.test(t)) {
return false;
}
return true;
}