fix for review
This commit is contained in:
parent
9c28870e80
commit
f0c0219c4c
3 changed files with 9 additions and 9 deletions
|
|
@ -17,6 +17,8 @@ const (
|
||||||
TypeTypingStop = "typing.stop"
|
TypeTypingStop = "typing.stop"
|
||||||
TypeError = "error"
|
TypeError = "error"
|
||||||
TypePong = "pong"
|
TypePong = "pong"
|
||||||
|
|
||||||
|
PicoTokenPrefix = "pico-"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PicoMessage is the wire format for all Pico Protocol messages.
|
// PicoMessage is the wire format for all Pico Protocol messages.
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import (
|
||||||
_ "github.com/sipeed/picoclaw/pkg/channels/line"
|
_ "github.com/sipeed/picoclaw/pkg/channels/line"
|
||||||
_ "github.com/sipeed/picoclaw/pkg/channels/maixcam"
|
_ "github.com/sipeed/picoclaw/pkg/channels/maixcam"
|
||||||
_ "github.com/sipeed/picoclaw/pkg/channels/onebot"
|
_ "github.com/sipeed/picoclaw/pkg/channels/onebot"
|
||||||
_ "github.com/sipeed/picoclaw/pkg/channels/pico"
|
"github.com/sipeed/picoclaw/pkg/channels/pico"
|
||||||
_ "github.com/sipeed/picoclaw/pkg/channels/qq"
|
_ "github.com/sipeed/picoclaw/pkg/channels/qq"
|
||||||
_ "github.com/sipeed/picoclaw/pkg/channels/slack"
|
_ "github.com/sipeed/picoclaw/pkg/channels/slack"
|
||||||
_ "github.com/sipeed/picoclaw/pkg/channels/telegram"
|
_ "github.com/sipeed/picoclaw/pkg/channels/telegram"
|
||||||
|
|
@ -662,8 +662,6 @@ func setupCronTool(
|
||||||
return cronService, nil
|
return cronService, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const picoTokenPrefix = "pico-"
|
|
||||||
|
|
||||||
// overridePicoToken replaces the pico channel token with the one from the PID file.
|
// overridePicoToken replaces the pico channel token with the one from the PID file.
|
||||||
// The PID file is the single source of truth for the pico auth token;
|
// The PID file is the single source of truth for the pico auth token;
|
||||||
// it is generated once at gateway startup and remains unchanged across reloads.
|
// it is generated once at gateway startup and remains unchanged across reloads.
|
||||||
|
|
@ -672,10 +670,10 @@ func overridePicoToken(cfg *config.Config, token string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
picoToken := cfg.Channels.Pico.Token.String()
|
picoToken := cfg.Channels.Pico.Token.String()
|
||||||
if picoToken == "" || strings.HasPrefix(picoToken, picoTokenPrefix) {
|
if picoToken == "" || strings.HasPrefix(picoToken, pico.PicoTokenPrefix) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cfg.Channels.Pico.SetToken(picoTokenPrefix + token + picoToken)
|
cfg.Channels.Pico.SetToken(pico.PicoTokenPrefix + token + picoToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createHeartbeatHandler(agentLoop *agent.AgentLoop) func(prompt, channel, chatID string) *tools.ToolResult {
|
func createHeartbeatHandler(agentLoop *agent.AgentLoop) func(prompt, channel, chatID string) *tools.ToolResult {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/sipeed/picoclaw/pkg/channels/pico"
|
||||||
"github.com/sipeed/picoclaw/pkg/config"
|
"github.com/sipeed/picoclaw/pkg/config"
|
||||||
"github.com/sipeed/picoclaw/pkg/health"
|
"github.com/sipeed/picoclaw/pkg/health"
|
||||||
"github.com/sipeed/picoclaw/pkg/logger"
|
"github.com/sipeed/picoclaw/pkg/logger"
|
||||||
|
|
@ -60,7 +61,6 @@ func refreshPicoTokensLocked(configPath string) {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
protocolKey = "Sec-Websocket-Protocol"
|
protocolKey = "Sec-Websocket-Protocol"
|
||||||
picoTokenPrefix = "pico-"
|
|
||||||
tokenPrefix = "token."
|
tokenPrefix = "token."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ func picoComposedToken(token string) string {
|
||||||
if tokenPrefix+gateway.picoToken != token {
|
if tokenPrefix+gateway.picoToken != token {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return picoTokenPrefix + gateway.pidData.Token + gateway.picoToken
|
return pico.PicoTokenPrefix + gateway.pidData.Token + gateway.picoToken
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue