v2.2.321: /naver-shopping "분야 내 인기 검색어" 질문이 무의미한 1행 표만 주던 문제 수정
- 쇼핑인사이트 API 는 분야 자체의 클릭 추이만 주고 분야 안의 키워드 순위 API가 없음 — intentParser 에 scope(category/keywords) 필드 추가해 "인기 검색어" 류 질문을 감지하고, 검증된 검색어트렌드 rankKeywords 로 우회 처리하도록 수정
This commit is contained in:
@@ -85,6 +85,22 @@ describe('parseShoppingIntent — tolerant JSON 파싱', () => {
|
||||
expect(r.mode).toBe('compare');
|
||||
expect(r.categories).toEqual(['패션의류 트렌드']);
|
||||
});
|
||||
|
||||
test('scope="keywords" — 분야 자체가 아니라 분야 "안"의 인기 검색어를 묻는 질문', async () => {
|
||||
const ai = mockAi('{"scope":"keywords","mode":"discover","categories":["디지털/가전"],"keywords":["무선이어폰","보조배터리","블루투스스피커"],"startDate":"","endDate":"","timeUnit":"","device":"","gender":"","ages":[]}');
|
||||
const r = await parseShoppingIntent(ai, '디지털/가전 인기 검색어', '2026-08-04');
|
||||
expect(r.parsed).toBe(true);
|
||||
expect(r.scope).toBe('keywords');
|
||||
expect(r.categories).toEqual(['디지털/가전']);
|
||||
expect(r.keywords).toEqual(['무선이어폰', '보조배터리', '블루투스스피커']);
|
||||
});
|
||||
|
||||
test('scope 미명시 응답은 기존 동작과 동일하게 category 로 기본값 처리', async () => {
|
||||
const ai = mockAi('{"mode":"compare","categories":["패션의류"],"startDate":"","endDate":"","timeUnit":"","device":"","gender":"","ages":[]}');
|
||||
const r = await parseShoppingIntent(ai, '패션의류 트렌드', '2026-08-04');
|
||||
expect(r.scope).toBe('category');
|
||||
expect(r.keywords).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseSearchTrendIntent — tolerant JSON 파싱', () => {
|
||||
|
||||
Reference in New Issue
Block a user