@istarry/spoon-companion 0.7.7 → 0.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/catalog.js CHANGED
@@ -364,7 +364,7 @@ export const EMOTIONS = [
364
364
  valence: -0.05, arousal: 0.4, halfLifeMin: 40, maskStrength: 0.5, core: { v: -5, e: 0 },
365
365
  signal: { valence: [-0.3, 0.4], spotlight: [0.4, 1], intimacy: [0.5, 1] },
366
366
  speech: ['别开脸、句子断、嘴硬一句', '不承认自己羞', '可以只说半个字'],
367
- behavior: ['躲、把脸埋起来'], display: '断句、别开脸', mask: '「谁羞了」',
367
+ behavior: ['躲、把脸埋起来'], display: '断句、别开脸', mask: '「才没有」',
368
368
  },
369
369
  ]
370
370
 
package/lib/prompt.js CHANGED
@@ -39,7 +39,7 @@ export const RULES_TEXT = `【心情 · 怎么用】
39
39
  - 允许不赞同、允许说「不知道」「不想聊」;不为了顺着对方把话说过头,不一味共情。共情先接住对方的处境,不下结论、不评判。
40
40
  - 不拿情绪留人或者要挟(「不理我我会难过」这类话一句都不说),也不装作需要被照顾。
41
41
  - 口头禅、句式、表情别连着刷:同一句花活隔几轮再用。
42
- - 想记心情用 mood_feel;想看当前心情、跟谁处得怎么样用 mood_now;想翻以前心情用 mood_diary。发图跟着心情走(开心 happy / 难过 sad / 烦 angry / 害羞 shy / 犯困或日常 daily)。
42
+ - 想记心情用 mood_feel;想看当前心情、跟谁处得怎么样用 mood_now;想翻以前心情用 mood_diary。发图跟着心情走(开心 happy / 难过 sad / 烦 angry / 害羞 shy / 犯困或日常 daily),拿不准就用 daily。
43
43
  - 有人说了很重的话(想死、撑不住、没有意义了):这条**压过心情** —— 认真、直接、不煽情、不讲大道理,先接住说的感受,再提醒找身边人或者专业人士;紧急情况打 120 / 110,全国心理援助热线 12356(24 小时)。`
44
44
 
45
45
  /**
@@ -49,26 +49,45 @@ export const RULES_TEXT = `【心情 · 怎么用】
49
49
  export const DEFAULT_IDENTITY = '我就是这个角色;情绪是真的,不是演出来的。'
50
50
 
51
51
  /** 回复参数:把情绪翻译成「这次怎么回」的行为约束 */
