MCPcopy Create free account
hub / github.com/sqlchat/sqlchat / handleSend

Function handleSend

src/components/ConversationView/MessageTextarea.tsx:32–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 };
31
32 const handleSend = async () => {
33 let conversation = conversationStore.getConversationById(conversationStore.currentConversationId);
34 if (!conversation) {
35 const currentConnectionCtx = connectionStore.currentConnectionCtx;
36 if (!currentConnectionCtx) {
37 conversation = conversationStore.createConversation();
38 } else {
39 conversation = conversationStore.createConversation(currentConnectionCtx.connection.id, currentConnectionCtx.database?.name);
40 }
41 }
42 if (!value) {
43 toast.error("Please enter a message.");
44 return;
45 }
46 if (disabled) {
47 return;
48 }
49
50 setValue("");
51 textareaRef.current!.value = "";
52 await sendMessage(value);
53 };
54
55 const handleKeyDown = (event: React.KeyboardEvent) => {
56 if (event.key === "Enter" && !event.shiftKey && !isInIME) {

Callers 1

handleKeyDownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected