Skip to content
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

fix: ali image model cannot be found and the error with the incorrect response_format #1470

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mlkt
Copy link

@mlkt mlkt commented May 25, 2024

修复 #1467 #1240 里提到的问题

1、发出真实请求前去除 "ali-" 的模型名称前缀;
2、ConvertImageRequest 转换请求完成后保存入上下文,用以修正返回时判断要求格式是否为 b64_json 无效的问题;

我已确认该 PR 已自测通过,相关截图如下,成功在 open-webui 里用阿里的 wanx-v1 模型生成图片并显示:
image
image

PS:话说我觉得 AdaptorConvertImageRequest 接口设计得有问题,为何别的方法都有 c *gin.Context 入参,就它没有?我觉得它应该也要加上

type Adaptor interface {
	Init(meta *meta.Meta)
	GetRequestURL(meta *meta.Meta) (string, error)
	SetupRequestHeader(c *gin.Context, req *http.Request, meta *meta.Meta) error
	ConvertRequest(c *gin.Context, relayMode int, request *model.GeneralOpenAIRequest) (any, error)
	ConvertImageRequest(request *model.ImageRequest) (any, error)
	DoRequest(c *gin.Context, meta *meta.Meta, requestBody io.Reader) (*http.Response, error)
	DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode)
	GetModelList() []string
	GetChannelName() string
}

@songquanpeng
Copy link
Owner

Hi,现在有一个问题是提交 PR 时用的是你的 main 分支,现在上面有其他改动,请问可以只针对 fix 单独起一个分支吗?

# Conflicts:
#	relay/adaptor/openai/adaptor.go
#	relay/controller/text.go
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.

2 participants