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

config openai translator #829

Merged
merged 4 commits into from
Jun 9, 2024
Merged

Conversation

xtyuns
Copy link
Member

@xtyuns xtyuns commented Jun 9, 2024

  1. Fix openai not using options
  2. Add flexible argument configuration to openai

@xtyuns xtyuns marked this pull request as ready for review June 9, 2024 10:05
@xtyuns
Copy link
Member Author

xtyuns commented Jun 9, 2024

@Pylogmon PTAL

@Pylogmon
Copy link
Member

Pylogmon commented Jun 9, 2024

一开始做这一步操作是为了兼容大部分人的写法,只写域名,自动补齐后面的 path,但是这样也会造成一定的局限性,我觉得可以加一个开关,是否自动补齐 path,默认打开,这样有更深入自定义 URL 的用户可以关闭开关后自定义 URL

@xtyuns
Copy link
Member Author

xtyuns commented Jun 9, 2024

这里删除掉 /v1 的原因是:随着 openai 服务多实例的支持,openai 服务可以添加一些 openai 风格的接口,但是它们的路径可能不是完全以 /v1/chat/completions 结尾,但是基本都会以 chat/completions 结尾,以智谱为例,它的请求地址是 https://open.bigmodel.cn/api/paas/v4/chat/completions

这个改动确定会影响原有用户的配置,因此我们能否把这块补全的逻辑修改为:

if (service === 'openai' && !requestPath.endsWith('/chat/completions')) {
    requestPath += '/v1/chat/completions';
}

这样既不会影响原有用户的配置,又可以支持上面举例中的场景

@Pylogmon
Copy link
Member

Pylogmon commented Jun 9, 2024

可以

@Pylogmon Pylogmon merged commit c1868d5 into master Jun 9, 2024
@xtyuns xtyuns deleted the feature/config-openai-translator branch June 12, 2024 11:45
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