fix: flash via lastMessagesRef, web_read timeout 8s, searcher no parallel google+web_read
Deploy LangGraph Server to Azure Web App / build-and-deploy (push) Failing after 16s
Deploy LangGraph UI to Azure Static Web Apps / build-and-deploy (push) Failing after 45s

This commit is contained in:
gongzhiyong
2026-04-12 17:29:16 +08:00
parent 6f036abdaa
commit 00f5dc3438
4 changed files with 20 additions and 7 deletions
@@ -236,7 +236,7 @@ export async function webRead(url: string): Promise<{ content: string; title: st
Authorization: `Bearer ${config.jina.apiKey}`,
Accept: "application/json",
},
signal: AbortSignal.timeout(getToolConfig("web_search").timeoutMs),
signal: AbortSignal.timeout(getToolConfig("web_read").timeoutMs),
});
if (!resp.ok) throw new Error(`Jina read failed: ${resp.status}`);
const data = await resp.json();
+4 -3
View File
@@ -11,10 +11,11 @@ const SYSTEM_PROMPT = `你是深度搜索助手。通过多步搜索为用户找
## 搜索策略
1. 分析问题关键词和意图,确定搜索方向
2. google_search 快速获取概览,web_search_deep 获取完整内容——根据问题深度选择
3. 需要详细内容时,用 web_read 读取页面全文
4. 首次结果不理想则调整关键词或换用另一种搜索工具重试
2. 第一步:先调用 google_search 获取概览,**等待搜索结果返回后**再决定下一步
3. 如需更深内容,**在单独的一步**调用 web_read 读取特定页面——不要在同一次调用中同时发起 google_search 和 web_read
4. 首次结果不理想则调整关键词或换用 web_search_deep 重试
5. 复杂问题拆分为子问题分别搜索,最后综合
6. **严禁**:在同一轮 tool_calls 中同时调用 google_search 和 web_read
## 引用格式
- 回答中用 [1][2] 标注来源
+2 -1
View File
@@ -10,7 +10,8 @@ export const TOOL_CONFIGS: Record<string, ToolConfig> = {
ticket_list: { timeoutMs: 15_000, maxRetries: 2, backoffMs: 500 },
ticket_detail: { timeoutMs: 15_000, maxRetries: 2, backoffMs: 500 },
google_search: { timeoutMs: 10_000, maxRetries: 1 },
web_search: { timeoutMs: 30_000, maxRetries: 1 },
web_search: { timeoutMs: 10_000, maxRetries: 1 },
web_read: { timeoutMs: 8_000, maxRetries: 1 },
web_search_deep: { timeoutMs: 45_000, maxRetries: 1 },
sandbox_run: { timeoutMs: 15_000, maxRetries: 1 },
code_execute: { timeoutMs: 15_000, maxRetries: 1 },
+13 -2
View File
@@ -546,8 +546,19 @@ function App() {
reader.readAsDataURL(file);
}
// ── Active messages: prefer streaming messages, fall back to historical ──
const activeMessages: Message[] = thread.messages.length > 0 ? thread.messages : historicalMessages;
// ── Active messages: prefer streaming messages, fall back to cached/historical ──
// Use a ref to cache the last known non-empty messages, preventing flash when
// thread.messages briefly becomes [] during a new submission.
const lastMessagesRef = useRef<Message[]>([]);
if (thread.messages.length > 0) {
lastMessagesRef.current = thread.messages;
}
const activeMessages: Message[] =
thread.messages.length > 0
? thread.messages
: lastMessagesRef.current.length > 0
? lastMessagesRef.current
: historicalMessages;
// ── Collect completed tool call IDs ─────────────────────────────────────
const completedToolIds = new Set(