MCPcopy Index your code
hub / github.com/coder/coder / publishEditedMessage

Method publishEditedMessage

coderd/x/chatd/chatd.go:5745–5761  ·  view source on GitHub ↗

publishEditedMessage is like publishMessage but uses FullRefresh so remote subscribers re-fetch from the beginning, ensuring the edit is never silently dropped. The durable cache is replaced with only the edited message.

(chatID uuid.UUID, message database.ChatMessage)

Source from the content-addressed store, hash-verified

5743// edit is never silently dropped. The durable cache is replaced
5744// with only the edited message.
5745func (p *Server) publishEditedMessage(chatID uuid.UUID, message database.ChatMessage) {
5746 sdkMessage := db2sdk.ChatMessage(message)
5747 event := codersdk.ChatStreamEvent{
5748 Type: codersdk.ChatStreamEventTypeMessage,
5749 ChatID: chatID,
5750 Message: &sdkMessage,
5751 }
5752 state := p.getOrCreateStreamState(chatID)
5753 state.mu.Lock()
5754 state.durableMessages = []codersdk.ChatStreamEvent{event}
5755 state.durableEvictedBefore = 0
5756 state.mu.Unlock()
5757 p.publishEvent(chatID, event)
5758 p.publishChatStreamNotify(chatID, coderdpubsub.ChatStreamNotifyMessage{
5759 FullRefresh: true,
5760 })
5761}
5762
5763func (p *Server) publishMessagePart(chatID uuid.UUID, role codersdk.ChatMessageRole, part codersdk.ChatMessagePart) {
5764 if part.Type == "" {

Calls 6

publishEventMethod · 0.95
ChatMessageFunction · 0.92
LockMethod · 0.45
UnlockMethod · 0.45