diff --git a/db/db.go b/db/db.go index 6a9e085..6a35129 100644 --- a/db/db.go +++ b/db/db.go @@ -103,7 +103,7 @@ type builtinAgent struct { key, name, role, desc string vars []promptVar interactiveShell bool // 建行时的默认交互式 shell 开关;ON CONFLICT 不覆盖用户后续手动开关 - runSeconds *int // 建行时的单次 run 墙钟上限(秒);nil=用表默认(600),0=不限时 + runSeconds *int // 建行时的单次 run 墙钟上限(秒);nil=用种子默认(1200),0=不限时 } type promptVar struct{ name, desc, example, source string } @@ -144,7 +144,7 @@ func (d *DB) seedBuiltins() error { var agentID int64 err := d.QueryRow(` INSERT INTO agents(key, name, description, role, builtin, enabled, interactive_shell, run_seconds) -VALUES ($1, $2, NULLIF($3,''), $4, true, true, $5, COALESCE($6, 600)) +VALUES ($1, $2, NULLIF($3,''), $4, true, true, $5, COALESCE($6, 1200)) ON CONFLICT (key) DO UPDATE SET name = EXCLUDED.name, description = EXCLUDED.description RETURNING id`, a.key, a.name, a.desc, a.role, a.interactiveShell, a.runSeconds).Scan(&agentID) if err != nil { diff --git a/db/schema.sql b/db/schema.sql index 8f1886a..fd55259 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -414,7 +414,7 @@ CREATE TABLE IF NOT EXISTS agents ( llm_profile_id BIGINT REFERENCES llm_profiles(id) ON DELETE SET NULL, current_prompt_id BIGINT, max_turns INTEGER NOT NULL DEFAULT 0, - run_seconds INTEGER NOT NULL DEFAULT 600, + run_seconds INTEGER NOT NULL DEFAULT 1200, web_search BOOLEAN NOT NULL DEFAULT false, interactive_shell BOOLEAN NOT NULL DEFAULT false, wrapup_prompt TEXT NOT NULL DEFAULT '', @@ -434,6 +434,8 @@ ALTER TABLE agents ADD COLUMN IF NOT EXISTS trigger_merge_mode TEXT NOT NUL ALTER TABLE agents ADD COLUMN IF NOT EXISTS trigger_max_parallel INTEGER NOT NULL DEFAULT 5; -- per-agent LLM 绑定(agent 级默认模型):列自初版即在上方 CREATE 中,此 ALTER 仅为极旧库兜底(幂等)。 ALTER TABLE agents ADD COLUMN IF NOT EXISTS llm_profile_id BIGINT REFERENCES llm_profiles(id) ON DELETE SET NULL; +-- run_seconds 单次 run 墙钟默认 600→1200:只改列默认(影响将来新插入的行),不动旧库存量行。 +ALTER TABLE agents ALTER COLUMN run_seconds SET DEFAULT 1200; CREATE INDEX IF NOT EXISTS idx_agents_llm_profile ON agents(llm_profile_id) WHERE llm_profile_id IS NOT NULL; DROP TRIGGER IF EXISTS trg_agents_upd ON agents; CREATE TRIGGER trg_agents_upd BEFORE UPDATE ON agents diff --git a/server/server.go b/server/server.go index c7f1d40..0b82c82 100644 --- a/server/server.go +++ b/server/server.go @@ -275,14 +275,14 @@ func (s *Server) agentMaxTurns(key string) int { } // agentRunSeconds returns the configured wall-clock run budget (seconds) for an -// agent key (0 = unlimited; 600 fallback when no DB or no row, matching schema). +// agent key (0 = unlimited; 1200 fallback when no DB or no row, matching schema). func (s *Server) agentRunSeconds(key string) int { if s.m.pg == nil { - return 600 + return 1200 } a, err := s.m.pg.GetAgentByKey(key) if err != nil || a == nil { - return 600 + return 1200 } return a.RunSecs }