惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
D
DataBreaches.Net
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
GbyAI
GbyAI
美团技术团队
云风的 BLOG
云风的 BLOG
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
博客园 - 叶小钗
Engineering at Meta
Engineering at Meta
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
阮一峰的网络日志
阮一峰的网络日志
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
U
Unit 42
P
Proofpoint News Feed
V
V2EX

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(ollama): align web search endpoint routing · openclaw...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -41,8 +41,8 @@ const OLLAMA_WEB_SEARCH_SCHEMA = Type.Object(

4141

{ additionalProperties: false },

4242

);

434344-

const OLLAMA_WEB_SEARCH_PATH = "/api/web_search";

45-

const OLLAMA_LEGACY_WEB_SEARCH_PATH = "/api/experimental/web_search";

44+

const OLLAMA_HOSTED_WEB_SEARCH_PATH = "/api/web_search";

45+

const OLLAMA_LOCAL_WEB_SEARCH_PROXY_PATH = "/api/experimental/web_search";

4646

const OLLAMA_CLOUD_BASE_URL = "https://ollama.com";

4747

const DEFAULT_OLLAMA_WEB_SEARCH_COUNT = 5;

4848

const DEFAULT_OLLAMA_WEB_SEARCH_TIMEOUT_MS = 15_000;

@@ -58,6 +58,12 @@ type OllamaWebSearchResponse = {

5858

results?: OllamaWebSearchResult[];

5959

};

606061+

type OllamaWebSearchAttempt = {

62+

baseUrl: string;

63+

path: string;

64+

apiKey?: string;

65+

};

66+6167

function isOllamaCloudBaseUrl(baseUrl: string): boolean {

6268

try {

6369

const parsed = new URL(baseUrl);

@@ -111,6 +117,43 @@ function normalizeOllamaWebSearchResult(

111117

};

112118

}

113119120+

function buildOllamaWebSearchAttempts(params: {

121+

baseUrl: string;

122+

configuredApiKey?: string;

123+

envApiKey?: string;

124+

}): OllamaWebSearchAttempt[] {

125+

if (isOllamaCloudBaseUrl(params.baseUrl)) {

126+

return [

127+

{

128+

baseUrl: params.baseUrl,

129+

path: OLLAMA_HOSTED_WEB_SEARCH_PATH,

130+

apiKey: params.configuredApiKey ?? params.envApiKey,

131+

},

132+

];

133+

}

134+135+

const attempts: OllamaWebSearchAttempt[] = [

136+

{

137+

baseUrl: params.baseUrl,

138+

path: OLLAMA_LOCAL_WEB_SEARCH_PROXY_PATH,

139+

apiKey: params.configuredApiKey,

140+

},

141+

{

142+

baseUrl: params.baseUrl,

143+

path: OLLAMA_HOSTED_WEB_SEARCH_PATH,

144+

apiKey: params.configuredApiKey,

145+

},

146+

];

147+

if (params.envApiKey) {

148+

attempts.push({

149+

baseUrl: OLLAMA_CLOUD_BASE_URL,

150+

path: OLLAMA_HOSTED_WEB_SEARCH_PATH,

151+

apiKey: params.envApiKey,

152+

});

153+

}

154+

return attempts;

155+

}

156+114157

export async function runOllamaWebSearch(params: {

115158

config?: OpenClawConfig;

116159

query: string;

@@ -127,27 +170,7 @@ export async function runOllamaWebSearch(params: {

127170

const count = resolveSearchCount(params.count, DEFAULT_OLLAMA_WEB_SEARCH_COUNT);

128171

const startedAt = Date.now();

129172

const body = JSON.stringify({ query, max_results: count });

130-

const attempts = [

131-

{

132-

baseUrl,

133-

path: OLLAMA_WEB_SEARCH_PATH,

134-

apiKey: isOllamaCloudBaseUrl(baseUrl) ? (configuredApiKey ?? envApiKey) : configuredApiKey,

135-

},

136-

{

137-

baseUrl,

138-

path: OLLAMA_LEGACY_WEB_SEARCH_PATH,

139-

apiKey: isOllamaCloudBaseUrl(baseUrl) ? (configuredApiKey ?? envApiKey) : configuredApiKey,

140-

},

141-

...(!isOllamaCloudBaseUrl(baseUrl) && envApiKey

142-

? [

143-

{

144-

baseUrl: OLLAMA_CLOUD_BASE_URL,

145-

path: OLLAMA_WEB_SEARCH_PATH,

146-

apiKey: envApiKey,

147-

},

148-

]

149-

: []),

150-

];

173+

const attempts = buildOllamaWebSearchAttempts({ baseUrl, configuredApiKey, envApiKey });

151174152175

let payload: OllamaWebSearchResponse | undefined;

153176

let lastError: Error | undefined;

@@ -305,6 +328,7 @@ export function createOllamaWebSearchProvider(): WebSearchProviderPlugin {

305328

}

306329307330

export const __testing = {

331+

buildOllamaWebSearchAttempts,

308332

normalizeOllamaWebSearchResult,

309333

resolveConfiguredOllamaWebSearchApiKey,

310334

resolveEnvOllamaWebSearchApiKey,