Files
CherryHQ-cherry-studio/packages/aiCore/tsconfig.json
SuYao 1c0a5a95fa refactor: migrate to ai sdk v6 Phase 3 (#12235)
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>
2026-04-02 15:38:23 +08:00

26 lines
663 B
JSON

{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "bundler",
"noEmitOnError": false,
"outDir": "./dist",
"resolveJsonModule": true,
"rootDir": ".",
"skipLibCheck": true,
"strict": true,
"target": "ES2020",
"paths": {
"@test-utils": ["./test_utils"],
"@test-utils/*": ["./test_utils/*"]
}
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*", "test_utils/**/*"]
}