mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-07-06 14:01:30 +08:00
Continued from #12227 ## Summary Phase 3 of AI SDK v6 migration: - **Image generation**: Migrate to native AI SDK `generateImage`/`editImage`, remove legacy image middleware - **Embedding**: Migrate to AI SDK `embedMany`, remove legacy embedding clients - **Model listing**: Refactor `ModelListService` to Strategy Registry pattern (`listModels.ts`), consolidate 7 schema files into one `schemas.ts` - **OpenRouter image**: Bump `@openrouter/ai-sdk-provider` to 2.3.3 with native image endpoint support, remove `isNativeImageGenerationProvider` guard - **GitHub Copilot**: Simplify extension by removing `ProviderV2` cast and `wrapProvider` - **Legacy removal**: Delete all legacy API clients, middleware pipeline, and barrel `index.ts` - **Rename**: `index_new.ts` → `AiProvider.ts`, `ModelListService.ts` → `listModels.ts` ## Manual Test Plan ### P0 — Core paths + PR change focus #### 1. Core Chat - [ ] OpenAI model (e.g. GPT-4o): send text, verify streaming output - [ ] Anthropic model (e.g. Claude Sonnet): verify chat works - [ ] Gemini model: verify chat works - [ ] DeepSeek model: verify chat works - [ ] Reasoning mode (o3-mini, DeepSeek R1): verify thinking process displays - [ ] Send message with image (multimodal): verify model recognizes image - [ ] Abort mid-stream: verify clean termination, no errors #### 2. Image Generation (key change area) - [ ] DALL-E 3 / GPT-Image-1: verify image generation works - [ ] OpenRouter image model: verify **native image endpoint** is used (no longer chat completions) - [ ] Image editing: upload image + text prompt, verify editImage path - [ ] Verify generated images display correctly (both base64 and URL formats) #### 3. Model Listing (refactored area) - [ ] Sync OpenAI models: verify names and groups - [ ] Sync Gemini models: verify `models/` prefix stripped - [ ] Sync Ollama models (local): verify display - [ ] Sync OpenRouter models: verify chat + embedding models both appear - [ ] Sync SiliconFlow models: verify grouping (e.g. `deepseek-ai/`) - [ ] Sync GitHub Models - [ ] Sync Together models - [ ] Sync NewAPI service (e.g. CherryIn) - [ ] Sync PPIO models: verify chat + embedding + reranker endpoints merged ### P1 — Affected by refactor #### 4. Provider Extensions - [ ] GitHub Copilot: verify chat works (simplified wrapProvider logic) - [ ] Ollama: verify chat works - [ ] Vertex AI / Bedrock: verify chat works (if configured) #### 5. MCP Tool Calling - [ ] Enable MCP server, send tool-requiring message, verify tool execution - [ ] Verify both prompt tool use and function calling modes #### 6. Auxiliary Functions - [ ] Auto topic title generation (fetchMessagesSummary) - [ ] Note summary (fetchNoteSummary) - [ ] Translation/generation (fetchGenerate) - [ ] API check (click "Check" button in settings) ### P2 — Indirect impact #### 7. Knowledge Base - [ ] Create knowledge base, associate with assistant, verify RAG retrieval and embedding #### 8. Web Search - [ ] Enable native web search (Gemini/Perplexity), verify search results in response #### 9. Tracing - [ ] Enable developer mode, send message, verify trace spans recorded and displayed --------- Signed-off-by: suyao <sy20010504@gmail.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: icarus <eurfelux@gmail.com> Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
setupFiles: [path.resolve(__dirname, './test_utils/setup.ts')]
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
'@test-utils': path.resolve(__dirname, './test_utils'),
|
|
// Mock external packages that may not be available in test environment
|
|
'@cherrystudio/ai-sdk-provider': path.resolve(__dirname, './test_utils/mocks/ai-sdk-provider.ts')
|
|
}
|
|
},
|
|
esbuild: {
|
|
target: 'node18'
|
|
}
|
|
})
|