Add Calibrate AI Control UI and fleet LLM backend wiring.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Operators toggle Logic gates vs AI Control on Settings, refresh local Ollama models, and save ai_endpoint settings via Calibrate PUT; server scheduler and agent snapshot/command paths support stateless 60s fleet decisions.
This commit is contained in:
39
server/internal/ai/commands_test.go
Normal file
39
server/internal/ai/commands_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package ai
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseCommandsJSONBlock(t *testing.T) {
|
||||
raw := `Here is my plan:
|
||||
{"commands":[{"type":"restart_mining","args":{}}]}`
|
||||
cmds := ParseCommands(raw)
|
||||
if len(cmds) != 1 || cmds[0].Type != CmdRestartMining {
|
||||
t.Fatalf("got %+v", cmds)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseCommandsToolCall(t *testing.T) {
|
||||
raw := `{"tool":"restart_agent","args":{}}`
|
||||
cmds := ParseCommands(raw)
|
||||
if len(cmds) != 1 || cmds[0].Type != CmdRestartMining {
|
||||
t.Fatalf("got %+v", cmds)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseCommandsLineFallback(t *testing.T) {
|
||||
raw := "COMMAND: spread_now\nCOMMAND: noop"
|
||||
cmds := ParseCommands(raw)
|
||||
if len(cmds) != 2 || cmds[0].Type != CmdSpreadNow || cmds[1].Type != CmdNoop {
|
||||
t.Fatalf("got %+v", cmds)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseCommandsAgentCommand(t *testing.T) {
|
||||
raw := `{"commands":[{"type":"agent_command","args":{"action":"pause"}}]}`
|
||||
cmds := ParseCommands(raw)
|
||||
if len(cmds) != 1 || cmds[0].Type != CmdAgentCommand {
|
||||
t.Fatalf("got %+v", cmds)
|
||||
}
|
||||
if cmds[0].Args["action"] != "pause" {
|
||||
t.Fatalf("args: %+v", cmds[0].Args)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user