设置界面优化

This commit is contained in:
IndieKKY
2024-05-27 09:02:21 +08:00
parent 19553de975
commit be97b1d51a

View File

@@ -282,28 +282,6 @@ const Settings = () => {
</div> </div>
</Section>} </Section>}
<Section title='提示词配置'>
{PROMPT_TYPES.map((item, idx) => <FormItem key={item.type} title={<div>
<div>{item.name}</div>
<div className='link text-xs' onClick={() => {
setPromptsValue({
...promptsValue,
// @ts-expect-error
[item.type]: PROMPT_DEFAULTS[item.type] ?? ''
})
}}>
</div>
</div>} htmlFor={`prompt-${item.type}`}>
<textarea id={`prompt-${item.type}`} className='mt-2 textarea input-bordered w-full'
placeholder='留空使用默认提示词' value={promptsValue[item.type] ?? ''} onChange={(e) => {
setPromptsValue({
...promptsValue,
[item.type]: e.target.value
})
}}/>
</FormItem>)}
</Section>
<Section title={<div className='flex items-center'> <Section title={<div className='flex items-center'>
{!apiKeySetted && <div className='tooltip tooltip-right ml-1' data-tip='未设置ApiKey无法使用'> {!apiKeySetted && <div className='tooltip tooltip-right ml-1' data-tip='未设置ApiKey无法使用'>
@@ -393,6 +371,32 @@ const Settings = () => {
onChange={setAskEnabledValue}/> onChange={setAskEnabledValue}/>
</FormItem> </FormItem>
</Section> </Section>
<Section title='提示词配置'>
<div className='flex justify-center'>
<a className='text-xs link link-primary' onClick={togglePromptsFold}>{promptsFold ? '展开' : '折叠'}</a>
</div>
{!promptsFold && PROMPT_TYPES.map((item, idx) => <FormItem key={item.type} title={<div>
<div>{item.name}</div>
<div className='link text-xs' onClick={() => {
setPromptsValue({
...promptsValue,
// @ts-expect-error
[item.type]: PROMPT_DEFAULTS[item.type] ?? ''
})
}}>
</div>
</div>} htmlFor={`prompt-${item.type}`}>
<textarea id={`prompt-${item.type}`} className='mt-2 textarea input-bordered w-full'
placeholder='留空使用默认提示词' value={promptsValue[item.type] ?? ''} onChange={(e) => {
setPromptsValue({
...promptsValue,
[item.type]: e.target.value
})
}}/>
</FormItem>)}
</Section>
<div className='flex justify-center gap-5'> <div className='flex justify-center gap-5'>
<button className='btn btn-primary btn-sm' onClick={onSave}></button> <button className='btn btn-primary btn-sm' onClick={onSave}></button>
<button className='btn btn-sm' onClick={onCancel}></button> <button className='btn btn-sm' onClick={onCancel}></button>