mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
♻️ refactor: some code optimization
This commit is contained in:
@@ -257,7 +257,7 @@
|
||||
"settingOpening": {
|
||||
"openingMessage": {
|
||||
"desc": "打开会话时的开场消息,用来介绍助手的功能",
|
||||
"placeholder": "你好,我是 自定义助手,你可以立即与我开始对话,也可以前往 助手设置 完善我的信息。",
|
||||
"placeholder": "你好,我是自定义助手。你可以立即与我开始对话,也可以前往助手设置完善我的信息。",
|
||||
"title": "开场消息"
|
||||
},
|
||||
"openingQuestions": {
|
||||
|
||||
@@ -29,7 +29,6 @@ const useStyles = createStyles(({ css, token }) => ({
|
||||
width: 100%;
|
||||
margin-block-start: 16px;
|
||||
`,
|
||||
|
||||
repeatError: css`
|
||||
margin: 0;
|
||||
color: ${token.colorErrorText};
|
||||
|
||||
@@ -6,9 +6,9 @@ import { Store } from './action';
|
||||
const chatConfig = (s: Store): LobeAgentChatConfig =>
|
||||
s.config.chatConfig || DEFAULT_AGENT_CHAT_CONFIG;
|
||||
|
||||
const DEFAULT_OPENING_QUESTIONS: string[] = [];
|
||||
export const DEFAULT_OPENING_QUESTIONS: string[] = [];
|
||||
export const selectors = {
|
||||
chatConfig,
|
||||
openingMessage: (s: Store) => s.config.openingMessage,
|
||||
openingQuestions: (s: Store) => s.config.openingQuestions ?? DEFAULT_OPENING_QUESTIONS,
|
||||
openingQuestions: (s: Store) => s.config.openingQuestions || DEFAULT_OPENING_QUESTIONS,
|
||||
};
|
||||
|
||||
@@ -259,8 +259,7 @@ export default {
|
||||
settingOpening: {
|
||||
openingMessage: {
|
||||
desc: '打开会话时的开场消息,用来介绍助手的功能',
|
||||
placeholder:
|
||||
'你好,我是 自定义助手,你可以立即与我开始对话,也可以前往 助手设置 完善我的信息。',
|
||||
placeholder: '你好,我是自定义助手。你可以立即与我开始对话,也可以前往助手设置完善我的信息。',
|
||||
title: '开场消息',
|
||||
},
|
||||
openingQuestions: {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
DEFAULT_PROVIDER,
|
||||
DEFAUTT_AGENT_TTS_CONFIG,
|
||||
} from '@/const/settings';
|
||||
import { DEFAULT_OPENING_QUESTIONS } from '@/features/AgentSetting/store/selectors';
|
||||
import { AgentStoreState } from '@/store/agent/initialState';
|
||||
import { LobeAgentConfig, LobeAgentTTSConfig } from '@/types/agent';
|
||||
import { KnowledgeItem, KnowledgeType } from '@/types/knowledgeBase';
|
||||
@@ -138,7 +139,8 @@ const currentKnowledgeIds = (s: AgentStoreState) => {
|
||||
|
||||
const isAgentConfigLoading = (s: AgentStoreState) => !s.agentConfigInitMap[s.activeId];
|
||||
|
||||
const openingQuestions = (s: AgentStoreState) => currentAgentConfig(s).openingQuestions || [];
|
||||
const openingQuestions = (s: AgentStoreState) =>
|
||||
currentAgentConfig(s).openingQuestions || DEFAULT_OPENING_QUESTIONS;
|
||||
const openingMessage = (s: AgentStoreState) => currentAgentConfig(s).openingMessage || '';
|
||||
|
||||
export const agentSelectors = {
|
||||
|
||||
Reference in New Issue
Block a user