GithubHelp home page GithubHelp logo

Comments (5)

liangjs avatar liangjs commented on June 26, 2024 1

也许可以采取更通用的方式,支持使用渠道特定的URL来覆盖requestURL,这样可以同时解决 #1472 的问题。

from one-api.

bincooo avatar bincooo commented on June 26, 2024

有v1才是标准接口,不因该去迁就非标准吧

from one-api.

liangjs avatar liangjs commented on June 26, 2024

我并不是想要抛弃目前的v1标准接口,而是同时兼容其他不带有v1路径的接口。有很多外部模型不是openai标准一模一样的接口,比如本项目目前已适配的AzureOpenAI、Minimax、CloudFlare等等。
具体的实现方式,比如可以在“自定义渠道”里加个选项,在此GetFullRequestURL函数中判断一下是否删除v1前缀即可。

func GetFullRequestURL(baseURL string, requestURL string, channelType int) string {
fullRequestURL := fmt.Sprintf("%s%s", baseURL, requestURL)
if strings.HasPrefix(baseURL, "https://gateway.ai.cloudflare.com") {
switch channelType {
case channeltype.OpenAI:
fullRequestURL = fmt.Sprintf("%s%s", baseURL, strings.TrimPrefix(requestURL, "/v1"))
case channeltype.Azure:
fullRequestURL = fmt.Sprintf("%s%s", baseURL, strings.TrimPrefix(requestURL, "/openai/deployments"))
}
}
return fullRequestURL
}

from one-api.

ye4293 avatar ye4293 commented on June 26, 2024

个人感觉自定义渠道那个地方应该改成自定义完整的请求路径,但是这个做法没有一个完善的方案,因为不兼容openai路径的请求模型,我相信也不兼容openai的请求格式

from one-api.

lyra-ai avatar lyra-ai commented on June 26, 2024

I hope this gets added too, there's more and more websites now that have OpenAI formatting but uses something like /api/chat/completions or /something/chat/completions.

from one-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.