mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-13 02:30:45 +08:00
fix: complete per-bot agent preset lifecycle
This commit is contained in:
parent
8ab4b9e7de
commit
01576f65c6
27 changed files with 721 additions and 208 deletions
|
|
@ -309,10 +309,13 @@ var EN = Object.freeze({
|
|||
"\u627E\u4E0D\u5230\u8981\u4FEE\u6539\u7684\u673A\u5668\u4EBA\u3002": "The bot could not be found.",
|
||||
"Agent Preset": "Agent Preset",
|
||||
"\u8DDF\u968F Host \u9ED8\u8BA4": "Follow the Host default",
|
||||
"\u53EA\u5F71\u54CD\u4E4B\u540E\u65B0\u5EFA\u7684\u4F1A\u8BDD\u3002": "Only later new sessions use this preset.",
|
||||
"\uFF08\u5DF2\u4E0D\u53EF\u7528\uFF09": " (unavailable)",
|
||||
"\u53EA\u5F71\u54CD\u65B0\u5EFA\u4F1A\u8BDD\uFF1B\u82E5\u5F53\u524D\u804A\u5929\u5DF2\u6709\u4F1A\u8BDD\uFF0C\u5148\u53D1\u9001 /new\uFF0C\u518D\u53D1\u9001\u666E\u901A\u6D88\u606F\u751F\u6548\u3002": "This affects only new sessions. If the current chat already has a session, send /new, then send a regular message to apply it.",
|
||||
"\u5F53\u524D Agent Preset \u5DF2\u4E0D\u53EF\u7528\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6 Preset \u6216\u8DDF\u968F Host \u9ED8\u8BA4\u3002": "The current Agent Preset is unavailable. Choose another preset or follow the Host default.",
|
||||
"Agent Preset \u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002": "Could not update the Agent Preset. Try again.",
|
||||
"\u8BF7\u9009\u62E9 Agent Preset\u3002": "Choose an Agent Preset.",
|
||||
"Agent Preset \u65E0\u6548\u3002": "The Agent Preset is invalid.",
|
||||
"Agent Preset \u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u7528\u3002": "The Agent Preset does not exist or is unavailable.",
|
||||
"\u5C1A\u672A\u68C0\u67E5": "Not checked yet",
|
||||
"\u521A\u521A": "Just now",
|
||||
"\u68C0\u67E5\u8FDE\u63A5": "Check connection",
|
||||
|
|
@ -854,9 +857,8 @@ function AgentPresetEditor({ agentPreset = "", disabled = false, onSave }) {
|
|||
seen.add(item.id);
|
||||
items.push(item);
|
||||
}
|
||||
if (current && !seen.has(current)) {
|
||||
items.push({ id: current, label: current });
|
||||
}
|
||||
const currentUnavailable = Boolean(current && !seen.has(current));
|
||||
if (currentUnavailable) items.push({ id: current, label: current, unavailable: true });
|
||||
const inheritLabel = "\u8DDF\u968F Host \u9ED8\u8BA4";
|
||||
const change = async (event) => {
|
||||
const next = event.target.value;
|
||||
|
|
@ -895,11 +897,19 @@ function AgentPresetEditor({ agentPreset = "", disabled = false, onSave }) {
|
|||
...items.map((item) => h2(
|
||||
"option",
|
||||
{ key: item.id, value: item.id },
|
||||
item.label && item.label !== item.id ? `${item.label}\uFF08${item.id}\uFF09` : item.id
|
||||
item.unavailable ? [item.id, "\uFF08\u5DF2\u4E0D\u53EF\u7528\uFF09"] : item.label && item.label !== item.id ? `${item.label}\uFF08${item.id}\uFF09` : item.id
|
||||
))
|
||||
),
|
||||
h2("small", { className: "dim-presetHelp" }, "\u53EA\u5F71\u54CD\u4E4B\u540E\u65B0\u5EFA\u7684\u4F1A\u8BDD\u3002"),
|
||||
error ? h2("p", { className: "dim-presetError", role: "alert" }, error) : null
|
||||
h2(
|
||||
"small",
|
||||
{ className: "dim-presetHelp" },
|
||||
"\u53EA\u5F71\u54CD\u65B0\u5EFA\u4F1A\u8BDD\uFF1B\u82E5\u5F53\u524D\u804A\u5929\u5DF2\u6709\u4F1A\u8BDD\uFF0C\u5148\u53D1\u9001 /new\uFF0C\u518D\u53D1\u9001\u666E\u901A\u6D88\u606F\u751F\u6548\u3002"
|
||||
),
|
||||
error || currentUnavailable ? h2(
|
||||
"p",
|
||||
{ className: "dim-presetError", role: error ? "alert" : "status" },
|
||||
error ?? "\u5F53\u524D Agent Preset \u5DF2\u4E0D\u53EF\u7528\uFF0C\u8BF7\u9009\u62E9\u5176\u4ED6 Preset \u6216\u8DDF\u968F Host \u9ED8\u8BA4\u3002"
|
||||
) : null
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
268
lib/index.js
268
lib/index.js
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue