(chatId string)
| 21 | } |
| 22 | |
| 23 | func (cs *ChatStore) Get(chatId string) *uctypes.AIChat { |
| 24 | cs.lock.Lock() |
| 25 | defer cs.lock.Unlock() |
| 26 | |
| 27 | chat := cs.chats[chatId] |
| 28 | if chat == nil { |
| 29 | return nil |
| 30 | } |
| 31 | |
| 32 | // Copy the chat to prevent concurrent access issues |
| 33 | copyChat := &uctypes.AIChat{ |
| 34 | ChatId: chat.ChatId, |
| 35 | APIType: chat.APIType, |
| 36 | Model: chat.Model, |
| 37 | APIVersion: chat.APIVersion, |
| 38 | NativeMessages: make([]uctypes.GenAIMessage, len(chat.NativeMessages)), |
| 39 | } |
| 40 | copy(copyChat.NativeMessages, chat.NativeMessages) |
| 41 | |
| 42 | return copyChat |
| 43 | } |
| 44 | |
| 45 | func (cs *ChatStore) Delete(chatId string) { |
| 46 | cs.lock.Lock() |
no outgoing calls