mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 11:04:59 +00:00
refactor(channels): dedupe message routing and telegram helpers
This commit is contained in:
19
src/telegram/group-config-helpers.ts
Normal file
19
src/telegram/group-config-helpers.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { TelegramGroupConfig, TelegramTopicConfig } from "../config/types.js";
|
||||
import { firstDefined } from "./bot-access.js";
|
||||
|
||||
export function resolveTelegramGroupPromptSettings(params: {
|
||||
groupConfig?: TelegramGroupConfig;
|
||||
topicConfig?: TelegramTopicConfig;
|
||||
}): {
|
||||
skillFilter: string[] | undefined;
|
||||
groupSystemPrompt: string | undefined;
|
||||
} {
|
||||
const skillFilter = firstDefined(params.topicConfig?.skills, params.groupConfig?.skills);
|
||||
const systemPromptParts = [
|
||||
params.groupConfig?.systemPrompt?.trim() || null,
|
||||
params.topicConfig?.systemPrompt?.trim() || null,
|
||||
].filter((entry): entry is string => Boolean(entry));
|
||||
const groupSystemPrompt =
|
||||
systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : undefined;
|
||||
return { skillFilter, groupSystemPrompt };
|
||||
}
|
||||
Reference in New Issue
Block a user