feat: add skill filter + group system prompt plumbing
This commit is contained in:
@@ -593,6 +593,10 @@ export async function getReplyFromConfig(
|
||||
silentToken: SILENT_REPLY_TOKEN,
|
||||
})
|
||||
: "";
|
||||
const groupSystemPrompt = sessionCtx.GroupSystemPrompt?.trim() ?? "";
|
||||
const extraSystemPrompt = [groupIntro, groupSystemPrompt]
|
||||
.filter(Boolean)
|
||||
.join("\n\n");
|
||||
const baseBody = sessionCtx.BodyStripped ?? sessionCtx.Body ?? "";
|
||||
const rawBodyTrimmed = (ctx.Body ?? "").trim();
|
||||
const baseBodyTrimmedRaw = baseBody.trim();
|
||||
@@ -651,6 +655,7 @@ export async function getReplyFromConfig(
|
||||
isFirstTurnInSession,
|
||||
workspaceDir,
|
||||
cfg,
|
||||
skillFilter: opts?.skillFilter,
|
||||
});
|
||||
sessionEntry = skillResult.sessionEntry ?? sessionEntry;
|
||||
systemSent = skillResult.systemSent;
|
||||
@@ -759,7 +764,7 @@ export async function getReplyFromConfig(
|
||||
blockReplyBreak: resolvedBlockStreamingBreak,
|
||||
ownerNumbers:
|
||||
command.ownerList.length > 0 ? command.ownerList : undefined,
|
||||
extraSystemPrompt: groupIntro || undefined,
|
||||
extraSystemPrompt: extraSystemPrompt || undefined,
|
||||
...(provider === "ollama" ? { enforceFinalTag: true } : {}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -49,6 +49,8 @@ export async function ensureSkillSnapshot(params: {
|
||||
isFirstTurnInSession: boolean;
|
||||
workspaceDir: string;
|
||||
cfg: ClawdbotConfig;
|
||||
/** If provided, only load skills with these names (for per-channel skill filtering) */
|
||||
skillFilter?: string[];
|
||||
}): Promise<{
|
||||
sessionEntry?: SessionEntry;
|
||||
skillsSnapshot?: SessionEntry["skillsSnapshot"];
|
||||
@@ -63,6 +65,7 @@ export async function ensureSkillSnapshot(params: {
|
||||
isFirstTurnInSession,
|
||||
workspaceDir,
|
||||
cfg,
|
||||
skillFilter,
|
||||
} = params;
|
||||
|
||||
let nextEntry = sessionEntry;
|
||||
@@ -76,7 +79,10 @@ export async function ensureSkillSnapshot(params: {
|
||||
};
|
||||
const skillSnapshot =
|
||||
isFirstTurnInSession || !current.skillsSnapshot
|
||||
? buildWorkspaceSkillSnapshot(workspaceDir, { config: cfg })
|
||||
? buildWorkspaceSkillSnapshot(workspaceDir, {
|
||||
config: cfg,
|
||||
skillFilter,
|
||||
})
|
||||
: current.skillsSnapshot;
|
||||
nextEntry = {
|
||||
...current,
|
||||
@@ -96,7 +102,10 @@ export async function ensureSkillSnapshot(params: {
|
||||
nextEntry?.skillsSnapshot ??
|
||||
(isFirstTurnInSession
|
||||
? undefined
|
||||
: buildWorkspaceSkillSnapshot(workspaceDir, { config: cfg }));
|
||||
: buildWorkspaceSkillSnapshot(workspaceDir, {
|
||||
config: cfg,
|
||||
skillFilter,
|
||||
}));
|
||||
if (
|
||||
skillsSnapshot &&
|
||||
sessionStore &&
|
||||
|
||||
@@ -31,6 +31,7 @@ export type MsgContext = {
|
||||
GroupRoom?: string;
|
||||
GroupSpace?: string;
|
||||
GroupMembers?: string;
|
||||
GroupSystemPrompt?: string;
|
||||
SenderName?: string;
|
||||
SenderId?: string;
|
||||
SenderUsername?: string;
|
||||
|
||||
@@ -9,6 +9,8 @@ export type GetReplyOptions = {
|
||||
onBlockReply?: (payload: ReplyPayload) => Promise<void> | void;
|
||||
onToolResult?: (payload: ReplyPayload) => Promise<void> | void;
|
||||
disableBlockStreaming?: boolean;
|
||||
/** If provided, only load these skills for this session (empty = no skills). */
|
||||
skillFilter?: string[];
|
||||
};
|
||||
|
||||
export type ReplyPayload = {
|
||||
|
||||
Reference in New Issue
Block a user