Chats: a shared highlight colour per chat, pushed live with star and rename
chat_color {session_id, color|null} stores a palette name (red, orange,
amber, green, teal, blue, purple, pink) on the operator-session row; rows
and replies carry it as color. Colour, star and rename changes are pushed
to every other connection as chat_session_changed.
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
// session is refused before anything is written, so a pipeline-owned run session
|
||||
// is never touched. The request body is a ChatQuery carrying SessionID and the
|
||||
// desired Starred value; the reply echoes the updated session.
|
||||
func handleChatStar(ctx context.Context, request protocol.Message, registry operatorRegistry, write func(protocol.Message) error) {
|
||||
func handleChatStar(ctx context.Context, request protocol.Message, registry operatorRegistry, changes *chatSessionChanges, clientID string, write func(protocol.Message) error) {
|
||||
if registry == nil {
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "operator session registry is not configured on this server"})
|
||||
return
|
||||
@@ -39,20 +39,5 @@ func handleChatStar(ctx context.Context, request protocol.Message, registry oper
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: err.Error()})
|
||||
return
|
||||
}
|
||||
session, found, err := registry.OperatorSession(ctx, sessionID)
|
||||
if err != nil {
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: err.Error()})
|
||||
return
|
||||
}
|
||||
if !found {
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "session " + sessionID + " is no longer an operator session"})
|
||||
return
|
||||
}
|
||||
wire := chatSessionFromOperator(session)
|
||||
write(protocol.Message{
|
||||
Type: protocol.ChatStar,
|
||||
ID: request.ID,
|
||||
ChatSession: &wire,
|
||||
ChatSessions: []protocol.ChatSession{wire},
|
||||
})
|
||||
echoOperatorSession(ctx, request, sessionID, protocol.ChatStar, registry, changes, clientID, write)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user