MCPcopy
hub / github.com/wavetermdev/waveterm / CountUserMessages

Method CountUserMessages

pkg/aiusechat/chatstore/chatstore.go:52–68  ·  view source on GitHub ↗
(chatId string)

Source from the content-addressed store, hash-verified

50}
51
52func (cs *ChatStore) CountUserMessages(chatId string) int {
53 cs.lock.Lock()
54 defer cs.lock.Unlock()
55
56 chat := cs.chats[chatId]
57 if chat == nil {
58 return 0
59 }
60
61 count := 0
62 for _, msg := range chat.NativeMessages {
63 if msg.GetRole() == "user" {
64 count++
65 }
66 }
67 return count
68}
69
70func (cs *ChatStore) PostMessage(chatId string, aiOpts *uctypes.AIOptsType, message uctypes.GenAIMessage) error {
71 cs.lock.Lock()

Callers 1

RunAIChatFunction · 0.80

Calls 1

GetRoleMethod · 0.65

Tested by

no test coverage detected