fix: remove confusing synthetic chatID suffix, rely solely on SkipPlaceholder flag
Co-authored-by: dj-oyu <68707227+dj-oyu@users.noreply.github.com>
This commit is contained in:
parent
031f0d2721
commit
ae347891a2
2 changed files with 4 additions and 21 deletions
|
|
@ -475,10 +475,10 @@ func (c *TelegramChannel) handleQuickCommand(ctx context.Context, message telego
|
|||
"peer_id": peerID,
|
||||
}
|
||||
|
||||
// Use a message-scoped chatID so this response never matches the ongoing
|
||||
// LLM task's placeholder or stopThinking entry for this chat.
|
||||
chatIDStr := fmt.Sprintf("%d#%d", chatID, message.MessageID)
|
||||
c.HandleMessage(fmt.Sprintf("%d", user.ID), chatIDStr, content, nil, metadata)
|
||||
// No "Thinking..." placeholder — send directly via message bus.
|
||||
// SkipPlaceholder=true on the outbound message prevents Send() from
|
||||
// touching the ongoing task's stopThinking/placeholders state.
|
||||
c.HandleMessage(fmt.Sprintf("%d", user.ID), fmt.Sprintf("%d", chatID), content, nil, metadata)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -522,11 +522,6 @@ func (c *TelegramChannel) downloadFile(ctx context.Context, fileID, ext string)
|
|||
}
|
||||
|
||||
func parseChatID(chatIDStr string) (int64, error) {
|
||||
// Strip message-scoped suffix used by quick-command responses.
|
||||
// e.g. "123456789#42" → parse as "123456789"
|
||||
if idx := strings.IndexByte(chatIDStr, '#'); idx >= 0 {
|
||||
chatIDStr = chatIDStr[:idx]
|
||||
}
|
||||
var id int64
|
||||
_, err := fmt.Sscanf(chatIDStr, "%d", &id)
|
||||
return id, err
|
||||
|
|
|
|||
|
|
@ -96,15 +96,3 @@ func TestParseChatID_Plain(t *testing.T) {
|
|||
t.Errorf("expected 123456789, got %d", id)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseChatID_MessageScopedSuffix(t *testing.T) {
|
||||
// Quick-command responses use "chatID#messageID" to ensure uniqueness.
|
||||
// parseChatID must strip the suffix so delivery still works.
|
||||
id, err := parseChatID("123456789#42")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if id != 123456789 {
|
||||
t.Errorf("expected 123456789, got %d", id)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue