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"
|
||||
TypeError = "error"
|
||||
TypePong = "pong"
|
||||
|
||||
PicoTokenPrefix = "pico-"
|
||||
)
|
||||
|
||||
// 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/maixcam"
|
||||
_ "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/slack"
|
||||
_ "github.com/sipeed/picoclaw/pkg/channels/telegram"
|
||||
|
|
@ -662,8 +662,6 @@ func setupCronTool(
|
|||
return cronService, nil
|
||||
}
|
||||
|
||||
const picoTokenPrefix = "pico-"
|
||||
|
||||
// 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;
|
||||
// it is generated once at gateway startup and remains unchanged across reloads.
|
||||
|
|
@ -672,10 +670,10 @@ func overridePicoToken(cfg *config.Config, token string) {
|
|||
return
|
||||
}
|
||||
picoToken := cfg.Channels.Pico.Token.String()
|
||||
if picoToken == "" || strings.HasPrefix(picoToken, picoTokenPrefix) {
|
||||
if picoToken == "" || strings.HasPrefix(picoToken, pico.PicoTokenPrefix) {
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/sipeed/picoclaw/pkg/channels/pico"
|
||||
"github.com/sipeed/picoclaw/pkg/config"
|
||||
"github.com/sipeed/picoclaw/pkg/health"
|
||||
"github.com/sipeed/picoclaw/pkg/logger"
|
||||
|
|
@ -59,9 +60,8 @@ func refreshPicoTokensLocked(configPath string) {
|
|||
}
|
||||
|
||||
const (
|
||||
protocolKey = "Sec-Websocket-Protocol"
|
||||
picoTokenPrefix = "pico-"
|
||||
tokenPrefix = "token."
|
||||
protocolKey = "Sec-Websocket-Protocol"
|
||||
tokenPrefix = "token."
|
||||
)
|
||||
|
||||
// picoComposedToken returns "pico-"+pidToken+picoToken for gateway auth.
|
||||
|
|
@ -75,7 +75,7 @@ func picoComposedToken(token string) string {
|
|||
if tokenPrefix+gateway.picoToken != token {
|
||||
return ""
|
||||
}
|
||||
return picoTokenPrefix + gateway.pidData.Token + gateway.picoToken
|
||||
return pico.PicoTokenPrefix + gateway.pidData.Token + gateway.picoToken
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue