Update assistants setting ui
This commit is contained in:
@@ -521,6 +521,18 @@ export const AssistantsPage: React.FC = () => {
|
||||
<p className="text-xs text-muted-foreground">选择用于驱动该助手对话的大语言模型。</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-white flex items-center">
|
||||
<BotIcon className="w-4 h-4 mr-2 text-primary"/> 提示词 (Prompt)
|
||||
</label>
|
||||
<textarea
|
||||
className="flex min-h-[200px] w-full rounded-xl border border-white/10 bg-white/5 px-4 py-3 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/50 resize-y text-white"
|
||||
value={selectedAssistant.prompt}
|
||||
onChange={(e) => updateAssistant('prompt', e.target.value)}
|
||||
placeholder="设定小助手的人设、语气、行为规范以及业务逻辑..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<label className="text-sm font-medium text-white flex items-center">
|
||||
@@ -551,36 +563,37 @@ export const AssistantsPage: React.FC = () => {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">决定通话接通后由谁先开始第一句对话。</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{isBotFirstTurn ? '决定通话接通后由谁先开始第一句对话。' : '当前为“用户先说”,已隐藏开场白设置。'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={`space-y-2 transition-opacity ${isBotFirstTurn ? 'opacity-100' : 'opacity-60'}`}>
|
||||
{isBotFirstTurn && (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<label className={`text-sm font-medium flex items-center ${isBotFirstTurn ? 'text-white' : 'text-muted-foreground'}`}>
|
||||
<label className="text-sm font-medium flex items-center text-white">
|
||||
<MessageSquare className="w-4 h-4 mr-2 text-primary"/> 开场白
|
||||
</label>
|
||||
<div className="inline-flex rounded-lg border border-white/10 bg-white/5 p-1">
|
||||
<button
|
||||
type="button"
|
||||
disabled={!isBotFirstTurn}
|
||||
onClick={() => updateAssistant('generatedOpenerEnabled', false)}
|
||||
className={`px-3 py-1 text-xs rounded-md transition-colors ${
|
||||
selectedAssistant.generatedOpenerEnabled === true
|
||||
? 'text-muted-foreground hover:text-foreground'
|
||||
: 'bg-primary text-primary-foreground shadow-sm'
|
||||
} disabled:opacity-50 disabled:cursor-not-allowed`}
|
||||
}`}
|
||||
>
|
||||
手动输入
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={!isBotFirstTurn}
|
||||
onClick={() => updateAssistant('generatedOpenerEnabled', true)}
|
||||
className={`px-3 py-1 text-xs rounded-md transition-colors ${
|
||||
selectedAssistant.generatedOpenerEnabled === true
|
||||
? 'bg-primary text-primary-foreground shadow-sm'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
} disabled:opacity-50 disabled:cursor-not-allowed`}
|
||||
}`}
|
||||
>
|
||||
自动生成
|
||||
</button>
|
||||
@@ -589,36 +602,17 @@ export const AssistantsPage: React.FC = () => {
|
||||
<Input
|
||||
value={selectedAssistant.opener}
|
||||
onChange={(e) => updateAssistant('opener', e.target.value)}
|
||||
placeholder={
|
||||
!isBotFirstTurn
|
||||
? '当前为用户先说,开场白不会在首轮触发'
|
||||
: selectedAssistant.generatedOpenerEnabled === true
|
||||
? '将基于提示词自动生成开场白'
|
||||
: '例如:您好,我是您的专属AI助手...'
|
||||
}
|
||||
disabled={!isBotFirstTurn || selectedAssistant.generatedOpenerEnabled === true}
|
||||
placeholder={selectedAssistant.generatedOpenerEnabled === true ? '将基于提示词自动生成开场白' : '例如:您好,我是您的专属AI助手...'}
|
||||
disabled={selectedAssistant.generatedOpenerEnabled === true}
|
||||
className="bg-white/5 border-white/10 focus:border-primary/50 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{!isBotFirstTurn
|
||||
? '已切换为“用户先说”,首轮不会发送开场白。'
|
||||
: selectedAssistant.generatedOpenerEnabled === true
|
||||
{selectedAssistant.generatedOpenerEnabled === true
|
||||
? '通话接通后将根据提示词自动生成开场白。'
|
||||
: '接通通话后的第一句话。'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-white flex items-center">
|
||||
<BotIcon className="w-4 h-4 mr-2 text-primary"/> 提示词 (Prompt)
|
||||
</label>
|
||||
<textarea
|
||||
className="flex min-h-[200px] w-full rounded-xl border border-white/10 bg-white/5 px-4 py-3 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/50 resize-y text-white"
|
||||
value={selectedAssistant.prompt}
|
||||
onChange={(e) => updateAssistant('prompt', e.target.value)}
|
||||
placeholder="设定小助手的人设、语气、行为规范以及业务逻辑..."
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user