style: fix CI lint
This commit is contained in:
parent
7d44ce72cf
commit
7e81432858
4 changed files with 40 additions and 22 deletions
|
|
@ -135,7 +135,9 @@ func TestHandleGroupATMessage_PrefersGroupOpenIDFromRawPayload(t *testing.T) {
|
||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
}
|
}
|
||||||
|
|
||||||
raw := []byte(`{"d":{"group_openid":"group-openid-abc","author":{"id":"legacy-member-id","member_openid":"member-openid-xyz"}}}`)
|
raw := []byte(
|
||||||
|
`{"d":{"group_openid":"group-openid-abc","author":{"id":"legacy-member-id","member_openid":"member-openid-xyz"}}}`,
|
||||||
|
)
|
||||||
err := ch.handleGroupATMessage()(&dto.WSPayload{RawMessage: raw}, &dto.WSGroupATMessageData{
|
err := ch.handleGroupATMessage()(&dto.WSPayload{RawMessage: raw}, &dto.WSGroupATMessageData{
|
||||||
ID: "group-openid-msg",
|
ID: "group-openid-msg",
|
||||||
GroupID: "legacy-group-id",
|
GroupID: "legacy-group-id",
|
||||||
|
|
@ -169,7 +171,9 @@ func TestHandleGroupATMessage_AllowListFallsBackToLegacyMemberID(t *testing.T) {
|
||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
}
|
}
|
||||||
|
|
||||||
raw := []byte(`{"d":{"group_openid":"group-openid-abc","author":{"id":"legacy-member-id","member_openid":"member-openid-xyz"}}}`)
|
raw := []byte(
|
||||||
|
`{"d":{"group_openid":"group-openid-abc","author":{"id":"legacy-member-id","member_openid":"member-openid-xyz"}}}`,
|
||||||
|
)
|
||||||
err := ch.handleGroupATMessage()(&dto.WSPayload{RawMessage: raw}, &dto.WSGroupATMessageData{
|
err := ch.handleGroupATMessage()(&dto.WSPayload{RawMessage: raw}, &dto.WSGroupATMessageData{
|
||||||
ID: "group-allow-fallback",
|
ID: "group-allow-fallback",
|
||||||
GroupID: "legacy-group-id",
|
GroupID: "legacy-group-id",
|
||||||
|
|
@ -218,7 +222,9 @@ func TestParseQQOpenIDs(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "all openids",
|
name: "all openids",
|
||||||
raw: []byte(`{"d":{"group_openid":"group-1","author":{"user_openid":"user-1","member_openid":"member-1"}}}`),
|
raw: []byte(
|
||||||
|
`{"d":{"group_openid":"group-1","author":{"user_openid":"user-1","member_openid":"member-1"}}}`,
|
||||||
|
),
|
||||||
wantUser: "user-1",
|
wantUser: "user-1",
|
||||||
wantMember: "member-1",
|
wantMember: "member-1",
|
||||||
wantGroup: "group-1",
|
wantGroup: "group-1",
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,11 @@ func setupAndStartChannelServices(
|
||||||
}
|
}
|
||||||
|
|
||||||
if runningServices.ListenHost != "" {
|
if runningServices.ListenHost != "" {
|
||||||
fmt.Printf("✓ Health endpoints available at http://%s:%d/health and /ready\n", runningServices.ListenHost, runningServices.ListenPort)
|
fmt.Printf(
|
||||||
|
"✓ Health endpoints available at http://%s:%d/health and /ready\n",
|
||||||
|
runningServices.ListenHost,
|
||||||
|
runningServices.ListenPort,
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("⚠ Shared HTTP server disabled; /health and webhook endpoints are unavailable")
|
fmt.Println("⚠ Shared HTTP server disabled; /health and webhook endpoints are unavailable")
|
||||||
}
|
}
|
||||||
|
|
@ -190,10 +194,14 @@ func resolveChannelOnlyListenHost(host string, port int) (string, error) {
|
||||||
return host, nil
|
return host, nil
|
||||||
} else if isLoopbackHost(host) {
|
} else if isLoopbackHost(host) {
|
||||||
if fallbackErr := probeTCPBind("0.0.0.0", port); fallbackErr == nil {
|
if fallbackErr := probeTCPBind("0.0.0.0", port); fallbackErr == nil {
|
||||||
logger.WarnCF("channels", "Loopback host unavailable in channel-only mode, fallback to wildcard", map[string]any{
|
logger.WarnCF(
|
||||||
|
"channels",
|
||||||
|
"Loopback host unavailable in channel-only mode, fallback to wildcard",
|
||||||
|
map[string]any{
|
||||||
"host": host,
|
"host": host,
|
||||||
"port": port,
|
"port": port,
|
||||||
})
|
},
|
||||||
|
)
|
||||||
return "0.0.0.0", nil
|
return "0.0.0.0", nil
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("bind %s:%d failed: %w", host, port, err)
|
return "", fmt.Errorf("bind %s:%d failed: %w", host, port, err)
|
||||||
|
|
@ -221,7 +229,11 @@ func isLoopbackHost(host string) bool {
|
||||||
return ip != nil && ip.IsLoopback()
|
return ip != nil && ip.IsLoopback()
|
||||||
}
|
}
|
||||||
|
|
||||||
func shutdownChannelRuntime(runningServices *channelServices, agentLoop *agent.AgentLoop, provider providers.LLMProvider) {
|
func shutdownChannelRuntime(
|
||||||
|
runningServices *channelServices,
|
||||||
|
agentLoop *agent.AgentLoop,
|
||||||
|
provider providers.LLMProvider,
|
||||||
|
) {
|
||||||
if cp, ok := provider.(providers.StatefulProvider); ok {
|
if cp, ok := provider.(providers.StatefulProvider); ok {
|
||||||
cp.Close()
|
cp.Close()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue