feat: ai chat now has context of the active tab

This commit is contained in:
Akhileshrangani4
2024-10-14 23:01:25 -04:00
parent cc4a5307cd
commit 751d9a3005
4 changed files with 17 additions and 7 deletions

View File

@ -63,7 +63,8 @@ export const handleSend = async (
setIsContextExpanded: React.Dispatch<React.SetStateAction<boolean>>,
setIsGenerating: React.Dispatch<React.SetStateAction<boolean>>,
setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,
abortControllerRef: React.MutableRefObject<AbortController | null>
abortControllerRef: React.MutableRefObject<AbortController | null>,
activeFileContent: string
) => {
if (input.trim() === '' && !context) return;
@ -95,6 +96,7 @@ export const handleSend = async (
body: JSON.stringify({
messages: anthropicMessages,
context: context || undefined,
activeFileContent: activeFileContent,
}),
signal: abortControllerRef.current.signal,
});