Fix: Fixed the issue where the thinking mode on the chat page could not be turned off #9789 (#9794)

### What problem does this PR solve?

Fix: Fixed the issue where the thinking mode on the chat page could not
be turned off #9789

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-08-28 17:33:27 +08:00
committed by GitHub
parent 0a954d720a
commit a246949b77
9 changed files with 28 additions and 52 deletions

View File

@ -102,8 +102,8 @@ export function LlmSettingFieldItems({
control={form.control} control={form.control}
name={'parameter'} name={'parameter'}
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem className="flex justify-between items-center">
<FormLabel>{t('freedom')}</FormLabel> <FormLabel className="flex-1">{t('freedom')}</FormLabel>
<FormControl> <FormControl>
<Select <Select
{...field} {...field}
@ -112,7 +112,7 @@ export function LlmSettingFieldItems({
field.onChange(val); field.onChange(val);
}} }}
> >
<SelectTrigger> <SelectTrigger className="flex-1 !m-0">
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>

View File

@ -30,7 +30,6 @@
.messageTextDark { .messageTextDark {
.chunkText(); .chunkText();
.messageTextBase(); .messageTextBase();
background-color: #1668dc;
word-break: break-word; word-break: break-word;
:global(section.think) { :global(section.think) {
color: rgb(166, 166, 166); color: rgb(166, 166, 166);

View File

@ -10,6 +10,8 @@ export interface PromptConfig {
keyword: boolean; keyword: boolean;
refine_multiturn: boolean; refine_multiturn: boolean;
use_kg: boolean; use_kg: boolean;
reasoning?: boolean;
cross_languages?: Array<string>;
} }
export interface Parameter { export interface Parameter {

View File

@ -13,13 +13,6 @@ import {
FormMessage, FormMessage,
} from '@/components/ui/form'; } from '@/components/ui/form';
import { Input } from '@/components/ui/input'; import { Input } from '@/components/ui/input';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
import { Textarea } from '@/components/ui/textarea'; import { Textarea } from '@/components/ui/textarea';
import { useTranslate } from '@/hooks/common-hooks'; import { useTranslate } from '@/hooks/common-hooks';
import { useFormContext } from 'react-hook-form'; import { useFormContext } from 'react-hook-form';
@ -28,17 +21,6 @@ export default function ChatBasicSetting() {
const { t } = useTranslate('chat'); const { t } = useTranslate('chat');
const form = useFormContext(); const form = useFormContext();
const languageOptions = [
{ value: 'English', label: 'English' },
{ value: 'Chinese', label: 'Chinese' },
{ value: 'Spanish', label: 'Spanish' },
{ value: 'French', label: 'French' },
{ value: 'German', label: 'German' },
{ value: 'Japanese', label: 'Japanese' },
{ value: 'Korean', label: 'Korean' },
{ value: 'Vietnamese', label: 'Vietnamese' },
];
return ( return (
<div className="space-y-8"> <div className="space-y-8">
<FormField <FormField
@ -69,30 +51,6 @@ export default function ChatBasicSetting() {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="language"
render={({ field }) => (
<FormItem>
<FormLabel>{t('language')}</FormLabel>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<FormControl>
<SelectTrigger>
<SelectValue placeholder={t('common.languagePlaceholder')} />
</SelectTrigger>
</FormControl>
<SelectContent>
{languageOptions.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
<FormField <FormField
control={form.control} control={form.control}
name="description" name="description"

View File

@ -1,5 +1,6 @@
'use client'; 'use client';
import { CrossLanguageFormField } from '@/components/cross-language-form-field';
import { RerankFormFields } from '@/components/rerank'; import { RerankFormFields } from '@/components/rerank';
import { SimilaritySliderFormField } from '@/components/similarity-slider'; import { SimilaritySliderFormField } from '@/components/similarity-slider';
import { SwitchFormField } from '@/components/switch-fom-field'; import { SwitchFormField } from '@/components/switch-fom-field';
@ -30,7 +31,7 @@ export function ChatPromptEngine() {
<FormItem> <FormItem>
<FormLabel>{t('system')}</FormLabel> <FormLabel>{t('system')}</FormLabel>
<FormControl> <FormControl>
<Textarea {...field} /> <Textarea {...field} rows={8} />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@ -43,7 +44,13 @@ export function ChatPromptEngine() {
label={t('multiTurn')} label={t('multiTurn')}
></SwitchFormField> ></SwitchFormField>
<UseKnowledgeGraphFormField name="prompt_config.use_kg"></UseKnowledgeGraphFormField> <UseKnowledgeGraphFormField name="prompt_config.use_kg"></UseKnowledgeGraphFormField>
<SwitchFormField
name={'prompt_config.reasoning'}
label={t('reasoning')}
tooltip={t('reasoningTip')}
></SwitchFormField>
<RerankFormFields></RerankFormFields> <RerankFormFields></RerankFormFields>
<CrossLanguageFormField></CrossLanguageFormField>
<DynamicVariableForm></DynamicVariableForm> <DynamicVariableForm></DynamicVariableForm>
</div> </div>
); );

View File

@ -36,7 +36,6 @@ export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) {
defaultValues: { defaultValues: {
name: '', name: '',
icon: '', icon: '',
language: 'English',
description: '', description: '',
kb_ids: [], kb_ids: [],
prompt_config: { prompt_config: {
@ -47,6 +46,8 @@ export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) {
refine_multiturn: true, refine_multiturn: true,
system: '', system: '',
parameters: [], parameters: [],
reasoning: false,
cross_languages: [],
}, },
top_n: 8, top_n: 8,
vector_similarity_weight: 0.2, vector_similarity_weight: 0.2,

View File

@ -41,6 +41,11 @@ export function DynamicVariableForm() {
<Plus /> <Plus />
</Button> </Button>
</div> </div>
<div className="flex gap-2 pr-12 text-text-secondary text-xs">
<span className="flex-1">Key</span>
<span className="w-3"></span>
<span className="flex-1">Optional</span>
</div>
<div className="space-y-5"> <div className="space-y-5">
{fields.map((field, index) => { {fields.map((field, index) => {
const typeField = `${name}.${index}.key`; const typeField = `${name}.${index}.key`;

View File

@ -28,14 +28,13 @@ export function useChatSettingSchema() {
}), }),
), ),
tavily_api_key: z.string().optional(), tavily_api_key: z.string().optional(),
reasoning: z.boolean().optional(),
cross_languages: z.array(z.string()).optional(),
}); });
const formSchema = z.object({ const formSchema = z.object({
name: z.string().min(1, { message: t('assistantNameMessage') }), name: z.string().min(1, { message: t('assistantNameMessage') }),
icon: z.string(), icon: z.string(),
language: z.string().min(1, {
message: t('languageMessage'),
}),
description: z.string().optional(), description: z.string().optional(),
kb_ids: z.array(z.string()).min(0, { kb_ids: z.array(z.string()).min(0, {
message: t('knowledgeBasesMessage'), message: t('knowledgeBasesMessage'),

View File

@ -70,7 +70,12 @@ export function Sessions({
/> />
</section> </section>
<div className="flex justify-between items-center mb-4 pt-10"> <div className="flex justify-between items-center mb-4 pt-10">
<div className="flex items-center gap-3">
<span className="text-base font-bold">Conversations</span> <span className="text-base font-bold">Conversations</span>
<span className="text-text-secondary text-xs">
{conversationList.length}
</span>
</div>
<Button variant={'ghost'} onClick={addTemporaryConversation}> <Button variant={'ghost'} onClick={addTemporaryConversation}>
<Plus></Plus> <Plus></Plus>
</Button> </Button>