chat: reconcile history by canonical message identity

This commit is contained in:
2026-10-19 00:08:30 +01:00
parent 3187b0c06e
commit 7da3d54013
13 changed files with 189 additions and 15 deletions
+4
View File
@@ -195,6 +195,7 @@ func (c *Connection) Call(ctx context.Context, method, path string, body any) ([
var request struct {
Prompt string `json:"prompt"`
Text string `json:"text"`
ID string `json:"id"`
Format json.RawMessage `json:"format"`
Parts []struct {
Text string `json:"text"`
@@ -219,6 +220,9 @@ func (c *Connection) Call(ctx context.Context, method, path string, body any) ([
}
}
payload := map[string]any{"model": c.models[id], "parts": []map[string]string{{"type": "text", "text": text}}}
if request.ID != "" {
payload["id"] = request.ID
}
if len(request.Format) > 0 {
supported, err := c.supportsFormat(ctx, request.Format)
if err != nil {