MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / handleSend

Function handleSend

ai-code-studio/src/App.tsx:397–441  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

395 }
396
397 async function handleSend() {
398 const nextPrompt = prompt.trim();
399 if (!nextPrompt) return;
400
401 const preflightError = getPreflightError(config);
402 if (preflightError) {
403 setShowSettings(true);
404 setErrorMessage(preflightError);
405 return;
406 }
407
408 const pendingId = `pending-${Date.now()}-${Math.random().toString(16).slice(2)}`;
409 const pendingEntry: FeedEntry = {
410 id: pendingId,
411 feedType: 'user',
412 role: 'user',
413 entryType: 'user',
414 title: 'You',
415 content: nextPrompt,
416 timestamp: new Date().toISOString(),
417 streaming: false,
418 isError: false,
419 };
420 setPendingUserMessages(prev => [...prev, pendingEntry]);
421
422 setIsSubmitting(true);
423 setErrorMessage(null);
424 setActiveTab('Chat');
425 setPrompt('');
426 try {
427 await api('/api/chat', {
428 method: 'POST',
429 body: {
430 prompt: nextPrompt,
431 config,
432 },
433 });
434 } catch (error) {
435 setPrompt(current => (current ? current : nextPrompt));
436 setErrorMessage(error instanceof Error ? error.message : String(error));
437 setPendingUserMessages(prev => prev.filter(m => m.id !== pendingId));
438 } finally {
439 setIsSubmitting(false);
440 }
441 }
442
443 async function handleStop() {
444 try {

Callers 1

AppFunction · 0.85

Calls 2

getPreflightErrorFunction · 0.90
apiFunction · 0.90

Tested by

no test coverage detected