add minor debugging

This commit is contained in:
Andrew Pareles 2024-11-21 17:54:43 -08:00
parent 1bb243bc34
commit a50b5c6407
2 changed files with 4 additions and 0 deletions

View file

@ -214,6 +214,7 @@ export const SidebarChat = () => {
messages: [...(currentThread?.messages ?? []).map(m => ({ role: m.role, content: m.content })),],
onText: (newText, fullText) => setMessageStream(fullText),
onFinalMessage: (content) => {
console.log('chat: running final message')
// add assistant's message to chat history, and clear selection
const newHistoryElt: ChatMessage = { role: 'assistant', content, displayContent: content }
@ -222,6 +223,8 @@ export const SidebarChat = () => {
setIsLoading(false)
},
onError: (error) => {
console.log('chat: running error')
// add assistant's message to chat history, and clear selection
let content = messageStream; // just use the current content
const newHistoryElt: ChatMessage = { role: 'assistant', content, displayContent: content, }

View file

@ -160,6 +160,7 @@ class ThreadHistoryService extends Disposable implements IThreadHistoryService {
addMessageToCurrentThread(message: ChatMessage) {
console.log('adding ', message.role, 'to chat')
const { allThreads, _currentThreadId } = this.state
// get the current thread, or create one