chore: loaded_skills as project block (#157)
This commit is contained in:
@@ -14,7 +14,7 @@ import type {
|
||||
import { settingsManager } from "../settings-manager";
|
||||
import { getToolNames } from "../tools/manager";
|
||||
import { getClient } from "./client";
|
||||
import { getDefaultMemoryBlocks } from "./memory";
|
||||
import { getDefaultMemoryBlocks, isProjectBlock } from "./memory";
|
||||
import {
|
||||
formatAvailableModels,
|
||||
getModelUpdateArgs,
|
||||
@@ -289,8 +289,8 @@ export async function createAgent(
|
||||
}
|
||||
blockIds.push(createdBlock.id);
|
||||
|
||||
// Categorize: project/skills are local, persona/human are global
|
||||
if (label === "project" || label === "skills") {
|
||||
// Categorize based on block type defined in memory.ts
|
||||
if (isProjectBlock(label)) {
|
||||
newLocalBlockIds[label] = createdBlock.id;
|
||||
} else {
|
||||
newGlobalBlockIds[label] = createdBlock.id;
|
||||
|
||||
@@ -6,6 +6,23 @@
|
||||
import type { CreateBlock } from "@letta-ai/letta-client/resources/blocks/blocks";
|
||||
import { MEMORY_PROMPTS } from "./promptAssets";
|
||||
|
||||
/**
|
||||
* Block labels that are stored per-project (local to the current directory).
|
||||
* All other blocks are stored globally (shared across all projects).
|
||||
*/
|
||||
export const PROJECT_BLOCK_LABELS = [
|
||||
"project",
|
||||
"skills",
|
||||
"loaded_skills",
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Check if a block label is a project-level block
|
||||
*/
|
||||
export function isProjectBlock(label: string): boolean {
|
||||
return (PROJECT_BLOCK_LABELS as readonly string[]).includes(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse frontmatter and content from an .mdx file
|
||||
*/
|
||||
@@ -50,8 +67,6 @@ async function loadMemoryBlocksFromMdx(): Promise<CreateBlock[]> {
|
||||
"skills.mdx",
|
||||
"loaded_skills.mdx",
|
||||
];
|
||||
// const mdxFiles = ["persona.mdx", "human.mdx", "style.mdx"];
|
||||
// const mdxFiles = ["persona_kawaii.mdx", "human.mdx", "style.mdx"];
|
||||
|
||||
for (const filename of mdxFiles) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user