Fix lint and compile errors on message history branch
This commit is contained in:
parent
dffceffcaf
commit
862163e5d6
4 changed files with 26 additions and 41 deletions
|
|
@ -140,16 +140,16 @@ func cloneMessageIDs(msgIDs []string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultResponse = "The model returned an empty response. This may indicate a provider error or token limit."
|
defaultResponse = "The model returned an empty response. This may indicate a provider error or token limit."
|
||||||
toolLimitResponse = "I've reached `max_tool_iterations` without a final response. Increase `max_tool_iterations` in config.json if this task needs more tool steps."
|
toolLimitResponse = "I've reached `max_tool_iterations` without a final response. Increase `max_tool_iterations` in config.json if this task needs more tool steps."
|
||||||
handledToolResponseSummary = "Requested output delivered via tool attachment."
|
handledToolResponseSummary = "Requested output delivered via tool attachment."
|
||||||
sessionKeyAgentPrefix = "agent:"
|
sessionKeyAgentPrefix = "agent:"
|
||||||
metadataKeyAccountID = "account_id"
|
metadataKeyAccountID = "account_id"
|
||||||
metadataKeyGuildID = "guild_id"
|
metadataKeyGuildID = "guild_id"
|
||||||
metadataKeyTeamID = "team_id"
|
metadataKeyTeamID = "team_id"
|
||||||
metadataKeyParentPeerKind = "parent_peer_kind"
|
metadataKeyParentPeerKind = "parent_peer_kind"
|
||||||
metadataKeyParentPeerID = "parent_peer_id"
|
metadataKeyParentPeerID = "parent_peer_id"
|
||||||
metadataKeyReplyToMessage = "reply_to_message_id"
|
metadataKeyReplyToMessage = "reply_to_message_id"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewAgentLoop(
|
func NewAgentLoop(
|
||||||
|
|
|
||||||
|
|
@ -729,8 +729,8 @@ func TestProcessMessage_MediaToolHandledSkipsFollowUpLLMAndFinalText(t *testing.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if response != "" {
|
if response.Content != "" {
|
||||||
t.Fatalf("expected no final response when media tool already handled delivery, got %q", response)
|
t.Fatalf("expected no final response when media tool already handled delivery, got %q", response.Content)
|
||||||
}
|
}
|
||||||
if provider.calls != 1 {
|
if provider.calls != 1 {
|
||||||
t.Fatalf("expected exactly 1 LLM call, got %d", provider.calls)
|
t.Fatalf("expected exactly 1 LLM call, got %d", provider.calls)
|
||||||
|
|
@ -824,8 +824,8 @@ func TestProcessMessage_HandledToolProcessesQueuedSteeringBeforeReturning(t *tes
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if response != "Handled the queued steering message." {
|
if response.Content != "Handled the queued steering message." {
|
||||||
t.Fatalf("response = %q, want queued steering response", response)
|
t.Fatalf("response = %q, want queued steering response", response.Content)
|
||||||
}
|
}
|
||||||
if provider.calls != 2 {
|
if provider.calls != 2 {
|
||||||
t.Fatalf("expected 2 LLM calls after queued steering, got %d", provider.calls)
|
t.Fatalf("expected 2 LLM calls after queued steering, got %d", provider.calls)
|
||||||
|
|
@ -875,8 +875,8 @@ func TestProcessMessage_MediaArtifactCanBeForwardedBySendFile(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if response != "" {
|
if response.Content != "" {
|
||||||
t.Fatalf("expected no final response after send_file handled delivery, got %q", response)
|
t.Fatalf("expected no final response after send_file handled delivery, got %q", response.Content)
|
||||||
}
|
}
|
||||||
if provider.calls != 2 {
|
if provider.calls != 2 {
|
||||||
t.Fatalf("expected 2 LLM calls (artifact + send_file), got %d", provider.calls)
|
t.Fatalf("expected 2 LLM calls (artifact + send_file), got %d", provider.calls)
|
||||||
|
|
@ -2448,8 +2448,8 @@ func TestProcessMessage_PublishesReasoningContentToReasoningChannel(t *testing.T
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if response != "final answer" {
|
if response.Content != "final answer" {
|
||||||
t.Fatalf("processMessage() response = %q, want %q", response, "final answer")
|
t.Fatalf("processMessage() response = %q, want %q", response.Content, "final answer")
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|
@ -2554,8 +2554,8 @@ func TestProcessMessage_PublishesToolFeedbackWhenEnabled(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if response != "HEARTBEAT_OK" {
|
if response.Content != "HEARTBEAT_OK" {
|
||||||
t.Fatalf("processMessage() response = %q, want %q", response, "HEARTBEAT_OK")
|
t.Fatalf("processMessage() response = %q, want %q", response.Content, "HEARTBEAT_OK")
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|
@ -2998,8 +2998,8 @@ func TestProcessMessage_ContextOverflowRecovery(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if response != "Recovered from overflow" {
|
if response.Content != "Recovered from overflow" {
|
||||||
t.Fatalf("response = %q, want %q", response, "Recovered from overflow")
|
t.Fatalf("response = %q, want %q", response.Content, "Recovered from overflow")
|
||||||
}
|
}
|
||||||
|
|
||||||
if provider.calls != 2 {
|
if provider.calls != 2 {
|
||||||
|
|
@ -3039,8 +3039,8 @@ func TestProcessMessage_ContextOverflow_AnthropicStyle(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("processMessage() error = %v", err)
|
t.Fatalf("processMessage() error = %v", err)
|
||||||
}
|
}
|
||||||
if !strings.Contains(response, "Anthropic recovery success") {
|
if !strings.Contains(response.Content, "Anthropic recovery success") {
|
||||||
t.Fatalf("response = %q, want success message", response)
|
t.Fatalf("response = %q, want success message", response.Content)
|
||||||
}
|
}
|
||||||
if provider.calls != 2 {
|
if provider.calls != 2 {
|
||||||
t.Fatalf("expected 2 calls for retry, got %d", provider.calls)
|
t.Fatalf("expected 2 calls for retry, got %d", provider.calls)
|
||||||
|
|
|
||||||
|
|
@ -686,21 +686,6 @@ func TestHandleMessage_EmptyContent_Ignored(t *testing.T) {
|
||||||
From: &telego.User{
|
From: &telego.User{
|
||||||
ID: 789,
|
ID: 789,
|
||||||
FirstName: "User",
|
FirstName: "User",
|
||||||
=======
|
|
||||||
msg := &telego.Message{
|
|
||||||
Text: "reply in group",
|
|
||||||
MessageID: 30,
|
|
||||||
Chat: telego.Chat{
|
|
||||||
ID: -100999,
|
|
||||||
Type: "supergroup",
|
|
||||||
},
|
|
||||||
From: &telego.User{
|
|
||||||
ID: 10,
|
|
||||||
FirstName: "Dana",
|
|
||||||
},
|
|
||||||
ReplyToMessage: &telego.Message{
|
|
||||||
MessageID: 25,
|
|
||||||
>>>>>>> 7b6328f (Fix Telegram inbound reply threading)
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ func TestSend_StreamFailureFallsBackToActualChatID(t *testing.T) {
|
||||||
return wecomTestAck(nil), nil
|
return wecomTestAck(nil), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ch.Send(context.Background(), bus.OutboundMessage{
|
if _, err := ch.Send(context.Background(), bus.OutboundMessage{
|
||||||
Channel: "wecom",
|
Channel: "wecom",
|
||||||
ChatID: "chat-1",
|
ChatID: "chat-1",
|
||||||
Content: "hello",
|
Content: "hello",
|
||||||
|
|
@ -247,7 +247,7 @@ func TestSend_DoesNotSplitStreamReply(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
content := strings.Repeat("\u4e2d", 30000)
|
content := strings.Repeat("\u4e2d", 30000)
|
||||||
if err := ch.Send(context.Background(), bus.OutboundMessage{
|
if _, err := ch.Send(context.Background(), bus.OutboundMessage{
|
||||||
Channel: "wecom",
|
Channel: "wecom",
|
||||||
ChatID: "chat-1",
|
ChatID: "chat-1",
|
||||||
Content: content,
|
Content: content,
|
||||||
|
|
@ -283,7 +283,7 @@ func TestSend_DoesNotSplitActivePush(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
content := strings.Repeat("a", 30000)
|
content := strings.Repeat("a", 30000)
|
||||||
if err := ch.Send(context.Background(), bus.OutboundMessage{
|
if _, err := ch.Send(context.Background(), bus.OutboundMessage{
|
||||||
Channel: "wecom",
|
Channel: "wecom",
|
||||||
ChatID: "chat-1",
|
ChatID: "chat-1",
|
||||||
Content: content,
|
Content: content,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue