Enha(tools.todo): always provide whole todo list

This commit is contained in:
Grail Finder
2026-03-01 07:01:13 +03:00
parent a505ffaaa9
commit 1f112259d2
4 changed files with 15 additions and 51 deletions

View File

@@ -27,7 +27,6 @@ AutoCleanToolCallsFromCtx = false
RAGEnabled = false RAGEnabled = false
RAGBatchSize = 1 RAGBatchSize = 1
RAGWordLimit = 80 RAGWordLimit = 80
RAGWorkers = 2
RAGDir = "ragimport" RAGDir = "ragimport"
# extra tts # extra tts
TTS_ENABLED = false TTS_ENABLED = false

View File

@@ -39,7 +39,6 @@ type Config struct {
// rag settings // rag settings
RAGEnabled bool `toml:"RAGEnabled"` RAGEnabled bool `toml:"RAGEnabled"`
RAGDir string `toml:"RAGDir"` RAGDir string `toml:"RAGDir"`
RAGWorkers uint32 `toml:"RAGWorkers"`
RAGBatchSize int `toml:"RAGBatchSize"` RAGBatchSize int `toml:"RAGBatchSize"`
RAGWordLimit uint32 `toml:"RAGWordLimit"` RAGWordLimit uint32 `toml:"RAGWordLimit"`
// deepseek // deepseek

View File

@@ -80,9 +80,6 @@ This document explains how to set up and configure the application using the `co
#### RAGWordLimit (`80`) #### RAGWordLimit (`80`)
- Maximum number of words in a batch to tokenize and store. - Maximum number of words in a batch to tokenize and store.
#### RAGWorkers (`2`)
- Number of concurrent workers for RAG processing.
#### RAGDir (`"ragimport"`) #### RAGDir (`"ragimport"`)
- Directory containing documents for RAG processing. - Directory containing documents for RAG processing.

View File

@@ -834,6 +834,14 @@ type TodoList struct {
Items []TodoItem `json:"items"` Items []TodoItem `json:"items"`
} }
func (t TodoList) ToString() string {
sb := strings.Builder{}
for i := range t.Items {
fmt.Fprintf(&sb, "\n[%s] %s. %s\n", t.Items[i].Status, t.Items[i].ID, t.Items[i].Task)
}
return sb.String()
}
// Global todo list storage // Global todo list storage
var globalTodoList = TodoList{ var globalTodoList = TodoList{
Items: []TodoItem{}, Items: []TodoItem{},
@@ -860,6 +868,7 @@ func todoCreate(args map[string]string) []byte {
"id": id, "id": id,
"task": task, "task": task,
"status": "pending", "status": "pending",
"todos": globalTodoList.ToString(),
} }
jsonResult, err := json.Marshal(result) jsonResult, err := json.Marshal(result)
if err != nil { if err != nil {
@@ -871,38 +880,9 @@ func todoCreate(args map[string]string) []byte {
} }
func todoRead(args map[string]string) []byte { func todoRead(args map[string]string) []byte {
id, ok := args["id"]
if ok && id != "" {
// Find specific todo by ID
for _, item := range globalTodoList.Items {
if item.ID == id {
result := map[string]interface{}{
"todo": item,
}
jsonResult, err := json.Marshal(result)
if err != nil {
msg := "failed to marshal result; error: " + err.Error()
logger.Error(msg)
return []byte(msg)
}
return jsonResult
}
}
// ID not found
result := map[string]string{
"error": fmt.Sprintf("todo with id %s not found", id),
}
jsonResult, err := json.Marshal(result)
if err != nil {
msg := "failed to marshal result; error: " + err.Error()
logger.Error(msg)
return []byte(msg)
}
return jsonResult
}
// Return all todos if no ID specified // Return all todos if no ID specified
result := map[string]interface{}{ result := map[string]interface{}{
"todos": globalTodoList.Items, "todos": globalTodoList.ToString(),
} }
jsonResult, err := json.Marshal(result) jsonResult, err := json.Marshal(result)
if err != nil { if err != nil {
@@ -953,6 +933,7 @@ func todoUpdate(args map[string]string) []byte {
result := map[string]string{ result := map[string]string{
"message": "todo updated successfully", "message": "todo updated successfully",
"id": id, "id": id,
"todos": globalTodoList.ToString(),
} }
jsonResult, err := json.Marshal(result) jsonResult, err := json.Marshal(result)
if err != nil { if err != nil {
@@ -991,6 +972,7 @@ func todoDelete(args map[string]string) []byte {
result := map[string]string{ result := map[string]string{
"message": "todo deleted successfully", "message": "todo deleted successfully",
"id": id, "id": id,
"todos": globalTodoList.ToString(),
} }
jsonResult, err := json.Marshal(result) jsonResult, err := json.Marshal(result)
if err != nil { if err != nil {
@@ -1540,21 +1522,8 @@ var baseTools = []models.Tool{
Description: "Update a todo item by ID with new task or status. Status must be one of: pending, in_progress, completed.", Description: "Update a todo item by ID with new task or status. Status must be one of: pending, in_progress, completed.",
Parameters: models.ToolFuncParams{ Parameters: models.ToolFuncParams{
Type: "object", Type: "object",
Required: []string{"id"}, Required: []string{},
Properties: map[string]models.ToolArgProps{ Properties: map[string]models.ToolArgProps{},
"id": models.ToolArgProps{
Type: "string",
Description: "id of the todo item to update",
},
"task": models.ToolArgProps{
Type: "string",
Description: "new task description (optional)",
},
"status": models.ToolArgProps{
Type: "string",
Description: "new status for the todo: pending, in_progress, or completed (optional)",
},
},
}, },
}, },
}, },