mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-04-19 14:38:39 +00:00
Revert "feat: add gpt-5.3-codex-spark model support"
This commit is contained in:
29
.github/workflows/auto-release-pipeline.yml
vendored
29
.github/workflows/auto-release-pipeline.yml
vendored
@@ -269,10 +269,16 @@ jobs:
|
|||||||
id: image_names
|
id: image_names
|
||||||
if: steps.check.outputs.needs_bump == 'true'
|
if: steps.check.outputs.needs_bump == 'true'
|
||||||
run: |
|
run: |
|
||||||
# 只使用 GitHub Container Registry
|
DOCKER_USERNAME="${{ secrets.DOCKERHUB_USERNAME }}"
|
||||||
|
if [ -z "$DOCKER_USERNAME" ]; then
|
||||||
|
DOCKER_USERNAME="weishaw"
|
||||||
|
fi
|
||||||
|
|
||||||
|
DOCKER_IMAGE=$(echo "${DOCKER_USERNAME}/claude-relay-service" | tr '[:upper:]' '[:lower:]')
|
||||||
GHCR_IMAGE=$(echo "ghcr.io/${{ github.repository_owner }}/claude-relay-service" | tr '[:upper:]' '[:lower:]')
|
GHCR_IMAGE=$(echo "ghcr.io/${{ github.repository_owner }}/claude-relay-service" | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
{
|
{
|
||||||
|
echo "docker_image=${DOCKER_IMAGE}"
|
||||||
echo "ghcr_image=${GHCR_IMAGE}"
|
echo "ghcr_image=${GHCR_IMAGE}"
|
||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
@@ -283,9 +289,11 @@ jobs:
|
|||||||
tag_name: ${{ steps.next_version.outputs.new_tag }}
|
tag_name: ${{ steps.next_version.outputs.new_tag }}
|
||||||
name: Release ${{ steps.next_version.outputs.new_version }}
|
name: Release ${{ steps.next_version.outputs.new_version }}
|
||||||
body: |
|
body: |
|
||||||
## 🐳 Docker 镜像 (GHCR)
|
## 🐳 Docker 镜像
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
docker pull ${{ steps.image_names.outputs.docker_image }}:${{ steps.next_version.outputs.new_tag }}
|
||||||
|
docker pull ${{ steps.image_names.outputs.docker_image }}:latest
|
||||||
docker pull ${{ steps.image_names.outputs.ghcr_image }}:${{ steps.next_version.outputs.new_tag }}
|
docker pull ${{ steps.image_names.outputs.ghcr_image }}:${{ steps.next_version.outputs.new_tag }}
|
||||||
docker pull ${{ steps.image_names.outputs.ghcr_image }}:latest
|
docker pull ${{ steps.image_names.outputs.ghcr_image }}:latest
|
||||||
```
|
```
|
||||||
@@ -410,6 +418,14 @@ jobs:
|
|||||||
if: steps.check.outputs.needs_bump == 'true'
|
if: steps.check.outputs.needs_bump == 'true'
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
if: steps.check.outputs.needs_bump == 'true'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker.io
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
if: steps.check.outputs.needs_bump == 'true'
|
if: steps.check.outputs.needs_bump == 'true'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -426,6 +442,9 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
|
${{ steps.image_names.outputs.docker_image }}:${{ steps.next_version.outputs.new_tag }}
|
||||||
|
${{ steps.image_names.outputs.docker_image }}:latest
|
||||||
|
${{ steps.image_names.outputs.docker_image }}:${{ steps.next_version.outputs.new_version }}
|
||||||
${{ steps.image_names.outputs.ghcr_image }}:${{ steps.next_version.outputs.new_tag }}
|
${{ steps.image_names.outputs.ghcr_image }}:${{ steps.next_version.outputs.new_tag }}
|
||||||
${{ steps.image_names.outputs.ghcr_image }}:latest
|
${{ steps.image_names.outputs.ghcr_image }}:latest
|
||||||
${{ steps.image_names.outputs.ghcr_image }}:${{ steps.next_version.outputs.new_version }}
|
${{ steps.image_names.outputs.ghcr_image }}:${{ steps.next_version.outputs.new_version }}
|
||||||
@@ -441,6 +460,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||||
|
DOCKER_IMAGE: ${{ steps.image_names.outputs.docker_image }}
|
||||||
GHCR_IMAGE: ${{ steps.image_names.outputs.ghcr_image }}
|
GHCR_IMAGE: ${{ steps.image_names.outputs.ghcr_image }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
@@ -460,14 +480,17 @@ jobs:
|
|||||||
MESSAGE+="📦 版本号: \`${VERSION}\`"$'\n'$'\n'
|
MESSAGE+="📦 版本号: \`${VERSION}\`"$'\n'$'\n'
|
||||||
MESSAGE+="📝 *更新内容:*"$'\n'
|
MESSAGE+="📝 *更新内容:*"$'\n'
|
||||||
MESSAGE+="${CHANGELOG_TRUNCATED}"$'\n'$'\n'
|
MESSAGE+="${CHANGELOG_TRUNCATED}"$'\n'$'\n'
|
||||||
MESSAGE+="🐳 *Docker 部署 (GHCR):*"$'\n'
|
MESSAGE+="🐳 *Docker 部署:*"$'\n'
|
||||||
MESSAGE+="\`\`\`bash"$'\n'
|
MESSAGE+="\`\`\`bash"$'\n'
|
||||||
|
MESSAGE+="docker pull ${DOCKER_IMAGE}:${TAG}"$'\n'
|
||||||
|
MESSAGE+="docker pull ${DOCKER_IMAGE}:latest"$'\n'
|
||||||
MESSAGE+="docker pull ${GHCR_IMAGE}:${TAG}"$'\n'
|
MESSAGE+="docker pull ${GHCR_IMAGE}:${TAG}"$'\n'
|
||||||
MESSAGE+="docker pull ${GHCR_IMAGE}:latest"$'\n'
|
MESSAGE+="docker pull ${GHCR_IMAGE}:latest"$'\n'
|
||||||
MESSAGE+="\`\`\`"$'\n'$'\n'
|
MESSAGE+="\`\`\`"$'\n'$'\n'
|
||||||
MESSAGE+="🔗 *相关链接:*"$'\n'
|
MESSAGE+="🔗 *相关链接:*"$'\n'
|
||||||
MESSAGE+="• [GitHub Release](https://github.com/${REPO}/releases/tag/${TAG})"$'\n'
|
MESSAGE+="• [GitHub Release](https://github.com/${REPO}/releases/tag/${TAG})"$'\n'
|
||||||
MESSAGE+="• [完整更新日志](https://github.com/${REPO}/releases)"$'\n'
|
MESSAGE+="• [完整更新日志](https://github.com/${REPO}/releases)"$'\n'
|
||||||
|
MESSAGE+="• [Docker Hub](https://hub.docker.com/r/${DOCKER_IMAGE%/*}/claude-relay-service)"$'\n'
|
||||||
MESSAGE+="• [GHCR](https://ghcr.io/${GHCR_IMAGE#ghcr.io/})"$'\n'$'\n'
|
MESSAGE+="• [GHCR](https://ghcr.io/${GHCR_IMAGE#ghcr.io/})"$'\n'$'\n'
|
||||||
MESSAGE+="#ClaudeRelay #Update #v${VERSION//./_}"
|
MESSAGE+="#ClaudeRelay #Update #v${VERSION//./_}"
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ const OPENAI_MODELS = [
|
|||||||
{ value: 'gpt-5.2', label: 'GPT-5.2' },
|
{ value: 'gpt-5.2', label: 'GPT-5.2' },
|
||||||
{ value: 'gpt-5.2-codex', label: 'GPT-5.2 Codex' },
|
{ value: 'gpt-5.2-codex', label: 'GPT-5.2 Codex' },
|
||||||
{ value: 'gpt-5.3-codex', label: 'GPT-5.3 Codex' },
|
{ value: 'gpt-5.3-codex', label: 'GPT-5.3 Codex' },
|
||||||
{ value: 'gpt-5.3-codex-spark', label: 'GPT-5.3 Codex Spark' },
|
|
||||||
{ value: 'codex-mini', label: 'Codex Mini' }
|
{ value: 'codex-mini', label: 'Codex Mini' }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ class ModelService {
|
|||||||
'gpt-5.1-codex',
|
'gpt-5.1-codex',
|
||||||
'gpt-5.1-codex-max',
|
'gpt-5.1-codex-max',
|
||||||
'gpt-5-2025-08-07',
|
'gpt-5-2025-08-07',
|
||||||
'gpt-5-codex',
|
'gpt-5-codex'
|
||||||
'gpt-5.3-codex',
|
|
||||||
'gpt-5.3-codex-spark'
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
gemini: {
|
gemini: {
|
||||||
|
|||||||
@@ -19,68 +19,6 @@ class ClaudeConsoleRelayService {
|
|||||||
this.defaultUserAgent = 'claude-cli/2.0.52 (external, cli)'
|
this.defaultUserAgent = 'claude-cli/2.0.52 (external, cli)'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 🔄 转换 messages 数组中的 system role 消息
|
|
||||||
* Console API 不支持 role="system",需要将 system 内容合并到第一条 user 消息
|
|
||||||
* @param {Object} requestBody - 原始请求体
|
|
||||||
* @returns {Object} 转换后的请求体
|
|
||||||
*/
|
|
||||||
_transformSystemMessages(requestBody) {
|
|
||||||
if (!requestBody || !Array.isArray(requestBody.messages)) {
|
|
||||||
return requestBody
|
|
||||||
}
|
|
||||||
|
|
||||||
// 收集所有 system messages 的内容
|
|
||||||
const systemContents = []
|
|
||||||
const nonSystemMessages = []
|
|
||||||
|
|
||||||
for (const msg of requestBody.messages) {
|
|
||||||
if (msg && msg.role === 'system') {
|
|
||||||
systemContents.push(msg.content)
|
|
||||||
} else {
|
|
||||||
nonSystemMessages.push(msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果没有 system messages,直接返回原请求
|
|
||||||
if (systemContents.length === 0) {
|
|
||||||
return requestBody
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合并 system 内容到第一条 user 消息
|
|
||||||
const systemText = systemContents.join('\n\n')
|
|
||||||
let transformedMessages = nonSystemMessages
|
|
||||||
|
|
||||||
// 查找第一条 user 消息
|
|
||||||
const firstUserIndex = nonSystemMessages.findIndex((m) => m && m.role === 'user')
|
|
||||||
|
|
||||||
if (firstUserIndex !== -1) {
|
|
||||||
// 将 system 内容前置到第一条 user 消息
|
|
||||||
const firstUserMsg = nonSystemMessages[firstUserIndex]
|
|
||||||
const mergedContent = `${systemText}\n\n${firstUserMsg.content}`
|
|
||||||
transformedMessages = [...nonSystemMessages]
|
|
||||||
transformedMessages[firstUserIndex] = {
|
|
||||||
...firstUserMsg,
|
|
||||||
content: mergedContent
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 如果没有 user 消息,创建一个包含 system 内容的 user 消息
|
|
||||||
logger.warn(
|
|
||||||
`⚠️ Console API: No user message found to merge system prompt, creating new user message with system content`
|
|
||||||
)
|
|
||||||
transformedMessages = [{ role: 'user', content: systemText }, ...nonSystemMessages]
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.debug(
|
|
||||||
`🔄 Console API: Transformed ${systemContents.length} system message(s) into user message context`
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
|
||||||
...requestBody,
|
|
||||||
messages: transformedMessages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 🚀 转发请求到Claude Console API
|
// 🚀 转发请求到Claude Console API
|
||||||
async relayRequest(
|
async relayRequest(
|
||||||
requestBody,
|
requestBody,
|
||||||
@@ -225,9 +163,6 @@ class ClaudeConsoleRelayService {
|
|||||||
model: mappedModel
|
model: mappedModel
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔄 转换 system messages (Console API 不支持 role="system")
|
|
||||||
const transformedRequestBody = this._transformSystemMessages(modifiedRequestBody)
|
|
||||||
|
|
||||||
// 模型兼容性检查已经在调度器中完成,这里不需要再检查
|
// 模型兼容性检查已经在调度器中完成,这里不需要再检查
|
||||||
|
|
||||||
// 创建代理agent
|
// 创建代理agent
|
||||||
@@ -284,7 +219,7 @@ class ClaudeConsoleRelayService {
|
|||||||
const requestConfig = {
|
const requestConfig = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: apiEndpoint,
|
url: apiEndpoint,
|
||||||
data: transformedRequestBody,
|
data: modifiedRequestBody,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'anthropic-version': '2023-06-01',
|
'anthropic-version': '2023-06-01',
|
||||||
@@ -714,9 +649,6 @@ class ClaudeConsoleRelayService {
|
|||||||
model: mappedModel
|
model: mappedModel
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔄 转换 system messages (Console API 不支持 role="system")
|
|
||||||
const transformedRequestBody = this._transformSystemMessages(modifiedRequestBody)
|
|
||||||
|
|
||||||
// 模型兼容性检查已经在调度器中完成,这里不需要再检查
|
// 模型兼容性检查已经在调度器中完成,这里不需要再检查
|
||||||
|
|
||||||
// 创建代理agent
|
// 创建代理agent
|
||||||
@@ -724,7 +656,7 @@ class ClaudeConsoleRelayService {
|
|||||||
|
|
||||||
// 发送流式请求
|
// 发送流式请求
|
||||||
await this._makeClaudeConsoleStreamRequest(
|
await this._makeClaudeConsoleStreamRequest(
|
||||||
transformedRequestBody,
|
modifiedRequestBody,
|
||||||
account,
|
account,
|
||||||
proxyAgent,
|
proxyAgent,
|
||||||
clientHeaders,
|
clientHeaders,
|
||||||
|
|||||||
Reference in New Issue
Block a user