Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(ai): accept thinking/reasoning deltas as first stream chunk in connection test

t8y2c6e50f80f21a
diff --git a/crates/dbx-core/src/ai.rs b/crates/dbx-core/src/ai.rs
index 11f645e2d5..ae743d663f 100644
--- a/crates/dbx-core/src/ai.rs
+++ b/crates/dbx-core/src/ai.rs
@@ -763,7 +763,9 @@ async fn measure_first_stream_chunk(
let parsed: serde_json::Value = serde_json::from_str(data).map_err(|e| format!("JSON parse error: {e}"))?;
let delta = if is_claude {
- claude_stream_text(&parsed).map(|s| s.to_string())
+ // Accept both text and thinking deltas — thinking is often the first
+ // streamed content when extended thinking is enabled.
+ claude_stream_text(&parsed).or_else(|| parsed["delta"]["thinking"].as_str()).map(|s| s.to_string())
} else if is_gemini {
let text = gemini_text(&parsed);
if text.is_empty() {
@@ -772,7 +774,10 @@ async fn measure_first_stream_chunk(
Some(text)
}
} else {
- openai_stream_text(&parsed).or_else(|| Some(responses_text(&parsed)))
+ // Accept text, reasoning, or responses content as the first chunk.
+ openai_stream_text(&parsed)
+ .or_else(|| openai_stream_reasoning(&parsed).map(|s| s.to_string()))
+ .or_else(|| Some(responses_text(&parsed)))
};
if let Some(text) = delta {