feat: 增强聊天 UI 与终端配置
- 重构消息列表、思考块与工具调用块样式 - ChatContext 支持 agent 分段与 markdown 渲染优化 - 后端增加 PI 命令配置与 Web 终端改进 - 新增 run-backend.sh 启动脚本,忽略 backend/dist 构建产物
This commit is contained in:
@@ -73,16 +73,19 @@ type Client struct {
|
||||
// with the exit code when the subprocess terminates.
|
||||
func NewClient(piCmd string, piArgs []string, repoRoot, agentDir string, onExit func(int)) (*Client, error) {
|
||||
if piCmd == "" {
|
||||
return nil, fmt.Errorf("pi CLI command not specified (use --pi-cmd)")
|
||||
return nil, fmt.Errorf("SproutClaw CLI command not specified (use --pi-cmd or --sproutclaw-cmd)")
|
||||
}
|
||||
|
||||
// pi enters RPC mode via "--mode rpc"
|
||||
// SproutClaw enters RPC mode via "--mode rpc"
|
||||
args := append(append([]string{}, piArgs...), "--mode", "rpc")
|
||||
cmd := exec.Command(piCmd, args...)
|
||||
cmd.Dir = repoRoot
|
||||
cmd.Env = append(os.Environ(), fmt.Sprintf("SPROUTCLAW_CODING_AGENT_DIR=%s", agentDir))
|
||||
cmd.Env = append(os.Environ(),
|
||||
fmt.Sprintf("SPROUTCLAW_CODING_AGENT_DIR=%s", agentDir),
|
||||
fmt.Sprintf("PI_CODING_AGENT_DIR=%s", agentDir),
|
||||
)
|
||||
|
||||
log.Printf("[sproutclaw-web] launching pi RPC: %s %s (cwd=%s)", piCmd, strings.Join(args, " "), repoRoot)
|
||||
log.Printf("[sproutclaw-web] launching SproutClaw RPC: %s %s (cwd=%s agent-dir=%s)", piCmd, strings.Join(args, " "), repoRoot, agentDir)
|
||||
|
||||
stdin, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
@@ -115,7 +118,7 @@ func NewClient(piCmd string, piArgs []string, repoRoot, agentDir string, onExit
|
||||
if cmd.ProcessState != nil {
|
||||
code = cmd.ProcessState.ExitCode()
|
||||
}
|
||||
log.Printf("[sproutclaw-web] pi RPC exited, code=%d", code)
|
||||
log.Printf("[sproutclaw-web] SproutClaw RPC exited, code=%d", code)
|
||||
onExit(code)
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user