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

Add support for Ollama #1740

Merged
merged 1 commit into from
Apr 25, 2024
Merged

Conversation

Menghuan1918
Copy link
Contributor

基本测试没发现问题:

图片

图片

不过依然存在一些问题:

1.在代码中依然使用的

response=requests.post(endpoint,headers=headers,proxies=proxies,json=payload,stream=True,timeout=TIMEOUT_SECONDS);

进行请求,然而考虑到ollama是本地运行的,有必要使用proxies吗?

2.ollama的图形支持没完成

@binary-husky binary-husky merged commit 7e04452 into binary-husky:frontier Apr 25, 2024
1 check passed
binary-husky added a commit that referenced this pull request Apr 30, 2024
* Update version to 3.74

* Add support for Yi Model API (#1635)

* 更新以支持零一万物模型

* 删除newbing

* 修改config

---------

Co-authored-by: binary-husky <qingxu.fu@outlook.com>

* Refactor function signatures in bridge files

* fix qwen api change

* rename and ref functions

* rename and move some cookie functions

* 增加haiku模型,新增endpoint配置说明 (#1626)

* haiku added

* 新增haiku,新增endpoint配置说明

* Haiku added

* 将说明同步至最新Endpoint

---------

Co-authored-by: binary-husky <qingxu.fu@outlook.com>

* private_upload目录下进行文件鉴权 (#1596)

* private_upload目录下进行文件鉴权

* minor fastapi adjustment

* Add logging functionality to enable saving
conversation records

* waiting to fix username retrieve

* support 2rd web path

* allow accessing default user dir

---------

Co-authored-by: binary-husky <qingxu.fu@outlook.com>

* remove yaml deps

* fix favicon

* fix abs path auth problem

* forget to write a return

* add `dashscope` to deps

* fix GHSA-v9q9-xj86-953p

* 用户名重叠越权访问patch (#1681)

* add cohere model api access

* cohere + can_multi_thread

* fix block user access(fail)

* fix fastapi bug

* change cohere api endpoint

* explain version

* # fix com_zhipuglm.py illegal temperature problem (#1687)

* Update com_zhipuglm.py

# fix 用户在使用 zhipuai 界面时遇到了关于温度参数的非法参数错误

* allow store lm model dropdown

* add a btn to reverse previous reset

* remove extra fns

* Add support for glm-4v model (#1700)

* 修改chatglm3量化加载方式 (#1688)

Co-authored-by: zym9804 <ren990603@gmail.com>

* save chat stage 1

* consider null cookie situation

* 在点击复制按钮时激活语音

* miss some parts

* move all to js

* done first stage

* add edge tts

* bug fix

* bug fix

* remove console log

* bug fix

* bug fix

* bug fix

* audio switch

* update tts readme

* remove tempfile when done

* disable auto audio follow

* avoid play queue update after shut up

* feat: minimizing common.js

* improve tts functionality

* deterine whether the cached model is in choices

* Add support for Ollama (#1740)

* print err when doc2x not successful

* add icon

* adjust url for doc2x key version

* prepare merge

---------

Co-authored-by: Menghuan1918 <menghuan2003@outlook.com>
Co-authored-by: Skyzayre <120616113+Skyzayre@users.noreply.github.com>
Co-authored-by: XIao <46100050+Kilig947@users.noreply.github.com>
Co-authored-by: Yuki <903728862@qq.com>
Co-authored-by: zyren123 <91042213+zyren123@users.noreply.github.com>
Co-authored-by: zym9804 <ren990603@gmail.com>
@Menghuan1918 Menghuan1918 deleted the ollama branch May 9, 2024 03:10
@ME-Msc
Copy link

ME-Msc commented May 11, 2024

请问如何接入ollama?谢谢

@Menghuan1918
Copy link
Contributor Author

Menghuan1918 commented May 13, 2024

请问如何接入ollama?谢谢

如果是直接调用本地的的ollama(即地址是 http://localhost:11434/api/chat) 的话,直接往AVAIL_LLM_MODELS里面加模型名字,"ollama-"开头,中间是模型名字,(max_token=xxxx)结尾,比如:

AVAIL_LLM_MODELS = ["yi-34b-chat-200k","ollama-phi3(max_token=4096)","ollama-llama3(max_token=8000)"]

如果不是本地或者其他地址,还要加一个:

API_URL_REDIRECT = {"http://localhost:11434/api/chat": "这儿放你的ollama请求地址"}

@Bardbo
Copy link

Bardbo commented May 13, 2024

您好,请问按照您提供的接入方法,出现下列错误,这是为什么呢?ollama本地端口为8000,我是如下设置的config_private.py文件:

LLM_MODEL = "ollama-gemma(max_token=4096)" # 可选 ↓↓↓
AVAIL_LLM_MODELS = ["ollama-gemma(max_token=4096)", "ollama-llama3(max_token=4096)", "ollama-qwen:7b(max_token=4096)", "ollama-tinyllama(max_token=4096)"]
API_URL_REDIRECT = {"http://localhost:11434/api/chat":"http://localhost:8000"}

报错为:

[Local Message] 异常

Traceback (most recent call last):
  File ".\request_llms\bridge_ollama.py", line 193, in predict
    gpt_replying_buffer = gpt_replying_buffer + chunkjson['message']["content"]
                                                ~~~~~~~~~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

404 page not found

@Menghuan1918
Copy link
Contributor Author

API_URL_REDIRECT = {"http://localhost:11434/api/chat":"http://localhost:8000"}

这个部分应该是:

API_URL_REDIRECT = {"http://localhost:11434/api/chat":"http://localhost:8000/api/chat"}

@Bardbo
Copy link

Bardbo commented May 13, 2024

谢谢您,我刚刚也发现了,您回复速度好快!已解决!

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.

None yet

4 participants