mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-16 14:40:56 +00:00
feat(web): Unified frontend code style (#1923)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: 谨欣 <echo.cmy@antgroup.com> Co-authored-by: 严志勇 <yanzhiyong@tiansuixiansheng.com> Co-authored-by: yanzhiyong <932374019@qq.com>
This commit is contained in:
@@ -26,7 +26,7 @@ const RecommendQuestions: React.FC<{
|
||||
|
||||
// 将数据实时返回给消费组件
|
||||
useEffect(() => {
|
||||
updateData(recommendQuestions?.filter((question) => !!question.question));
|
||||
updateData(recommendQuestions?.filter(question => !!question.question));
|
||||
}, [recommendQuestions, updateData]);
|
||||
|
||||
return (
|
||||
@@ -34,22 +34,28 @@ const RecommendQuestions: React.FC<{
|
||||
<Form<FormRecommendQuestion>
|
||||
style={{ width: '100%' }}
|
||||
form={form}
|
||||
initialValues={{ recommend_questions: initValue || [{ question: '', valid: false }] }}
|
||||
autoComplete="off"
|
||||
initialValues={{
|
||||
recommend_questions: initValue || [{ question: '', valid: false }],
|
||||
}}
|
||||
autoComplete='off'
|
||||
wrapperCol={{ span: 20 }}
|
||||
{...(labelCol && { labelCol: { span: 4 } })}
|
||||
>
|
||||
<Form.Item label={t('recommended_questions')}>
|
||||
<Form.List name="recommend_questions">
|
||||
<Form.List name='recommend_questions'>
|
||||
{(fields, { add, remove }) => (
|
||||
<>
|
||||
{fields.map(({ key, name }, index) => (
|
||||
<div key={key} className={cls('flex flex-1 items-center gap-8 mb-6', formStyle)}>
|
||||
<Form.Item label={`${t('question')} ${index + 1}`} name={[name, 'question']} className="grow">
|
||||
<Form.Item label={`${t('question')} ${index + 1}`} name={[name, 'question']} className='grow'>
|
||||
<Input placeholder={t('please_input_recommended_questions')} />
|
||||
</Form.Item>
|
||||
<Form.Item label={t('is_effective')} name={[name, 'valid']}>
|
||||
<Switch style={{ background: recommendQuestions?.[index]?.valid ? '#1677ff' : '#ccc' }} />
|
||||
<Switch
|
||||
style={{
|
||||
background: recommendQuestions?.[index]?.valid ? '#1677ff' : '#ccc',
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<MinusCircleOutlined
|
||||
@@ -62,7 +68,7 @@ const RecommendQuestions: React.FC<{
|
||||
))}
|
||||
<Form.Item className={cls(formStyle)}>
|
||||
<Button
|
||||
type="dashed"
|
||||
type='dashed'
|
||||
onClick={() => {
|
||||
add({ question: '', valid: false });
|
||||
}}
|
||||
|
Reference in New Issue
Block a user