Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(llm): give the provider spec note stubs isLabelTruthy
Elian Dorancbe7f97569c3
diff --git a/packages/trilium-core/src/services/llm/providers/anthropic.spec.ts b/packages/trilium-core/src/services/llm/providers/anthropic.spec.tsindex 848bc703b3..e47b2f733a 100644--- a/packages/trilium-core/src/services/llm/providers/anthropic.spec.ts+++ b/packages/trilium-core/src/services/llm/providers/anthropic.spec.ts@@ -28,7 +28,7 @@ vi.mock("ai", async (importOriginal) => {// core keeps its real implementation.vi.mock("../../../becca/becca.js", async (importOriginal) => {const actual = await importOriginal<typeof import("../../../becca/becca.js")>();- return { default: { ...actual.default, getNote: (noteId: string) => ({ noteId } as any) } };+ return { default: { ...actual.default, getNote: (noteId: string) => ({ noteId, isLabelTruthy: () => false } as any) } };});vi.mock("../tools/helpers.js", async (importOriginal) => {diff --git a/packages/trilium-core/src/services/llm/providers/base_provider.spec.ts b/packages/trilium-core/src/services/llm/providers/base_provider.spec.tsindex 5806985141..60be880f21 100644--- a/packages/trilium-core/src/services/llm/providers/base_provider.spec.ts+++ b/packages/trilium-core/src/services/llm/providers/base_provider.spec.ts@@ -14,7 +14,7 @@ const { streamTextMock, generateTextMock, noteMetaMock, errorLogMock, beccaStub// becca is accessed directly during message-part resolution and note-hint// building. Stub just these while keeping the rest of core intact.beccaStub: {- getNote: vi.fn((noteId: string) => ({ noteId }) as any),+ getNote: vi.fn((noteId: string) => ({ noteId, isLabelTruthy: () => false }) as any),getAttachment: vi.fn() as any}}));@@ -492,7 +492,7 @@ describe("BaseProvider applyNoteHint", () => {const provider = new TestProvider();beforeEach(() => {- beccaStub.getNote.mockReset().mockImplementation((noteId: string) => ({ noteId }) as any);+ beccaStub.getNote.mockReset().mockImplementation((noteId: string) => ({ noteId, isLabelTruthy: () => false }) as any);noteMetaMock.mockReset().mockReturnValue({ noteId: "ctx", contentPreview: "PREVIEW" });});@@ -554,7 +554,7 @@ describe("BaseProvider chat / pricing / models / title", () => {beforeEach(() => {streamTextMock.mockClear();generateTextMock.mockClear();- beccaStub.getNote.mockReset().mockImplementation((noteId: string) => ({ noteId }) as any);+ beccaStub.getNote.mockReset().mockImplementation((noteId: string) => ({ noteId, isLabelTruthy: () => false }) as any);});it("omits tool options when no tools are enabled", () => {