JHubi1 / ollama-app

A modern and easy-to-use client for Ollama
Apache License 2.0
241 stars 17 forks source link

How to connect to a host? #18

Open dk-0206 opened 2 weeks ago

dk-0206 commented 2 weeks ago

I am completely new to this as I just read about it on reddit. Can someone help me how to connect it to the host or what are the steps to follow for it to work properly as i don't know what to do.

JHubi1 commented 2 weeks ago

I assume you have Ollama running on a PC in your local network.

Firstly, follow the steps discussed in #5 to make Ollama accessible from your phone.

After that, you have to find your PCs local IP. You can do that by either going to your router's device list or getting it in windows CMD (just google "windows get local IP").

Then enter the following in the host field: "http://[ip]:11434"

dk-0206 commented 1 week ago

Actually I have ollama running on my android 14 (pixel). Can you help what to write in this host. Should i put my ip in place of localhost or my local ip from router?Screenshot_20240616-223912.png

JHubi1 commented 1 week ago

Have you done something similar to those steps? They seem to work, but I haven't tested it myself

https://github.com/JHubi1/ollama-app/issues/19#issuecomment-2156793465

Sandeep-Devleloper commented 1 week ago

yes that ,invalid host problem,i ve searched allover net to find a solution for it ,but i didn't found anything,please help in this connecting to host

JHubi1 commented 1 week ago

When you enter the host you used into your browser (on your phone), can you access it?

hackmannbr commented 1 week ago

I may be wrong, but I think there are a few problems there...

  1. if you try to connect to localhost you are trying to connect to ollama server inside in your phone (doesn't exist). You should use your ollama server ip (computer). Since ollama server runs localhost (127.0.0.1) by default, you will need to change ollama server to listening on all local interfaces (0.0.0.0), so you will connect through your computer ip.

  2. Even if you manage to run ollama locally on your phone, I think there is another problem... If I remember correct, android doesn't accept cleartext connection by default (...http), you need to do a small change on android code (AndroidManifest.xml) and set to accept it:

android:usesCleartextTraffic="true"

Cheerz

JHubi1 commented 1 week ago

I can confirm the first one. As already stated above you have to follow #5 to set the host on the server.

The second one shouldn't be an issue, someone in #19 managed to bring it to work without any modifications.

makanimike commented 1 week ago

are we allowed to latch onto this issue, or should I create a new one?

I have this issue as well. My ollama is running on my NAS server. I can connect perfectly fine from the same phone using the browser. But in the ollama app it just gives me the "issue: invalid host" error. (and it doesn't even appear to try)

JHubi1 commented 1 week ago

Nah, writing here is fine. What text is shown in the browser? The app checks for the content, maybe that's the cause of the issue

makanimike commented 1 week ago

If I am not logged in on the phone it just goes to the login screen. Otherwise it goes straight to the main page of ollama.

Screenshot_20240620-131844

I kinda feel like I am misunderstanding your question, perhaps...? :)

JHubi1 commented 1 week ago

No no, that's exactly what I asked for. But Ollama App (this repo) is a client for Ollama, not for the UI you're using

makanimike commented 1 week ago

I am running a self-hosted instance of ollama. The truenas scale kubernetes implementation which is just (should be) the docker ollama instance. https://github.com/ollama/ollama

Surely, I must be real thick right now, and missing something incredibly basic....

JHubi1 commented 1 week ago

The host you entered is not an Ollama host, but a frontend. If the host is correct, it should show this exact message: Screenshot_20240620-143013~2.png

makanimike commented 1 week ago

ok. got it.

simple solution in case anyone else runs into this:

in > Settings > Connections you will find the Ollama Base URL which this app wants. You almost certainly only have to replace the port with 11434.