Skip to content

feat: Add Alibaba Bailian Coding Plan API support#148

Open
Alenryuichi wants to merge 3 commits intoj4wg:mainfrom
Alenryuichi:feature/bailian-support
Open

feat: Add Alibaba Bailian Coding Plan API support#148
Alenryuichi wants to merge 3 commits intoj4wg:mainfrom
Alenryuichi:feature/bailian-support

Conversation

@Alenryuichi
Copy link

Summary

Add support for Alibaba Bailian Coding Plan API, a cost-effective way to access multiple AI models through a single subscription.

⚠️ Note: This PR depends on #147 (Deepseek & Zhipu support). Please merge that first.

Features

  • ✅ Add Bailian Coding Plan as a new API provider
  • ✅ Support Coding Plan Pro models:
    • \ (recommended, supports vision)
    • \ (Kimi latest, supports vision)
    • , \
    • \
    • , \
  • ✅ Use Coding Plan dedicated Base URL: \
  • ✅ API key validation (sk-sp-* format)

Additional Improvement

  • Cmd+R reset now centers window on screen (helpful when window moves off-screen)

Why Bailian Coding Plan?

  • 💰 Cost-effective subscription (¥39.9/month for Pro)
  • 🚀 Access to multiple top models (Kimi, GLM, Qwen, MiniMax)
  • 🔄 OpenAI-compatible API

Files Changed

  • \ - Bailian config & model validation
  • \ - Bailian client initialization
  • \ - Bailian UI
  • \ - Window reset position

Features:
- Add Deepseek and Zhipu/GLM API providers alongside OpenAI, Gemini, Anthropic
- Implement per-provider API key storage
- Add GLM-4.5 and GLM-5 model options to Settings UI
- Add collapsible "解题思路" section with markdown rendering
- Fix malformed JSON from GLM API (Chinese quotes, single-quoted values)

Security:
- Add DOMPurify to sanitize AI-generated HTML content (XSS prevention)

Code Quality:
- Extract API URLs to constants (API_URLS)
- Refactor Zhipu API calls into reusable callZhipuAPI() method
- Remove unused variable (stringStart)
- Remove debug console.log statements
- Delete temporary test file (test-detect-quotes.js)

Dependencies:
- Add jsonrepair for JSON fixing
- Add dompurify for HTML sanitization
- 新增 bailian 作为 API provider 选项
- 使用 Coding Plan 专属 Base URL: https://coding.dashscope.aliyuncs.com/v1
- 支持 Coding Plan Pro 模型: qwen3.5-plus, kimi-k2.5, glm-5, MiniMax-M2.5 等
- 更新 ConfigHelper: API key 存储、模型验证、testBailianKey 方法
- 更新 ProcessingHelper: OpenAI 兼容客户端初始化和三个处理函数
- 更新 SettingsDialog: provider 选择 UI、模型列表、帮助文档链接
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant