feat: update zhipu embedding request to require dimensions and modify…#2334
feat: update zhipu embedding request to require dimensions and modify…#2334xiaopengooo0 wants to merge 1 commit into
Conversation
… Dockerfile for domestic source
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 | ||
|
|
There was a problem hiding this comment.
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 | ||
| # 替换为国内源(解决卡住问题) |
There was a problem hiding this comment.
[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 上无法看出,请放终端启动成功的截图)