There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(server): copilot test condition (#11417)
darkskygit90c43356c19f
diff --git a/packages/backend/server/src/__tests__/copilot-provider.spec.ts b/packages/backend/server/src/__tests__/copilot-provider.spec.tsindex 18a6aae115..e97dd613b6 100644--- a/packages/backend/server/src/__tests__/copilot-provider.spec.ts+++ b/packages/backend/server/src/__tests__/copilot-provider.spec.ts@@ -2,7 +2,7 @@ import type { ExecutionContext, TestFn } from 'ava';import ava from 'ava';import { z } from 'zod';-import { ConfigModule } from '../base/config';+import { ServerFeature, ServerService } from '../core';import { AuthService } from '../core/auth';import { QuotaModule } from '../core/quota';import { CopilotModule } from '../plugins/copilot';@@ -36,13 +36,7 @@ type Tester = {};const test = ava as TestFn<Tester>;-const isCopilotConfigured =- !!process.env.COPILOT_OPENAI_API_KEY &&- !!process.env.COPILOT_FAL_API_KEY &&- !!process.env.COPILOT_PERPLEXITY_API_KEY &&- process.env.COPILOT_OPENAI_API_KEY !== '1' &&- process.env.COPILOT_FAL_API_KEY !== '1' &&- process.env.COPILOT_PERPLEXITY_API_KEY !== '1';+let isCopilotConfigured = false;const runIfCopilotConfigured = test.macro(async (t,@@ -59,30 +53,12 @@ const runIfCopilotConfigured = test.macro(test.serial.before(async t => {const module = await createTestingModule({- imports: [- ConfigModule.override({- copilot: {- providers: {- openai: {- apiKey: process.env.COPILOT_OPENAI_API_KEY || '',- },- fal: {- apiKey: process.env.COPILOT_FAL_API_KEY || '',- },- perplexity: {- apiKey: process.env.COPILOT_PERPLEXITY_API_KEY || '',- },- gemini: {- apiKey: process.env.COPILOT_GOOGLE_API_KEY || '',- },- },- },- }),- QuotaModule,- CopilotModule,- ],+ imports: [QuotaModule, CopilotModule],});+ const service = module.get(ServerService);+ isCopilotConfigured = service.features.includes(ServerFeature.Copilot);+const auth = module.get(AuthService);const prompt = module.get(PromptService);const factory = module.get(CopilotProviderFactory);@@ -357,10 +333,10 @@ const actions = [.trim();t.notThrows(() => {z.object({- speaker: z.string(),- start: z.string(),- end: z.string(),- transcription: z.string(),+ a: z.string(),+ s: z.number(),+ e: z.number(),+ t: z.string(),}).array().parse(JSON.parse(cleaned));