mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 18:16:15 +08:00
feat(core): add google vertex ai (#12423)
Close [AI-125](https://linear.app/affine-design/issue/AI-125) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new provider configurations `geminiVertex` and `anthropicVertex` for Google Vertex AI in backend schema, provider classes, and admin config. - Introduced `GeminiVertexProvider` and `AnthropicVertexProvider` classes supporting Vertex AI models with specific capabilities. - Expanded model options for transcription prompts with newer Gemini models. - Re-exported provider modules to include Vertex AI variants. - **Improvements** - Extended provider architecture to support separate Vertex AI configurations and models. - Updated test setup to replace deprecated provider references with new Vertex variants. - Consolidated environment variables for server testing with a single `SERVER_CONFIG`. - **Bug Fixes** - Updated mock models and import references in tests to align with new provider classes. - **Chores** - Added `@ai-sdk/google-vertex` dependency for Vertex AI support. - Updated dependency list to include `@ai-sdk/google-vertex`. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -19,7 +19,7 @@ import { MockEmbeddingClient } from '../plugins/copilot/context/embedding';
|
||||
import { prompts, PromptService } from '../plugins/copilot/prompt';
|
||||
import {
|
||||
CopilotProviderFactory,
|
||||
GeminiProvider,
|
||||
GeminiGenerativeProvider,
|
||||
OpenAIProvider,
|
||||
} from '../plugins/copilot/providers';
|
||||
import { CopilotStorage } from '../plugins/copilot/storage';
|
||||
@@ -100,7 +100,9 @@ test.before(async t => {
|
||||
},
|
||||
});
|
||||
m.overrideProvider(OpenAIProvider).useClass(MockCopilotProvider);
|
||||
m.overrideProvider(GeminiProvider).useClass(MockCopilotProvider);
|
||||
m.overrideProvider(GeminiGenerativeProvider).useClass(
|
||||
MockCopilotProvider
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -935,8 +937,8 @@ test('should be able to transcript', async t => {
|
||||
const { id: workspaceId } = await createWorkspace(app);
|
||||
|
||||
for (const [provider, func] of [
|
||||
[GeminiProvider, 'text'],
|
||||
[GeminiProvider, 'structure'],
|
||||
[GeminiGenerativeProvider, 'text'],
|
||||
[GeminiGenerativeProvider, 'structure'],
|
||||
] as const) {
|
||||
Sinon.stub(app.get(provider), func).resolves(
|
||||
JSON.stringify([
|
||||
|
||||
@@ -111,7 +111,7 @@ export class MockCopilotProvider extends OpenAIProvider {
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'gemini-2.5-pro-preview-05-06',
|
||||
id: 'gemini-2.5-flash-preview-05-20',
|
||||
capabilities: [
|
||||
{
|
||||
input: [ModelInputType.Text, ModelInputType.Image],
|
||||
|
||||
Reference in New Issue
Block a user