MCPcopy Create free account
hub / github.com/bytebase/bytebase / handleSelect

Function handleSelect

frontend/src/react/components/sql-editor/OpenAIButton.tsx:120–138  ·  view source on GitHub ↗
(action: ChatAction)

Source from the content-addressed store, hash-verified

118 const hasActions = visibleActions.length > 0;
119
120 const handleSelect = async (action: ChatAction) => {
121 setMenuOpen(false);
122 const newChat = !showAIPanel;
123 setShowAIPanel(true);
124
125 if (!statement) return;
126 await nextAnimationFrame();
127 if (action === "explain-code") {
128 void aiContextEvents.emit("send-chat", {
129 content: promptUtils.explainCode(statement, instance.engine),
130 newChat,
131 });
132 } else if (action === "find-problems") {
133 void aiContextEvents.emit("send-chat", {
134 content: promptUtils.findProblems(statement, instance.engine),
135 newChat,
136 });
137 }
138 };
139
140 const renderButton = (onClick?: () => void) => (
141 <Button

Callers 1

OpenAIButtonFunction · 0.70

Calls 1

nextAnimationFrameFunction · 0.90

Tested by

no test coverage detected