♻️ refactor: some code optimization

This commit is contained in:
YuTengjing
2025-04-15 10:28:24 +08:00
parent 27c5b45a0e
commit 47e04fa171
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -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};
+2 -2
View File
@@ -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,
};
+1 -2
View File
@@ -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 = {