fix(search): 설정 화면의 'ollama' 선택지를 ollama_cloud 별칭으로 — 허용 목록 밖이라 ddg로 떨어지던 문제

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-09-30 00:36:32 +09:00
1 parent 03d278377b
commit 4968bdf9f7
3 files changed
+18 -2

No files matched your search

+5
View File
@@ -81,3 +81,8 @@ export const WEB_TOOL_ROUTED_PROVIDERS = ['ollama', 'ollama_cloud', 'searxng'] a
export function routesThroughWebTool(provider: string): boolean {
return (WEB_TOOL_ROUTED_PROVIDERS as readonly string[]).includes(provider);
}
/** 설정 화면 값 → 내부 provider 이름. 'ollama'(화면의 Ollama 선택지)는 Ollama 웹검색 API다. */
export function normalizePreferredProvider(raw: string): string {
return raw === 'ollama' ? 'ollama_cloud' : raw;
}
+4 -2
View File
@@ -2,7 +2,7 @@ import { ToolResult } from '../types.js';
import { getConfig } from '../config/config.js';
import { lookupGpuSpecs } from './gpu-specs.js';
import { lookupDanawa } from './danawa.js';
import { mergeSearchResults, renderMergedStdout } from './search-merge.js';
import { mergeSearchResults, renderMergedStdout, normalizePreferredProvider } from './search-merge.js';
type SearchResultItem = { title: string; url: string; snippet: string };
@@ -531,7 +531,9 @@ function getSearchConfig(): SearchConfig {
try {
const cm = getConfig();
const data = cm.getConfig();
const preferredRaw = String(data.search?.preferred_provider || 'ddg').toLowerCase();
// 설정 화면의 "Ollama" 선택지는 값이 'ollama'다. 허용 목록에 없으면 조용히 ddg로 떨어지므로,
// Ollama 웹검색 API(ollama_cloud)의 별칭으로 취급한다(2026-09-30).
const preferredRaw = normalizePreferredProvider(String(data.search?.preferred_provider || 'ddg').toLowerCase());
const preferred = (['tavily', 'google', 'brave', 'ddg', 'searxng', 'ollama_cloud'].includes(preferredRaw) ? preferredRaw : 'ddg') as SearchConfig['preferred'];
const searxngRaw = typeof data.search?.searxng_url === 'string' ? data.search.searxng_url.trim().replace(/\/+$/, '') : '';
value = {
+9
View File
@@ -72,3 +72,12 @@ describe('routesThroughWebTool — 채팅 검색 라우터', () => {
assert.equal(routesThroughWebTool('google'), false);
});
});
import { normalizePreferredProvider } from '../src/tools/search-merge';
describe('normalizePreferredProvider', () => {
test("설정 화면의 'ollama'는 ollama_cloud로 — 안 그러면 허용 목록 밖이라 ddg로 떨어진다", () => {
assert.equal(normalizePreferredProvider('ollama'), 'ollama_cloud');
assert.equal(normalizePreferredProvider('ollama_cloud'), 'ollama_cloud');
assert.equal(normalizePreferredProvider('searxng'), 'searxng');
});
});