-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat: update zhipu embedding request to require dimensions and modify… #2334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… Dockerfile for domestic source
There was a problem hiding this 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
dimensionsfield 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.
| 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, |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
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.
| 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, |
| # RUN apk add --no-cache \ | ||
| # gcc \ | ||
| # musl-dev \ | ||
| # sqlite-dev \ | ||
| # build-base | ||
|
|
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
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.
| # 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
There was a problem hiding this comment.
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.
| # 替换为国内源(解决卡住问题) | |
| # Use a domestic mirror to resolve network issues (替换为国内源,解决卡住问题) |
feat: glm coding plan && kimi coding plan
… Dockerfile for domestic source
close #issue_number
我已确认该 PR 已自测通过,相关截图如下:
(此处放上测试通过的截图,如果不涉及前端改动或从 UI 上无法看出,请放终端启动成功的截图)