Refactor AssistantPage to remove unused labels and enhance component flexibility
Removed labels from TextAreaField and SelectField components in AssistantPage to streamline the interface. Updated the components to conditionally render labels, improving layout flexibility and user experience. This change simplifies the form fields while maintaining functionality.
This commit is contained in:
@@ -787,7 +787,6 @@ export function AssistantPage() {
|
||||
description="描述助手的角色、能力和回答要求"
|
||||
>
|
||||
<TextAreaField
|
||||
label="提示词"
|
||||
value={form.prompt}
|
||||
onChange={(value) => updateForm("prompt", value)}
|
||||
placeholder="请输入提示词,描述助手的角色、能力和回答要求"
|
||||
@@ -827,7 +826,6 @@ export function AssistantPage() {
|
||||
description="当前模式下 ASR 与 TTS 由 Realtime 模型内置完成"
|
||||
>
|
||||
<SelectField
|
||||
label="Realtime 模型"
|
||||
value={form.realtimeModel}
|
||||
onChange={(value) => updateForm("realtimeModel", value)}
|
||||
options={["gpt-realtime-2", "gpt-realtime", "gpt-4o-realtime-preview"]}
|
||||
@@ -841,7 +839,6 @@ export function AssistantPage() {
|
||||
description="助手与用户首次对话时的开场语"
|
||||
>
|
||||
<TextAreaField
|
||||
label="开场白"
|
||||
value={form.greeting}
|
||||
onChange={(value) => updateForm("greeting", value)}
|
||||
placeholder="请输入助手开场白"
|
||||
@@ -854,7 +851,6 @@ export function AssistantPage() {
|
||||
description="选择助手回答时可检索的业务知识来源"
|
||||
>
|
||||
<SelectField
|
||||
label="知识库"
|
||||
value={form.knowledgeBase}
|
||||
onChange={(value) => updateForm("knowledgeBase", value)}
|
||||
options={["无", "政务政策知识库", "售后知识库", "教育课程知识库", "医疗问答知识库"]}
|
||||
@@ -1130,7 +1126,7 @@ function TextAreaField({
|
||||
rows = 4,
|
||||
onChange,
|
||||
}: {
|
||||
label: string;
|
||||
label?: string;
|
||||
value: string;
|
||||
placeholder?: string;
|
||||
rows?: number;
|
||||
@@ -1138,7 +1134,9 @@ function TextAreaField({
|
||||
}) {
|
||||
return (
|
||||
<label className="block">
|
||||
<div className="mb-2 text-sm font-medium text-foreground">{label}</div>
|
||||
{label && (
|
||||
<div className="mb-2 text-sm font-medium text-foreground">{label}</div>
|
||||
)}
|
||||
<Textarea
|
||||
value={value}
|
||||
placeholder={placeholder}
|
||||
@@ -1156,18 +1154,20 @@ function SelectField({
|
||||
options,
|
||||
onChange,
|
||||
}: {
|
||||
label: string;
|
||||
label?: string;
|
||||
value: string;
|
||||
options: string[];
|
||||
onChange: (value: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="block">
|
||||
<div className="mb-2 text-sm font-medium text-foreground">{label}</div>
|
||||
{label && (
|
||||
<div className="mb-2 text-sm font-medium text-foreground">{label}</div>
|
||||
)}
|
||||
|
||||
<Select value={value} onValueChange={onChange}>
|
||||
<SelectTrigger className="w-full border-hairline-strong bg-background text-foreground">
|
||||
<SelectValue placeholder={`请选择${label}`} />
|
||||
<SelectValue placeholder={label ? `请选择${label}` : "请选择"} />
|
||||
</SelectTrigger>
|
||||
|
||||
<SelectContent className="border-hairline bg-popover text-popover-foreground">
|
||||
|
||||
Reference in New Issue
Block a user