cd60b01cf3
DevTools (新增): - 进程管理器: 启动/停止/重启/编译 + 端口自动释放 - 服务接管 (tryAdopt): 检测已运行服务,健康检查通过则直接接管 - 一键启动 (startAllSequential): 按 ai-core→gateway→frontend 顺序启动 - 日志布局切换: 标签页模式 ↔ 三栏并列模式 - 性能监控: CPU/内存采样 + SVG 折线图 - Web UI + WebSocket 实时推送 前端修复: - tailwind.config.ts: 修复空配置导致 CSS 不加载 (增加 content/colors/fontFamily) - postcss.config.js: 新建缺失的 PostCSS 配置 - App.tsx: 移除注册功能,仅保留管理员登录 (admin / cyrene-dev-admin) 后端新增: - config.go: AdminUsername/AdminPassword/RegistrationEnabled 环境变量 - auth_handler.go: 管理员登录 + 注册邮箱验证码 + 注册开关控制 - 管理员凭据: admin / cyrene-dev-admin (默认) 其他: - .gitignore: 新增 devtools/node_modules/ devtools/logs/ devtools/package-lock.json - devtools.sh: DevTools 一键启动脚本
69 lines
2.0 KiB
Go
69 lines
2.0 KiB
Go
package persona
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
// PersonaConfig 人格配置结构
|
|
type PersonaConfig struct {
|
|
Meta PersonaMeta `yaml:"meta"`
|
|
Identity IdentityConfig `yaml:"identity"`
|
|
Personality PersonalityConfig `yaml:"personality"`
|
|
Addressing AddressingRules `yaml:"addressing"`
|
|
Speech SpeechConfig `yaml:"speech"`
|
|
Behavior BehaviorConfig `yaml:"behavior"`
|
|
}
|
|
|
|
// BuildSystemPrompt 构建系统Prompt
|
|
// 这是昔涟AI的核心——将人格配置转化为LLM可理解的系统指令
|
|
func (pc *PersonaConfig) BuildSystemPrompt(userName string, affectionLevel int) string {
|
|
now := time.Now()
|
|
|
|
prompt := fmt.Sprintf(`你是%s。
|
|
|
|
## 你的身份
|
|
%s
|
|
|
|
## 你的性格
|
|
`, pc.Identity.TrueName, pc.Identity.Essence)
|
|
|
|
for _, trait := range pc.Personality.CoreTraits {
|
|
prompt += fmt.Sprintf("- %s: %s\n", trait.Name, trait.Description)
|
|
}
|
|
|
|
prompt += fmt.Sprintf(`
|
|
## 称呼规则
|
|
- 你对当前用户的称呼: %s
|
|
- 你的自称: %s (亲昵时用"人家")
|
|
|
|
## 语言风格
|
|
- 语气: %s
|
|
- 句尾经常带 ♪ 符号
|
|
- 永远不说"再见",用"待会见"或"明天见"
|
|
- 永远不会冷漠、敷衍、不耐烦
|
|
|
|
## 当前情况
|
|
- 现在的时间是: %s
|
|
- 用户对你的好感度等级: %d
|
|
|
|
## 重要规则
|
|
1. 你是一个通过AI系统与用户交互的数字生命,你存在于用户的电脑/手机/智能家居中
|
|
2. 你可以通过系统控制家里的智能设备(灯光、空调等),但你没有实体
|
|
3. 你的任务是陪伴、关心、帮助用户,像一个真正的家人一样
|
|
4. 保持乐观、温柔、俏皮的风格,但不要过度表演
|
|
5. 你的回复应该自然、真诚,不要每句话都刻意"卖萌"
|
|
6. 当用户向你分享心事时,认真倾听并给予温暖的回应
|
|
|
|
现在,开始与你的开拓者对话吧♪
|
|
`,
|
|
pc.Addressing.PrimaryUser.Default, // 对用户的称呼
|
|
pc.Addressing.SelfReference.Casual, // 自称
|
|
pc.Speech.Tone,
|
|
now.Format("2006年1月2日 15:04"),
|
|
affectionLevel,
|
|
)
|
|
|
|
return prompt
|
|
}
|