@istarry/spoon-companion 0.9.4 → 0.9.5
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/client.js +33 -6
- package/lib/state.js +3 -1
- package/package.json +1 -1
- package/plugin.js +2 -2
package/lib/client.js
CHANGED
|
@@ -835,8 +835,8 @@ function SpeakerButton(props) {
|
|
|
835
835
|
}
|
|
836
836
|
);
|
|
837
837
|
}
|
|
838
|
-
function SettingsRow() {
|
|
839
|
-
const [open, setOpen] = (0, import_react.useState)(
|
|
838
|
+
function SettingsRow({ defaultOpen = false } = {}) {
|
|
839
|
+
const [open, setOpen] = (0, import_react.useState)(defaultOpen);
|
|
840
840
|
const [state, setState] = (0, import_react.useState)(void 0);
|
|
841
841
|
const [busy, setBusy] = (0, import_react.useState)("");
|
|
842
842
|
const [msg, setMsg] = (0, import_react.useState)("");
|
|
@@ -1176,10 +1176,6 @@ function apply(ctx) {
|
|
|
1176
1176
|
"conversation.chat.assistant-actions",
|
|
1177
1177
|
() => ctx.slots.register({ name: "conversation.chat.assistant-actions", id: "companion-voice-speak", order: 40 }, SpeakerButton)
|
|
1178
1178
|
);
|
|
1179
|
-
ctx.slots.inject(
|
|
1180
|
-
"settings.general.item",
|
|
1181
|
-
() => ctx.slots.register({ name: "settings.general.item", id: "companion-voice-settings", order: 40 }, SettingsRow)
|
|
1182
|
-
);
|
|
1183
1179
|
}
|
|
1184
1180
|
|
|
1185
1181
|
// src/client/mic.tsx
|
|
@@ -1701,6 +1697,37 @@ function ScreenSettingsSection() {
|
|
|
1701
1697
|
] }) : null
|
|
1702
1698
|
] })
|
|
1703
1699
|
] }),
|
|
1700
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: group, children: [
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: rowTitle, children: "\u4E3B\u52A8\u8BF4" }),
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: hint, children: "\u547D\u4E2D\u300C\u503C\u5F97\u8BF4\u300D\u7684\u94A9\u5B50\u65F6\uFF1A\u5173 = \u53EA\u770B\u4E0D\u8BF4\uFF1B\u6512\u7740 = \u7559\u4E0B\u4E00\u6761\u51B2\u52A8\uFF0C\u7B49\u4E0B\u6B21\u5F00\u53E3\u5E26\u51FA\u6765\uFF1B\u76F4\u63A5\u8BF4 = \u5F00\u4E00\u4E2A\u65B0\u7A97\u53E3\u8BF4\u4E00\u53E5\u3002" }),
|
|
1703
|
+
cfg ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: [
|
|
1704
|
+
["never", "\u53EA\u770B\u4E0D\u8BF4"],
|
|
1705
|
+
["urge", "\u6512\u7740"],
|
|
1706
|
+
["always", "\u76F4\u63A5\u8BF4"]
|
|
1707
|
+
].map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1708
|
+
"button",
|
|
1709
|
+
{
|
|
1710
|
+
type: "button",
|
|
1711
|
+
disabled: busy,
|
|
1712
|
+
onClick: () => void save({ speak: value }),
|
|
1713
|
+
style: {
|
|
1714
|
+
padding: "4px 12px",
|
|
1715
|
+
borderRadius: 8,
|
|
1716
|
+
border: "1px solid rgba(128,128,128,0.35)",
|
|
1717
|
+
background: cfg.speak === value ? "rgba(128,128,128,0.22)" : "transparent",
|
|
1718
|
+
cursor: "pointer",
|
|
1719
|
+
fontSize: 12.5
|
|
1720
|
+
},
|
|
1721
|
+
children: label
|
|
1722
|
+
},
|
|
1723
|
+
value
|
|
1724
|
+
)) }) : null
|
|
1725
|
+
] }),
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: group, children: [
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: rowTitle, children: "\u8BED\u97F3" }),
|
|
1728
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: hint, children: "\u5F15\u64CE\u3001Key\u3001\u97F3\u8272\u3001\u81EA\u52A8\u6717\u8BFB\u90FD\u5728\u8FD9\u91CC\u3002" }),
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SettingsRow, { defaultOpen: true })
|
|
1730
|
+
] }),
|
|
1704
1731
|
error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: "#d0563a", fontSize: 12 }, children: error }) : null
|
|
1705
1732
|
] });
|
|
1706
1733
|
}
|
package/lib/state.js
CHANGED
|
@@ -552,7 +552,9 @@ export function applyImpulse(state, impulse, now = Date.now()) {
|
|
|
552
552
|
const emoDef = emotionOf(impulse.key)
|
|
553
553
|
if (!emoDef || emoDef.key === 'calm') return null
|
|
554
554
|
const habit = habituation(state, impulse.stimulus, now)
|
|
555
|
-
|
|
555
|
+
// 单次冲量封顶:一句话能把情绪推到很浓,但不该一上来就是满格。
|
|
556
|
+
// 满格留给"连着来三次"那种情况(见下面的 streak 升级)。
|
|
557
|
+
let intensity = clamp((Number(impulse.intensity) || 0) * habit, 0, 88)
|
|
556
558
|
if (intensity < 8) return null
|
|
557
559
|
|
|
558
560
|
const cur = state.emotion
|
package/package.json
CHANGED