MCPcopy Index your code
hub / github.com/sqlchat/sqlchat / getPrompt

Function getPrompt

src/components/SchemaDrawer.tsx:23–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 const [prompt, setPrompt] = useState<string>("");
22
23 const getPrompt = async () => {
24 if (!currentConversation) return;
25 const promptGenerator = getPromptGeneratorOfAssistant(getAssistantById(currentConversation.assistantId)!);
26 let dbPrompt = promptGenerator();
27 if (connectionStore.currentConnectionCtx?.database) {
28 const schemaList = await connectionStore.getOrFetchDatabaseSchema(connectionStore.currentConnectionCtx?.database);
29 dbPrompt = generateDbPromptFromContext(
30 promptGenerator,
31 connectionStore.currentConnectionCtx.connection.engineType,
32 schemaList,
33 currentConversation.selectedSchemaName || "",
34 currentConversation.selectedTableNameList || [],
35 maxToken
36 );
37 }
38 setPrompt(dbPrompt);
39 };
40
41 useEffect(() => {
42 // TODO: initial state with current conversation.

Callers 1

SchemaDrawerFunction · 0.85

Calls 3

getAssistantByIdFunction · 0.90

Tested by

no test coverage detected