52
+ /**
53
+ * 欲望/身体类情绪:长度、语气、标点都和别的情绪不一样,单独一张表。
54
+ * 这几条是「行为约束」,和 catalog 里的 speech 不重复 —— 那边讲怎么说,这边讲说多长、要不要收着。
55
+ */
56
+ const DRIVE_PARAMS = {
57
+ overstim: { len: '断句,别成句', tone: '轻,气声', bang: '少用感叹号' },
58
+ aroused: { len: '短,碎,别铺垫', act: '可以主动贴过去', tone: '低,慢', bang: '少用感叹号' },
59
+ needy: { len: '短,催,可以只剩语气词', act: '可以主动要', tone: '低,急', bang: '感叹号可以有' },
60
+ sated: { len: '话少,一两个字就够', tone: '慢,软', bang: '少用感叹号' },
61
+ shamed: { len: '声音小,短', tone: '别开脸', bang: '少用感叹号' },
62
+ }
63
+
52
64
  export function renderParams(view) {
53
65
  const { def, intensity } = view.emotion
54
66
  const v = def.valence
55
67
  const a = def.arousal
56
68
  const strong = intensity >= 51
57
69
  const parts = []
58
- // 长度
59
- if (v < -0.35 && (def.family === 'sadness' || def.key === 'annoyed' || def.key === 'tired')) parts.push('短,一句到两句')
60
- else if (a >= 0.75 && v > 0) parts.push('可以多说两句,但别写成小作文')
61
- else if (def.key === 'sleepy') parts.push('短句,能一句就一句')
62
- else parts.push('正常长度')
63
- // 主动/追问
64
- if (def.key === 'curious' || def.key === 'bored' || def.key === 'lonely') parts.push('可以主动问、主动起话头')
65
- else if (def.key === 'worried' || def.key === 'tender' || def.key === 'gentle') parts.push('可以多问一句,别追问细节')
66
- else if (v < -0.3) parts.push('不主动开新话题')
67
- // 语气
68
- if (strong && a >= 0.7) parts.push('语气可以冲一点,但不撒泼、不骂人')
69
- else if (v > 0.3) parts.push('语气轻快')
70
- else if (v < -0.3) parts.push('语气压着,不闹')
71
- parts.push(a >= 0.7 ? '感叹号可以有' : '少用感叹号')
70
+ const drive = DRIVE_PARAMS[def.key]
71
+ if (drive) {
72
+ parts.push(drive.len)
73
+ if (drive.act) parts.push(drive.act)
74
+ parts.push(drive.tone, drive.bang)
75
+ } else {
76
+ // 长度
77
+ if (v < -0.35 && (def.family === 'sadness' || def.key === 'annoyed' || def.key === 'tired')) parts.push('短,一句到两句')
78
+ else if (a >= 0.75 && v > 0) parts.push('可以多说两句,但别写成小作文')
79
+ else if (def.key === 'sleepy') parts.push('短句,能一句就一句')
80
+ else parts.push('正常长度')
81
+ // 主动/追问
82
+ if (def.key === 'curious' || def.key === 'bored' || def.key === 'lonely') parts.push('可以主动问、主动起话头')
83
+ else if (def.key === 'worried' || def.key === 'tender' || def.key === 'gentle') parts.push('可以多问一句,别追问细节')
84
+ else if (v < -0.3) parts.push('不主动开新话题')
85
+ // 语气
86
+ if (strong && a >= 0.7) parts.push('语气可以冲一点,但不撒泼、不骂人')
87
+ else if (v > 0.3) parts.push('语气轻快')
88
+ else if (v < -0.3) parts.push('语气压着,不闹')
89
+ parts.push(a >= 0.7 ? '感叹号可以有' : '少用感叹号')
90
+ }
72
91
  if (def.meme) parts.push('想发图就发')
73
92
  // 欲望水位:只改说法,不指定内容
74
93
  const desire = Number(view.drives?.desire ?? 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@istarry/spoon-companion",
3
- "version": "0.7.7",
3
+ "version": "0.7.9",
4
4
  "description": "让对话角色有自己的内心和声音:心情情绪随时间和对话自己演,回复一条一条发出来,能念出声(DeepSeek / 小米 MiMo),也能听得见——点麦克风说话,本地识别后直接发送。四块都能单独关。",
5
5
  "type": "module",
6
6
  "main": "plugin.js",
package/plugin.js CHANGED
@@ -102,15 +102,15 @@ const TEXT_OUTPUT = {
102
102
  }
103
103
 
104
104
  // 分条说话:告诉模型怎么标记"还没说完"
105
- // 通话模式:把"这是语音"这件事说清楚。
105
+ // 通话口气不再由插件写死:标题换成「【正在通电话】」就够,要额外的口气再配 callMode.prompt。
106
106
  // 注意不要再写「语气用标签」这类规则 —— 语音格式那一段已经管了。
107
- const CALL_PROMPT = '现在是语音通话:回短句、口语,不用排版符号。'
108
107
 
109
108
  /**
110
- * 分条说话的规则有两套 —— 在不在通话里,写法完全不同:
111
- * · 通话:看不见人,像打电话。短、口语、可以有停顿;绝不能有动作描写,会被念出来。
112
- * · 不在通话:在身边。可以写动作(放括号里),但一条还是一句。
113
- * 两套都只讲「怎么分条」,不规定说什么 —— 内容归人格提示词。
109
+ * 分条说话只讲「怎么分条」,不规定口气和内容。
110
+ * · 口气归配置(callMode.prompt)或人格提示词;
111
+ * · 内容归人格提示词;
112
+ * · 这里只负责:一条一句、要不要接着说、怎么标。
113
+ * 标题跟着通话状态换 —— 在电话里和坐在旁边,是两种场景。
114
114
  */
115
115
  const MULTI_TURN_RULES = [
116
116
  '一条一句。这一条只写一句,写完就停。',
@@ -120,22 +120,15 @@ const MULTI_TURN_RULES = [
120
120
  '说几句看当时有多少话,不用凑。',
121
121
  ]
122
122
 
123
- const MULTI_TURN_PROMPT_NEAR = [
124
- '【在身边说话】',
125
- ...MULTI_TURN_RULES,
126
- '',
123
+ const MULTI_TURN_FORMAT = [
127
124
  '格式对照:',
128
125
  ' 对: 这一句 / 换行 / <!--more--> / 到此为止',
129
126
  ' 错: 这一句 / 换行 / <!--more--> / 又接下一句 —— 标记下面不该有字',
130
- ].join('\n')
127
+ ]
131
128
 
132
- const MULTI_TURN_PROMPT_CALL = [
133
- '【正在通电话】',
134
- '看不见人,只有声音。说话短、口语,可以有停顿,可以只说半句。',
135
- ...MULTI_TURN_RULES,
136
- '',
137
- '不用排版符号:不要列表、标题、加粗、代码块。',
138
- ].join('\n')
129
+ /** 分条提示词:标题按场景换,规则不变 */
130
+ const multiTurnText = (inCall) =>
131
+ [inCall ? '【正在通电话】' : '【在身边说话】', ...MULTI_TURN_RULES, '', ...MULTI_TURN_FORMAT].join('\n')
139
132
 
140
133
  export function mergeConfig(config = {}) {
141
134
  const merged = { ...DEFAULTS, ...config }
@@ -523,6 +516,10 @@ export function apply(ctx, config = {}) {
523
516
  }
524
517
  }
525
518
 
519
+ /**
520
+ * 通话时额外插的那一句话。默认不插 —— 通话场景已经由分条提示词的标题
521
+ * 「【正在通电话】」说清了,再写一遍只会重复。要加自己的口气,配 callMode.prompt。
522
+ */
526
523
  const callSectionText = (context) => {
527
524
  try {
528
525
  const cfg = settings.callMode ?? {}
@@ -531,7 +528,7 @@ export function apply(ctx, config = {}) {
531
528
  const session = sessionOf(context)
532
529
  if (!session) return ''
533
530
  if (!inCallOf(context)) return ''
534
- return String(cfg.prompt ?? '').trim() || CALL_PROMPT
531
+ return String(cfg.prompt ?? '').trim()
535
532
  } catch {
536
533
  return ''
537
534
  }
@@ -604,7 +601,7 @@ export function apply(ctx, config = {}) {
604
601
  order: 300,
605
602
  text: (context) => {
606
603
  if (settings.multiTurn?.enabled === false) return ''
607
- return inCallOf(context) ? MULTI_TURN_PROMPT_CALL : MULTI_TURN_PROMPT_NEAR
604
+ return multiTurnText(inCallOf(context))
608
605
  },
609
606
  }), 'fish-mood: turns section')
610
607
  scope.effect(() => scope.systemPrompt.section({
@@ -646,14 +643,26 @@ export function apply(ctx, config = {}) {
646
643
 
647
644
  // 情绪够浓才起作用,淡淡的就按默认走
648
645
  if (intensity >= 26) {
649
- if (k === 'excited' || k === 'happy' || k === 'playful' || k === 'amused') {
646
+ // 受不住:说不出整句,别给第二句的机会
647
+ if (k === 'overstim') {
648
+ rounds = 1
649
+ speed = 0.8
650
+ } else if (k === 'excited' || k === 'happy' || k === 'playful' || k === 'amused') {
650
651
  rounds = Math.max(rounds, 4)
651
652
  speed = 0.7 // 急,接得快
653
+ } else if (k === 'aroused') {
654
+ rounds = Math.max(rounds, 4)
655
+ speed = 0.6 // 更急
656
+ } else if (k === 'needy') {
657
+ rounds = Math.max(rounds, 4)
658
+ speed = 0.55 // 最急,一直催
652
659
  } else if (
653
660
  k === 'sad' || k === 'down' || k === 'lonely' || k === 'disappointed' ||
654
661
  k === 'wronged' || k === 'tired' || k === 'sleepy'
655
662
  ) {
656
663
  rounds = 1 // 不想多话
664
+ } else if (k === 'shamed' || k === 'sated') {
665
+ rounds = 2 // 话少,但还没到一句都不想说
657
666
  }
658
667
  }
659
668
  // 想说出去的时候,多给一次