Skip to content

Conversation

@xiaopengooo0
Copy link

… Dockerfile for domestic source

close #issue_number

我已确认该 PR 已自测通过,相关截图如下:
(此处放上测试通过的截图,如果不涉及前端改动或从 UI 上无法看出,请放终端启动成功的截图)

Copilot AI review requested due to automatic review settings November 22, 2025 07:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds mandatory dimensions parameter support for Zhipu embedding requests and optimizes the Dockerfile build process for domestic (Chinese) users by configuring mirrors and proxies.

Key Changes:

  • Added dimensions field to Zhipu embedding API request structure with validation
  • Modified Dockerfile to use Aliyun mirror for Alpine packages and added GOPROXY for faster Go module downloads in China

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
relay/adaptor/zhipu/model.go Added Dimensions field to EmbeddingRequest struct
relay/adaptor/zhipu/adaptor.go Added validation to require dimensions parameter and included it in the embedding request
Dockerfile Replaced Alpine repository with Aliyun mirror and added GOPROXY environment variable for domestic builds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +138 to +145
if request.Dimensions == 0 {
return nil, errors.New("dimensions is required for zhipu embedding request")
}

return &EmbeddingRequest{
Model: request.Model,
Input: inputs[0],
Dimensions: request.Dimensions,
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation assumes that 0 is invalid for dimensions, but this prevents legitimate use cases where dimensions=0 might be intentional or where the field is optional. Consider checking if the dimensions field was explicitly set (e.g., using a pointer type) versus defaulting to 0.

Suggested change
if request.Dimensions == 0 {
return nil, errors.New("dimensions is required for zhipu embedding request")
}
return &EmbeddingRequest{
Model: request.Model,
Input: inputs[0],
Dimensions: request.Dimensions,
if request.Dimensions == nil {
return nil, errors.New("dimensions is required for zhipu embedding request")
}
return &EmbeddingRequest{
Model: request.Model,
Input: inputs[0],
Dimensions: *request.Dimensions,

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +28
# RUN apk add --no-cache \
# gcc \
# musl-dev \
# sqlite-dev \
# build-base

Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed rather than left in the file. If this code needs to be preserved for reference, consider documenting the reason in a commit message or design document instead.

Suggested change
# RUN apk add --no-cache \
# gcc \
# musl-dev \
# sqlite-dev \
# build-base

Copilot uses AI. Check for mistakes.
ENV GO111MODULE=on \
CGO_ENABLED=1 \
GOOS=linux
# 替换为国内源(解决卡住问题)
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Comments in the Dockerfile are in Chinese. For better maintainability in international projects, consider using English comments or providing bilingual documentation.

Suggested change
# 替换为国内源解决卡住问题
# Use a domestic mirror to resolve network issues (替换为国内源解决卡住问题)

Copilot uses AI. Check for mistakes.
iceyarmu pushed a commit to iceyarmu/one-api that referenced this pull request Dec 3, 2025
feat: glm coding plan && kimi coding plan
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