41 lines
2.0 KiB
TypeScript
41 lines
2.0 KiB
TypeScript
/**
|
|
* 2026-10-25 메인 채팅 시스템 프롬프트 감사 — 정리한 규칙이 되살아나지 않게.
|
|
*/
|
|
import { describe, test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { buildChatSystemPrompt, isRecommendationWhere } from '../src/gateway/chat/system-prompt';
|
|
|
|
const build = (message: string, toolNames: string[] = ['web_search', 'web_fetch', 'place_search', 'python_eval']) =>
|
|
buildChatSystemPrompt({ toolNames, dateStr: 'Sunday, October 25, 2026', timeStr: '11:00 AM', message } as any);
|
|
|
|
describe('isRecommendationWhere', () => {
|
|
test('장소 추천은 지도 요청이 아니다', () => {
|
|
assert.equal(isRecommendationWhere('몬태나 주 살기 좋은 곳은 어디야?'), true);
|
|
assert.equal(isRecommendationWhere('휴양하기 좋은 저렴한 곳 어디야'), true);
|
|
});
|
|
test('지도·위치·근처 어휘가 있으면 지도 요청', () => {
|
|
assert.equal(isRecommendationWhere('구미역 어디야?'), false);
|
|
assert.equal(isRecommendationWhere('근처 괜찮은 곳 어디야'), false);
|
|
assert.equal(isRecommendationWhere('살기 좋은 곳 지도로 보여줘'), false);
|
|
});
|
|
});
|
|
|
|
describe('시스템 프롬프트 정리', () => {
|
|
test('추천 질문엔 MAPS가 안 붙고, 위치 질문엔 붙는다', () => {
|
|
assert.doesNotMatch(build('몬태나 주 살기 좋은 곳은 어디야?'), /\nMAPS:/);
|
|
assert.match(build('구미역 어디야?'), /\nMAPS:/);
|
|
});
|
|
test('낡은 문장은 없고, 자동화 허가 문구는 브라우저·데스크톱 도구가 있을 때만', () => {
|
|
const p = build('안녕');
|
|
assert.doesNotMatch(p, /SmallClaw repos/);
|
|
assert.doesNotMatch(p, /pre-authorized/);
|
|
assert.match(build('안녕', ['browser_open']), /pre-authorized/);
|
|
});
|
|
test('검색 규칙은 각자 문단', () => {
|
|
const p = build('최신 맥미니 가격');
|
|
assert.match(p, /\nNEWEST VERSIONS: /);
|
|
assert.match(p, /\nSEARCH PERSISTENCE: /);
|
|
assert.match(p, /\nLENGTH: /);
|
|
});
|
|
});
|