mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-30 20:49:21 +08:00
Feat: Store the dialogue reasoning level on the client side. (#17530)
### Summary Feat: Store the dialogue reasoning level on the client side.
This commit is contained in:
@@ -19,6 +19,7 @@ import * as React from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toast } from 'sonner';
|
||||
import storage from '@/utils/authorization-util';
|
||||
import { SelectWithSearch } from '../originui/select-with-search';
|
||||
import { AudioButton } from '../ui/audio-button';
|
||||
|
||||
@@ -73,7 +74,9 @@ export function NextMessageInput({
|
||||
null,
|
||||
);
|
||||
|
||||
const [enableThinking, setEnableThinking] = useState('1');
|
||||
const [enableThinking, setEnableThinking] = useState(
|
||||
() => storage.getThinkingLevel(),
|
||||
);
|
||||
const [enableInternet, setEnableInternet] = useState(false);
|
||||
|
||||
const thinkingOptions = useMemo(
|
||||
@@ -105,6 +108,7 @@ export function NextMessageInput({
|
||||
|
||||
const handleThinkingChange = useCallback((value: string) => {
|
||||
setEnableThinking(value);
|
||||
storage.setThinkingLevel(value);
|
||||
}, []);
|
||||
|
||||
const handleInternetToggle = useCallback(() => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export const Authorization = 'Authorization';
|
||||
export const Token = 'token';
|
||||
export const UserInfo = 'userInfo';
|
||||
export const ThinkingLevel = 'thinkingLevel';
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { Authorization, Token, UserInfo } from '@/constants/authorization';
|
||||
import {
|
||||
Authorization,
|
||||
ThinkingLevel,
|
||||
Token,
|
||||
UserInfo,
|
||||
} from '@/constants/authorization';
|
||||
import { getSearchValue } from './common-util';
|
||||
const KeySet = [Authorization, Token, UserInfo];
|
||||
|
||||
@@ -45,6 +50,12 @@ const storage = {
|
||||
getLanguage: (): string => {
|
||||
return localStorage.getItem('lng') as string;
|
||||
},
|
||||
setThinkingLevel: (level: string) => {
|
||||
localStorage.setItem(ThinkingLevel, level);
|
||||
},
|
||||
getThinkingLevel: (): string => {
|
||||
return localStorage.getItem(ThinkingLevel) || '1';
|
||||
},
|
||||
};
|
||||
|
||||
export const getAuthorization = () => {
|
||||
|
||||
Reference in New Issue
Block a user