Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ./VERSION) npm run buil

FROM golang:alpine AS builder2

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

ENV GO111MODULE=on \
CGO_ENABLED=1 \
GOOS=linux
# 替换为国内源(解决卡住问题)

Copilot AI Nov 22, 2025

Copy link

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.
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk add --no-cache gcc musl-dev sqlite-dev build-base

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

Comment on lines +23 to +28

Copilot AI Nov 22, 2025

Copy link

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.
# 设置 Go 环境 + 国内代理
ENV CGO_ENABLED=1 \
GOOS=linux \
GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct

WORKDIR /build

Expand Down
6 changes: 6 additions & 0 deletions relay/adaptor/zhipu/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,15 @@ func ConvertEmbeddingRequest(request model.GeneralOpenAIRequest) (*EmbeddingRequ
if len(inputs) != 1 {
return nil, errors.New("invalid input length, zhipu only support one input")
}

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,
Comment on lines +138 to +145

Copilot AI Nov 22, 2025

Copy link

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.
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions relay/adaptor/zhipu/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type tokenData struct {
type EmbeddingRequest struct {
Model string `json:"model"`
Input string `json:"input"`
Dimensions int `json:"dimensions"`
}

type EmbeddingResponse struct {
Expand Down