Hardcode Go default empty response

This commit is contained in:
Brandon Zhang
2026-03-27 17:55:05 +08:00
parent 372e30ff6f
commit f437f6939c
6 changed files with 26 additions and 59 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"strconv"
"github.com/local-mcp/local-mcp-go/internal/config"
"github.com/local-mcp/local-mcp-go/internal/models"
)
@@ -28,6 +29,7 @@ func (s *SettingsStore) Get() (models.Settings, error) {
cfg := models.Settings{
DefaultWaitSeconds: 10,
DefaultEmptyResponse: config.DefaultEmptyResponse,
AgentStaleAfterSeconds: 30,
}
@@ -41,8 +43,6 @@ func (s *SettingsStore) Get() (models.Settings, error) {
if n, err := strconv.Atoi(value); err == nil {
cfg.DefaultWaitSeconds = n
}
case "default_empty_response":
cfg.DefaultEmptyResponse = value
case "agent_stale_after_seconds":
if n, err := strconv.Atoi(value); err == nil {
cfg.AgentStaleAfterSeconds = n
@@ -58,12 +58,9 @@ func (s *SettingsStore) Update(patch models.Settings) error {
_, err := s.db.Exec(`
INSERT OR REPLACE INTO settings (key, value) VALUES
('default_wait_seconds', ?),
('default_empty_response', ?),
('agent_stale_after_seconds', ?)`,
strconv.Itoa(patch.DefaultWaitSeconds),
patch.DefaultEmptyResponse,
strconv.Itoa(patch.AgentStaleAfterSeconds),
)
return err
}