sketch: add debug handler to dump conversation history as JSON
Add HTTP debug endpoint /debug/conversation-history to dump agent conversation
history as pretty-printed JSON for debugging purposes.
Sometimes, you just want to see what went on.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s6c9e876db9b3aa5ck
diff --git a/llm/conversation/convo.go b/llm/conversation/convo.go
index f3161ed..b6472e1 100644
--- a/llm/conversation/convo.go
+++ b/llm/conversation/convo.go
@@ -643,3 +643,8 @@
}
return err
}
+
+// DebugJSON returns the conversation history as JSON for debugging purposes.
+func (c *Convo) DebugJSON() ([]byte, error) {
+ return json.MarshalIndent(c.messages, "", " ")
+}