mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-20 05:28:15 +02:00
API interne : critères changés par un outil, fichiers seuls au reset
/internal/v1/tool/exec rend la liste des critères après un appel de l'outil criteria qui l'a changée (add, set, clear) : critNotify la pousse au journal du Go, une conversation tenue par la façade la reçoit ici. /internal/v1/conv/dropped accepte files_only : Reset vide la discussion et ses fichiers, sans la supprimer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016tcGfJWefW5kUGoC2wL8cv
This commit is contained in:
3 files changed
+49
-5
No files matched your search
@@ -58,10 +58,29 @@ func handleInternalToolExec(w http.ResponseWriter, r *http.Request) {
|
||||
sendJSON(w, http.StatusOK, struct {
|
||||
Label string `json:"label"`
|
||||
toolExecResult
|
||||
Image string `json:"image,omitempty"`
|
||||
Shot string `json:"shot,omitempty"`
|
||||
Relay *Message `json:"relay,omitempty"`
|
||||
}{label, res, image, shot, relay})
|
||||
Image string `json:"image,omitempty"`
|
||||
Shot string `json:"shot,omitempty"`
|
||||
Relay *Message `json:"relay,omitempty"`
|
||||
Criteria []Criterion `json:"criteria,omitempty"`
|
||||
}{label, res, image, shot, relay, criteriaAfter(in.Name, in.Args, res)})
|
||||
}
|
||||
|
||||
// criteriaAfter : la liste des critères après un appel qui l'a changée
|
||||
// (critNotify la pousse au journal du Go ; une conversation tenue par la
|
||||
// façade la reçoit ici). nil sinon.
|
||||
func criteriaAfter(name string, args map[string]any, res toolExecResult) []Criterion {
|
||||
if name != "criteria" || strings.HasPrefix(res.Result, "[erreur]") {
|
||||
return nil
|
||||
}
|
||||
switch a, _ := args["action"].(string); a {
|
||||
case "add", "set", "clear":
|
||||
list := critList(convActiveID())
|
||||
if list == nil {
|
||||
list = []Criterion{}
|
||||
}
|
||||
return list
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// toolStepExtras : ce que runChatLoop tire d'un résultat d'outil après
|
||||
|
||||
Reference in new issue
Block a user