merge: 合并远程 dev 分支,整合 CCR 和 OpenAI-Responses 功能

## 合并内容
- 成功合并远程 dev 分支的 CCR (Claude Connector) 功能
- 保留本地的 OpenAI-Responses 账户管理功能
- 解决所有合并冲突,保留双方功能

## UI 调整
- 将 CCR 平台归类到 Claude 分组中
- 保留新的平台分组选择器设计
- 支持所有平台类型:Claude、CCR、OpenAI、OpenAI-Responses、Gemini、Azure OpenAI、Bedrock

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
shaw
2025-09-10 15:49:52 +08:00
11 changed files with 3145 additions and 65 deletions

78
src/utils/modelHelper.js Normal file
View File

@@ -0,0 +1,78 @@
/**
* Model Helper Utility
*
* Provides utilities for parsing vendor-prefixed model names.
* Supports parsing model strings like "ccr,model_name" to extract vendor type and base model.
*/
/**
* Parse vendor-prefixed model string
* @param {string} modelStr - Model string, potentially with vendor prefix (e.g., "ccr,gemini-2.5-pro")
* @returns {{vendor: string|null, baseModel: string}} - Parsed vendor and base model
*/
function parseVendorPrefixedModel(modelStr) {
if (!modelStr || typeof modelStr !== 'string') {
return { vendor: null, baseModel: modelStr || '' }
}
// Trim whitespace and convert to lowercase for comparison
const trimmed = modelStr.trim()
const lowerTrimmed = trimmed.toLowerCase()
// Check for ccr prefix (case insensitive)
if (lowerTrimmed.startsWith('ccr,')) {
const parts = trimmed.split(',')
if (parts.length >= 2) {
// Extract base model (everything after the first comma, rejoined in case model name contains commas)
const baseModel = parts.slice(1).join(',').trim()
return {
vendor: 'ccr',
baseModel
}
}
}
// No recognized vendor prefix found
return {
vendor: null,
baseModel: trimmed
}
}
/**
* Check if a model string has a vendor prefix
* @param {string} modelStr - Model string to check
* @returns {boolean} - True if the model has a vendor prefix
*/
function hasVendorPrefix(modelStr) {
const { vendor } = parseVendorPrefixedModel(modelStr)
return vendor !== null
}
/**
* Get the effective model name for scheduling and processing
* This removes vendor prefixes to get the actual model name used for API calls
* @param {string} modelStr - Original model string
* @returns {string} - Effective model name without vendor prefix
*/
function getEffectiveModel(modelStr) {
const { baseModel } = parseVendorPrefixedModel(modelStr)
return baseModel
}
/**
* Get the vendor type from a model string
* @param {string} modelStr - Model string to parse
* @returns {string|null} - Vendor type ('ccr') or null if no prefix
*/
function getVendorType(modelStr) {
const { vendor } = parseVendorPrefixedModel(modelStr)
return vendor
}
module.exports = {
parseVendorPrefixedModel,
hasVendorPrefix,
getEffectiveModel,
getVendorType
}