mirror of
https://github.com/csunny/DB-GPT.git
synced 2026-07-16 17:15:22 +00:00
feat:add ask_question tool
This commit is contained in:
@@ -104,6 +104,8 @@ export const ChatEn = {
|
||||
step_type_other: 'Action',
|
||||
waiting_for_user: 'Waiting for User',
|
||||
user_confirmation: 'Needs your confirmation',
|
||||
confirm: 'Confirm',
|
||||
or_input_custom: 'Or enter a custom answer...',
|
||||
file_type_spreadsheet: 'Spreadsheet',
|
||||
file_type_pdf: 'PDF',
|
||||
file_type_image: 'Image',
|
||||
|
||||
@@ -112,6 +112,8 @@ export const ChatZh: Resources['translation'] = {
|
||||
step_type_other: '操作',
|
||||
waiting_for_user: '等待用户回答',
|
||||
user_confirmation: '需要您的确认',
|
||||
confirm: '确认',
|
||||
or_input_custom: '或输入自定义答案...',
|
||||
file_type_spreadsheet: '电子表格',
|
||||
file_type_pdf: 'PDF',
|
||||
file_type_image: '图片',
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import { CheckOutlined, CloseOutlined, QuestionCircleFilled } from '@ant-design/icons';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import type { QuestionInfo } from '@/utils/react-sse-parser';
|
||||
|
||||
@@ -24,6 +25,7 @@ interface QuestionDockProps {
|
||||
}
|
||||
|
||||
const QuestionDock: React.FC<QuestionDockProps> = ({ request, onReply, onReject }) => {
|
||||
const { t } = useTranslation();
|
||||
const [selected, setSelected] = useState<string[][]>(
|
||||
() => request.questions.map(() => []),
|
||||
);
|
||||
@@ -97,13 +99,13 @@ const QuestionDock: React.FC<QuestionDockProps> = ({ request, onReply, onReject
|
||||
<QuestionCircleFilled className='text-[12px] text-amber-500' />
|
||||
</span>
|
||||
<span className='text-sm font-semibold leading-5 tracking-tight'>
|
||||
需要您的确认
|
||||
{t('user_confirmation')}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={handleDismiss}
|
||||
className='flex h-6 w-6 items-center justify-center rounded-md text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-slate-300'
|
||||
title='取消'
|
||||
title={t('cancel')}
|
||||
>
|
||||
<CloseOutlined className='text-[11px]' />
|
||||
</button>
|
||||
@@ -151,7 +153,7 @@ const QuestionDock: React.FC<QuestionDockProps> = ({ request, onReply, onReject
|
||||
<div className='mt-2'>
|
||||
<input
|
||||
type='text'
|
||||
placeholder='或输入自定义答案...'
|
||||
placeholder={t('or_input_custom')}
|
||||
value={customInputs[qi]}
|
||||
onChange={(e) => setCustom(qi, e.target.value)}
|
||||
className='w-full rounded-lg border border-slate-200 bg-white px-3 py-1.5 text-[13px] leading-4 text-slate-700 placeholder-slate-400 outline-none transition-colors focus:border-sky-400 focus:ring-1 focus:ring-sky-400/30 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:placeholder-slate-500 dark:focus:border-sky-500/50'
|
||||
@@ -168,7 +170,7 @@ const QuestionDock: React.FC<QuestionDockProps> = ({ request, onReply, onReject
|
||||
onClick={handleDismiss}
|
||||
className='rounded-lg px-3 py-1.5 text-[13px] text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-white/5'
|
||||
>
|
||||
取消
|
||||
{t('cancel')}
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
@@ -179,7 +181,7 @@ const QuestionDock: React.FC<QuestionDockProps> = ({ request, onReply, onReject
|
||||
: 'cursor-not-allowed bg-slate-100 text-slate-400 dark:bg-white/5 dark:text-slate-600'
|
||||
}`}
|
||||
>
|
||||
确认
|
||||
{t('confirm')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user