mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-16 23:52:40 -06:00
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
// Telegram helper module supports auto topic label config behavior.
|
|
import type {
|
|
TelegramAccountConfig,
|
|
TelegramDirectConfig,
|
|
} from "openclaw/plugin-sdk/config-contracts";
|
|
|
|
const AUTO_TOPIC_LABEL_DEFAULT_PROMPT =
|
|
"Generate a very short topic label (2-4 words, max 25 chars) for a chat conversation based on the user's first message below. No emoji. Use the same language as the message. Be concise and descriptive. Return ONLY the topic name, nothing else.";
|
|
|
|
export function resolveAutoTopicLabelConfig(
|
|
directConfig?: TelegramDirectConfig["autoTopicLabel"],
|
|
accountConfig?: TelegramAccountConfig["autoTopicLabel"],
|
|
): { enabled: true; prompt: string } | null {
|
|
const config = directConfig ?? accountConfig;
|
|
if (config === undefined || config === true) {
|
|
return { enabled: true, prompt: AUTO_TOPIC_LABEL_DEFAULT_PROMPT };
|
|
}
|
|
if (config === false || config.enabled === false) {
|
|
return null;
|
|
}
|
|
return {
|
|
enabled: true,
|
|
prompt: config.prompt?.trim() || AUTO_TOPIC_LABEL_DEFAULT_PROMPT,
|
|
};
|
|
}
|