mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-15 03:32:43 +08:00
Merge branch 'master' of github.com:cexll/myclaude
This commit is contained in:
@@ -2096,6 +2096,16 @@ func TestBackendParseJSONStream_GeminiEvents(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBackendParseJSONStream_GeminiInitEventSessionID(t *testing.T) {
|
||||||
|
input := `{"type":"init","session_id":"gemini-abc123"}`
|
||||||
|
|
||||||
|
_, threadID := parseJSONStream(strings.NewReader(input))
|
||||||
|
|
||||||
|
if threadID != "gemini-abc123" {
|
||||||
|
t.Fatalf("threadID=%q, want %q", threadID, "gemini-abc123")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestBackendParseJSONStream_GeminiEvents_DeltaFalseStillDetected(t *testing.T) {
|
func TestBackendParseJSONStream_GeminiEvents_DeltaFalseStillDetected(t *testing.T) {
|
||||||
input := `{"type":"init","session_id":"xyz789"}
|
input := `{"type":"init","session_id":"xyz789"}
|
||||||
{"type":"message","content":"Hi","delta":false,"session_id":"xyz789"}
|
{"type":"message","content":"Hi","delta":false,"session_id":"xyz789"}
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ func parseJSONStreamInternal(r io.Reader, warnFn func(string), infoFn func(strin
|
|||||||
if !isClaude && event.Type == "result" && event.SessionID != "" && event.Status == "" {
|
if !isClaude && event.Type == "result" && event.SessionID != "" && event.Status == "" {
|
||||||
isClaude = true
|
isClaude = true
|
||||||
}
|
}
|
||||||
isGemini := event.Role != "" || event.Delta != nil || event.Status != ""
|
isGemini := (event.Type == "init" && event.SessionID != "") || event.Role != "" || event.Delta != nil || event.Status != ""
|
||||||
|
|
||||||
// Handle Codex events
|
// Handle Codex events
|
||||||
if isCodex {
|
if isCodex {
|
||||||
|
|||||||
Reference in New Issue
Block a user