Revert "Résultats d'outils : aperçu + « voir plus », vrai compteur, MCP complet"

This reverts commit 91d1796615.
This commit is contained in:
Michael committed 2026-10-02 23:08:31 +02:00
1 parent f54c304019
commit 6aafeeea98
9 files changed
+37 -256

No files matched your search

-29
View File
@@ -206,35 +206,6 @@ func handleChatState(w http.ResponseWriter, r *http.Request) {
sendJSON(w, 200, conv.state())
}
// handleToolResult renvoie le résultat COMPLET d'un appel d'outil, chargé à la
// demande par le bouton « voir plus » de la bulle (le flux ne transporte qu'un
// aperçu). Le résultat complet vit dans la vue « modèle » (conv.Messages), repéré
// par son tool_call_id. Absent (compacté, archivé, discussion changée) → 404, et
// l'UI garde son aperçu plutôt que d'afficher une erreur.
func handleToolResult(w http.ResponseWriter, r *http.Request) {
id := strings.TrimSpace(r.URL.Query().Get("id"))
if id == "" {
sendJSON(w, 400, map[string]any{"error": "id manquant"})
return
}
conv.mu.Lock()
found, ok := "", false
for _, m := range conv.Messages {
if m.Role == "tool" && m.ToolCallID == id {
if s, isStr := m.Content.(string); isStr {
found, ok = s, true
}
break
}
}
conv.mu.Unlock()
if !ok {
sendJSON(w, 404, map[string]any{"error": "résultat non disponible"})
return
}
sendJSON(w, 200, map[string]any{"result": found})
}
func handleChat(w http.ResponseWriter, r *http.Request) {
var body chatReq
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {