refactor: update Deepseek API implementation

- Switch to OpenAI SDK for Deepseek API calls
- Add openai package dependency
- Update configuration for Deepseek API
- Update environment variable examples
- Improve error handling for API responses

This change improves reliability and maintainability by using the official SDK
with proper typing and error handling.
This commit is contained in:
cyanheads
2025-01-25 19:09:41 -08:00
parent 7639395c85
commit a6edebbf8e
5 changed files with 227 additions and 102 deletions

View File

@@ -14,8 +14,8 @@ function requireEnv(name: string): string {
const apiConfig: APIConfig = {
apiKey: requireEnv('DEEPSEEK_API_KEY'),
baseUrl: process.env.DEEPSEEK_API_BASE_URL || 'https://api.deepseek.com/v1',
model: process.env.DEEPSEEK_MODEL || 'deepseek-coder',
baseUrl: process.env.DEEPSEEK_API_BASE_URL || 'https://api.deepseek.com',
model: process.env.DEEPSEEK_MODEL || 'deepseek-chat',
maxRetries: parseInt(process.env.DEEPSEEK_MAX_RETRIES || '3', 10),
timeout: parseInt(process.env.DEEPSEEK_TIMEOUT || '30000', 10),
};