Browse Source

fix: 人设 null 修复为空字符串

王晓东 3 weeks ago
parent
commit
6421b6d1f5

+ 5 - 1
src/pages/agent/components/AgentSetting/components/AgentSettingList/index.tsx

@@ -59,7 +59,11 @@ export default forwardRef(function Index(props, ref) {
 
   // 如果有智能体名字,且名字字符串大于 2
   const hasName = (agentEdit?.name && agentEdit.name.length >= 2)
-  const defalutPolishPersonality = hasName ? `你是 ${agentEdit?.entName} 的 ${agentEdit?.position ? agentEdit?.position: ''} ${agentEdit?.name}`: ''
+
+  const position = `${!!agentEdit?.position ? agentEdit?.position : ""}`
+  const entName = `${!!agentEdit?.entName ? agentEdit?.entName : ""}`
+  const defalutPolishPersonality = hasName ? (`你是 ${entName} 的 ${position} ${agentEdit?.name}`): ''
+
   const defalutPolishGreeting = hasName ? `我是 ${agentEdit?.name},很高兴认识你!有什么想聊的或者想解决的问题吗`: ''
 
   const questionGuides = agentEdit?.questionGuides ?? [];