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:
@@ -0,0 +1,15 @@
|
||||
export interface KolPlatformOption {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function buildKolPlatformOptions(defaultLabel: string): KolPlatformOption[] {
|
||||
return [
|
||||
{ label: defaultLabel, value: "通用" },
|
||||
{ label: "小红书", value: "xiaohongshu" },
|
||||
{ label: "微信", value: "wechat" },
|
||||
{ label: "豆包", value: "doubao" },
|
||||
{ label: "DeepSeek", value: "deepseek" },
|
||||
{ label: "ChatGPT", value: "chatgpt" },
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user