fix: Enhance Kol Variable Rendering and Management

- Updated the regex for placeholder matching to support more flexible key formats.
- Refactored variable storage to allow both ID and key lookups in rendering.
- Improved schema validation to check for duplicate keys and enforce non-empty keys.
- Added new utility functions for variable value lookup and display name generation.
- Enhanced tests to cover new key-based variable scenarios.
- Refactored KolPrompt repository to simplify prompt storage and management, including the removal of obsolete revision handling.
- Introduced new API endpoints for saving, activating, and archiving prompts.
- Added new utility functions for handling Kol placeholders and platform options in the admin web.
- Implemented database migrations to simplify prompt storage structure and ensure data integrity.
This commit is contained in:
2026-04-18 00:47:57 +08:00
parent 614ca4a2ea
commit 3ef0807456
32 changed files with 2414 additions and 3518 deletions
+8 -11
View File
@@ -5,7 +5,6 @@ import { message } from "ant-design-vue";
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRoute, useRouter } from "vue-router";
import { MilkdownProvider } from "@milkdown/vue";
import ArticleEditorCanvas from "@/components/ArticleEditorCanvas.vue";
import CoverPickerModal from "@/components/CoverPickerModal.vue";
@@ -379,16 +378,14 @@ function serializePlatformSelection(platformIds: string[]): string {
/>
<div class="article-editor-view__layout">
<section class="article-editor-view__main">
<MilkdownProvider>
<ArticleEditorCanvas
:key="String(articleId)"
:article-id="articleId"
v-model:title="title"
v-model="markdown"
:disabled="editorLocked"
:upload-image="uploadEditorImage"
/>
</MilkdownProvider>
<ArticleEditorCanvas
:key="String(articleId)"
:article-id="articleId"
v-model:title="title"
v-model="markdown"
:disabled="editorLocked"
:upload-image="uploadEditorImage"
/>
</section>
<aside class="article-editor-view__rail">