Skip to content

Commit

Permalink
fix: add back text2sql survey (#1452)
Browse files Browse the repository at this point in the history
* fix: add back text2sql survey

* fix linter
  • Loading branch information
jczhong84 authored May 16, 2024
1 parent d81d582 commit b8d9a95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "querybook",
"version": "3.34.0",
"version": "3.34.1",
"description": "A Big Data Webapp",
"private": true,
"scripts": {
Expand Down
15 changes: 15 additions & 0 deletions querybook/webapp/components/AIAssistant/AICommandResultView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { IQueryCellCommand } from 'const/command';
import useNonEmptyState from 'hooks/useNonEmptyState';
import { trackClick } from 'lib/analytics';
import { Button } from 'ui/Button/Button';
import { SurveySurfaceType } from 'const/survey';
import { useSurveyTrigger } from 'hooks/ui/useSurveyTrigger';

interface IAICommandResultViewProps {
command: IQueryCellCommand;
Expand Down Expand Up @@ -59,6 +61,19 @@ export const AICommandResultView = ({
}
}, [commandResult]);

const triggerSurvey = useSurveyTrigger();
useEffect(() => {
if (!newQuery || isStreaming) {
return;
}
triggerSurvey(SurveySurfaceType.TEXT_TO_SQL, {
question: commandKwargs.question,
tables,
query: newQuery,
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [newQuery, triggerSurvey, isStreaming]);

const handleAccept = useCallback(() => {
onAccept(newQuery);
trackClick({
Expand Down

0 comments on commit b8d9a95

Please sign in to comment.