@@ -72,7 +72,7 @@ export function useChat(options: UseChatOptions = {}) {
72
72
id : modelName ,
73
73
name : modelName ,
74
74
provider : "ollama" as const ,
75
- } )
75
+ } ) ,
76
76
) ;
77
77
78
78
setOllamaModels ( ollamaModelDefinitions ) ;
@@ -93,15 +93,15 @@ export function useChat(options: UseChatOptions = {}) {
93
93
setModel ( ollamaModels [ 0 ] ) ;
94
94
} else if ( hasToken ( "anthropic" ) ) {
95
95
const claudeModel = SUPPORTED_MODELS . find (
96
- ( m ) => m . id === Model . CLAUDE_3_5_SONNET_LATEST
96
+ ( m ) => m . id === Model . CLAUDE_3_5_SONNET_LATEST ,
97
97
) ;
98
98
if ( claudeModel ) setModel ( claudeModel ) ;
99
99
} else if ( hasToken ( "openai" ) ) {
100
100
const gptModel = SUPPORTED_MODELS . find ( ( m ) => m . id === Model . GPT_4O ) ;
101
101
if ( gptModel ) setModel ( gptModel ) ;
102
102
} else if ( hasToken ( "deepseek" ) ) {
103
103
const deepseekModel = SUPPORTED_MODELS . find (
104
- ( m ) => m . id === Model . DEEPSEEK_CHAT
104
+ ( m ) => m . id === Model . DEEPSEEK_CHAT ,
105
105
) ;
106
106
if ( deepseekModel ) setModel ( deepseekModel ) ;
107
107
} else {
@@ -116,7 +116,7 @@ export function useChat(options: UseChatOptions = {}) {
116
116
// For Ollama, return "local" if it's running and the model is available
117
117
return isOllamaRunning &&
118
118
ollamaModels . some (
119
- ( om ) => om . id === model . id || om . id . startsWith ( `${ model . id } :` )
119
+ ( om ) => om . id === model . id || om . id . startsWith ( `${ model . id } :` ) ,
120
120
)
121
121
? "local"
122
122
: "" ;
@@ -133,7 +133,7 @@ export function useChat(options: UseChatOptions = {}) {
133
133
onModelChange ( newModel ) ;
134
134
}
135
135
} ,
136
- [ onModelChange ]
136
+ [ onModelChange ] ,
137
137
) ;
138
138
139
139
// Available models with API keys or local Ollama models
@@ -165,7 +165,7 @@ export function useChat(options: UseChatOptions = {}) {
165
165
assistantMessage : ChatMessage ,
166
166
assistantContent : { current : string } ,
167
167
toolCalls : { current : any [ ] } ,
168
- toolResults : { current : any [ ] }
168
+ toolResults : { current : any [ ] } ,
169
169
) => {
170
170
// Handle text content
171
171
if (
@@ -178,7 +178,7 @@ export function useChat(options: UseChatOptions = {}) {
178
178
messages : prev . messages . map ( ( msg ) =>
179
179
msg . id === assistantMessage . id
180
180
? { ...msg , content : assistantContent . current }
181
- : msg
181
+ : msg ,
182
182
) ,
183
183
} ) ) ;
184
184
return ;
@@ -196,7 +196,7 @@ export function useChat(options: UseChatOptions = {}) {
196
196
messages : prev . messages . map ( ( msg ) =>
197
197
msg . id === assistantMessage . id
198
198
? { ...msg , toolCalls : [ ...toolCalls . current ] }
199
- : msg
199
+ : msg ,
200
200
) ,
201
201
} ) ) ;
202
202
return ;
@@ -218,7 +218,7 @@ export function useChat(options: UseChatOptions = {}) {
218
218
...tc ,
219
219
status : toolResult . error ? "error" : "completed" ,
220
220
}
221
- : tc
221
+ : tc ,
222
222
) ;
223
223
224
224
setState ( ( prev ) => ( {
@@ -230,7 +230,7 @@ export function useChat(options: UseChatOptions = {}) {
230
230
toolCalls : [ ...toolCalls . current ] ,
231
231
toolResults : [ ...toolResults . current ] ,
232
232
}
233
- : msg
233
+ : msg ,
234
234
) ,
235
235
} ) ) ;
236
236
return ;
@@ -261,14 +261,14 @@ export function useChat(options: UseChatOptions = {}) {
261
261
throw new Error ( parsed . error ) ;
262
262
}
263
263
} ,
264
- [ ]
264
+ [ ] ,
265
265
) ;
266
266
267
267
const sendChatRequest = useCallback (
268
268
async ( userMessage : ChatMessage ) => {
269
269
if ( ! serverConfigs || ! model || ! currentApiKey ) {
270
270
throw new Error (
271
- "Missing required configuration: serverConfig, model, and apiKey are required"
271
+ "Missing required configuration: serverConfig, model, and apiKey are required" ,
272
272
) ;
273
273
}
274
274
@@ -349,7 +349,7 @@ export function useChat(options: UseChatOptions = {}) {
349
349
assistantMessage ,
350
350
assistantContent ,
351
351
toolCalls ,
352
- toolResults
352
+ toolResults ,
353
353
) ;
354
354
} catch ( parseError ) {
355
355
console . warn ( "Failed to parse SSE data:" , data , parseError ) ;
@@ -388,7 +388,7 @@ export function useChat(options: UseChatOptions = {}) {
388
388
onMessageReceived ,
389
389
handleStreamingEvent ,
390
390
getOllamaBaseUrl ,
391
- ]
391
+ ] ,
392
392
) ;
393
393
394
394
const sendMessage = useCallback (
@@ -429,7 +429,7 @@ export function useChat(options: UseChatOptions = {}) {
429
429
}
430
430
}
431
431
} ,
432
- [ state . isLoading , onMessageSent , sendChatRequest , onError ]
432
+ [ state . isLoading , onMessageSent , sendChatRequest , onError ] ,
433
433
) ;
434
434
435
435
const stopGeneration = useCallback ( ( ) => {
@@ -480,7 +480,7 @@ export function useChat(options: UseChatOptions = {}) {
480
480
}
481
481
}
482
482
} ,
483
- [ sendChatRequest , onError ]
483
+ [ sendChatRequest , onError ] ,
484
484
) ;
485
485
486
486
const deleteMessage = useCallback ( ( messageId : string ) => {
@@ -502,7 +502,7 @@ export function useChat(options: UseChatOptions = {}) {
502
502
const handleElicitationResponse = useCallback (
503
503
async (
504
504
action : "accept" | "decline" | "cancel" ,
505
- parameters ?: Record < string , any >
505
+ parameters ?: Record < string , any > ,
506
506
) => {
507
507
if ( ! elicitationRequest ) {
508
508
console . warn ( "Cannot handle elicitation response: no active request" ) ;
@@ -554,7 +554,7 @@ export function useChat(options: UseChatOptions = {}) {
554
554
setElicitationLoading ( false ) ;
555
555
}
556
556
} ,
557
- [ elicitationRequest , onError ]
557
+ [ elicitationRequest , onError ] ,
558
558
) ;
559
559
560
560
// Cleanup on unmount
0 commit comments