mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
feat: 支持添加默认提示词(兼容块)
- prompt-profiles.js: 新增 createLegacyPromptBlock 导出 - panel.js: 新增 add-legacy-block 处理逻辑 - 工具栏新增 '+ 默认提示词' 按钮
This commit is contained in:
13
panel.js
13
panel.js
@@ -7,6 +7,7 @@ import {
|
||||
cloneTaskProfile,
|
||||
createBuiltinPromptBlock,
|
||||
createCustomPromptBlock,
|
||||
createLegacyPromptBlock,
|
||||
createLocalRegexRule,
|
||||
ensureTaskProfiles,
|
||||
exportTaskProfile as serializeTaskProfile,
|
||||
@@ -1680,6 +1681,15 @@ async function _handleTaskProfileWorkspaceClick(event) {
|
||||
return { selectBlockId: nextBlock.id };
|
||||
});
|
||||
return;
|
||||
case "add-legacy-block":
|
||||
_updateCurrentTaskProfile((draft, context) => {
|
||||
const nextBlock = createLegacyPromptBlock(context.taskType, {
|
||||
order: draft.blocks.length,
|
||||
});
|
||||
draft.blocks.push(nextBlock);
|
||||
return { selectBlockId: nextBlock.id };
|
||||
});
|
||||
return;
|
||||
case "add-builtin-block": {
|
||||
const select = document.getElementById("bme-task-builtin-select");
|
||||
const sourceKey = String(select?.value || "").trim();
|
||||
@@ -1947,6 +1957,9 @@ function _renderTaskPromptTab(state) {
|
||||
<button class="bme-config-secondary-btn" data-task-action="add-custom-block" type="button">
|
||||
+ 自定义块
|
||||
</button>
|
||||
<button class="bme-config-secondary-btn" data-task-action="add-legacy-block" type="button">
|
||||
+ 默认提示词
|
||||
</button>
|
||||
<span class="bme-task-action-sep"></span>
|
||||
<select id="bme-task-builtin-select" class="bme-config-input bme-task-builtin-select">
|
||||
${state.builtinBlockDefinitions
|
||||
|
||||
@@ -363,6 +363,23 @@ export function createBuiltinPromptBlock(taskType, sourceKey = "", overrides = {
|
||||
});
|
||||
}
|
||||
|
||||
export function createLegacyPromptBlock(taskType, overrides = {}) {
|
||||
const legacyField = LEGACY_PROMPT_FIELD_MAP[taskType] || "";
|
||||
return normalizePromptBlock(taskType, {
|
||||
id: createPromptBlockId(taskType),
|
||||
name: "默认提示词",
|
||||
type: "legacyPrompt",
|
||||
enabled: true,
|
||||
role: "system",
|
||||
sourceKey: "",
|
||||
sourceField: legacyField,
|
||||
content: "",
|
||||
injectionMode: "append",
|
||||
order: 0,
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
export function createLocalRegexRule(taskType, overrides = {}) {
|
||||
return normalizeRegexLocalRule(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user