MCPcopy Create free account
hub / github.com/admineral/OpenAI-Assistant-API-Chat / startChatAssistant

Function startChatAssistant

app/page.tsx:40–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38 useStartAssistant(assistantId, chatManager, initialThreadMessage);
39
40 const startChatAssistant = async () => {
41 setIsButtonDisabled(true);
42 setStartLoading(true);
43 if (chatManager) {
44 try {
45 console.log('Starting assistant with the following parameters:');
46 console.log('Assistant Name:', assistantName);
47 console.log('Assistant Model:', assistantModel);
48 console.log('Assistant Description:', assistantDescription);
49 console.log('File IDs:', fileIds);
50 console.log('Initial Thread Message:', initialThreadMessage);
51
52 await chatManager.startAssistant({ assistantName, assistantModel, assistantDescription }, fileIds, initialThreadMessage);
53
54 console.log('Assistant started:', chatManager.getChatState());
55 setChatStarted(true);
56 } catch (error) {
57 console.error('Error starting assistant:', error);
58 if (error instanceof Error) setStatusMessage(`Error: ${error.message}`);
59 } finally {
60 setIsButtonDisabled(false);
61 setStartLoading(false);
62 }
63 }
64 };
65
66 return (
67 <main className="flex flex-col items-center justify-between pb-40 bg-space-grey-light">

Callers

nothing calls this directly

Calls 2

startAssistantMethod · 0.80
getChatStateMethod · 0.80

Tested by

no test coverage detected