Jeffser / Alpaca

An Ollama client made with GTK4 and Adwaita
https://jeffser.com/alpaca
GNU General Public License v3.0
419 stars 44 forks source link

Remote Models with dashes in the name cause an exception. #159

Closed ProjectMoon closed 3 months ago

ProjectMoon commented 3 months ago

Describe the bug If a model has a dash in the name (not tag), calls to /api/chat fail for some reason. So a model like my-model:latest will fail, but not mymodel:lat-test.

I am not sure if this happens on localhost ollama. But it happens to me on both direct http connections over LAN and HTTPS connections over WAN.

Expected behavior Model responds.

Screenshots This happens after attempting to talk to a model like mistral-nemo:instruct. But a model named mistral:nemo works just fine.

image

Additional context At first, I thought this was OpenWebUI having issues, but it also happens when connecting directly to the ollama server remotely. I proxy ollama via OpenWebUI for external connections. The same behavior occurs when using either OpenWebUI's ollama proxy API, or talking to ollama directly. Notably, there is a pretty big mess of exceptions in the OpenWebUI log when calling a model with a dash in it. OpenWebUI itself can talk to models with dashes in the name, along with other clients like gptel for Emacs and the aichat CLI tool, so this narrows the problem to Alpaca. It's a very odd problem. Maybe some kind of URL encoding issue?

Jeffser commented 3 months ago

I'm looking into this, thanks for the report

Jeffser commented 3 months ago

yeah I found out what is causing this error, normally when a model has a '-' it gets replaced with a space, but it doesn't revert that space back to '-' when sending a request to Ollama, so it doesn't know what to do with a model with a space in the name.

The fix should be ready and pushed to Flathub in a couple of hours!

Jeffser commented 3 months ago

Fixed!

image