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

Function publishChatTitleChange

coderd/exp_chats.go:117–139  ·  view source on GitHub ↗
(logger slog.Logger, ps dbpubsub.Pubsub, chat database.Chat)

Source from the content-addressed store, hash-verified

115}
116
117func publishChatTitleChange(logger slog.Logger, ps dbpubsub.Pubsub, chat database.Chat) {
118 if ps == nil {
119 return
120 }
121 event := codersdk.ChatWatchEvent{
122 Kind: codersdk.ChatWatchEventKindTitleChange,
123 Chat: db2sdk.Chat(chat, nil, nil),
124 }
125 payload, err := json.Marshal(event)
126 if err != nil {
127 logger.Error(context.Background(), "failed to marshal chat title change event",
128 slog.F("chat_id", chat.ID),
129 slog.Error(err),
130 )
131 return
132 }
133 if err := ps.Publish(pubsub.ChatWatchEventChannel(chat.OwnerID), payload); err != nil {
134 logger.Error(context.Background(), "failed to publish chat title change event",
135 slog.F("chat_id", chat.ID),
136 slog.Error(err),
137 )
138 }
139}
140
141func publishChatConfigEvent(logger slog.Logger, ps dbpubsub.Pubsub, kind pubsub.ChatConfigEventKind, entityID uuid.UUID) {
142 payload, err := json.Marshal(pubsub.ChatConfigEvent{

Callers 1

applyChatTitleUpdateMethod · 0.85

Calls 5

ChatFunction · 0.92
ChatWatchEventChannelFunction · 0.92
PublishMethod · 0.65
MarshalMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected