Skip to content

Commit 0de6235

Browse files
committed
feat: add tip for large source data
1 parent a5c9bd8 commit 0de6235

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

src/client/components/ai/AIResponseItem.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import {
2626
import { get, map } from 'lodash-es';
2727
import { SimpleVirtualList } from '../SimpleVirtualList';
2828
import { globalEventBus } from '@/utils/event';
29+
import { SimpleTooltip } from '../ui/tooltip';
30+
import { LuTriangleAlert } from 'react-icons/lu';
2931

3032
type AskForConfirmationInput = { message: string };
3133

@@ -219,7 +221,7 @@ export const AIResponseItem: React.FC<AIResponseItemProps> = React.memo(
219221
</ToolContent>
220222
</Tool>
221223
{available && (
222-
<div>
224+
<div className="flex items-center gap-2">
223225
<Button
224226
size="sm"
225227
onClick={() => {
@@ -241,6 +243,17 @@ export const AIResponseItem: React.FC<AIResponseItemProps> = React.memo(
241243
>
242244
{t('Create Chart')}
243245
</Button>
246+
{Array.isArray(output) && output.length >= 1000 && (
247+
<SimpleTooltip
248+
content={t(
249+
'The result contains more than 1000 records. Only partial data may be displayed. Consider optimizing your query for better performance.'
250+
)}
251+
>
252+
<div>
253+
<LuTriangleAlert className="h-4 w-4 text-yellow-500" />
254+
</div>
255+
</SimpleTooltip>
256+
)}
244257
</div>
245258
)}
246259
</>

src/client/components/insights/WarehouseChartBlock.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import React, { useMemo, useState } from 'react';
22
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
33
import { Button } from '@/components/ui/button';
4-
import { LuTrash2, LuEye, LuEyeOff } from 'react-icons/lu';
4+
import {
5+
SimpleTooltip,
6+
Tooltip,
7+
TooltipContent,
8+
TooltipProvider,
9+
TooltipTrigger,
10+
} from '@/components/ui/tooltip';
11+
import { LuTrash2, LuEye, LuEyeOff, LuTriangleAlert } from 'react-icons/lu';
512
import {
613
Table,
714
TableBody,
@@ -66,7 +73,20 @@ export const WarehouseChartBlock: React.FC<WarehouseChartBlockProps> =
6673
</div>
6774
<div className="border-t border-zinc-200 px-3 py-2 dark:border-zinc-800">
6875
<div className="flex items-center justify-between">
69-
<div className="text-sm font-medium">{t('Source Data')}</div>
76+
<div className="flex items-center gap-2">
77+
<div className="text-sm font-medium">{t('Source Data')}</div>
78+
{data.length >= 1000 && (
79+
<SimpleTooltip
80+
content={t(
81+
'The result contains more than 1000 records. Only partial data may be displayed. Consider optimizing your query for better performance.'
82+
)}
83+
>
84+
<div>
85+
<LuTriangleAlert className="h-4 w-4 text-yellow-500" />
86+
</div>
87+
</SimpleTooltip>
88+
)}
89+
</div>
7090
<Button
7191
size="icon"
7292
variant="ghost"

0 commit comments

Comments
 (0)