ItzCrazyKns / Perplexica

Perplexica is an AI-powered search engine. It is an Open source alternative to Perplexity AI
MIT License
16.45k stars 1.54k forks source link

Axios exception broke backend, and also broke thread #368

Open aledalgrande opened 2 months ago

aledalgrande commented 2 months ago

Describe the bug

I was in a 4-5 messages deep search thread and at a certain point the loading icon kept spinning with no result. So I looked in the BE logs and I found:

error: Unhandled Rejection at: [object Promise], reason: AxiosError: Request failed with status code 400
error: Unhandled Rejection at: [object Promise], reason: AxiosError: Request failed with status code 400

I decided to restart that docker container. Then I refreshed the browser page and the UI was broken because I didn't have an input field any more so I couldn't continue the conversation. Even if I go to a new conversation and then visit the history and reopen this thread I cannot continue it.

I tried "rewrite" and that also failed.

New threads work normally.

To Reproduce

Unfortunately I don't know how to reproduce this. I am using Ollama with Llama 3.1 8B on a M1 Max 64GB. I think in dev it might be possible by trying to recreate a failed network request for the BE container/service.

Edit: It seems it was this in the search engine that then broke the BE:

ERROR:searx.engines.wolframalpha: HTTP requests timeout (search duration : 6.227550462000181 s, timeout: 6.0 s) : TimeoutException

Expected behavior

Ideally, a network issue would stop the loader state and show an error and allow to retry. Also threads shouldn't get into a broken state.

Screenshots

See empty bottom of the page:

Screenshot 2024-09-21 at 4 35 46 PM
ItzCrazyKns commented 1 month ago

Rewrite has been fixed in the latest commits, can you try creating a new chat and see if that works. (After updating)

ironicbadger commented 1 month ago

Using the example docker-compose.yaml I still see similar behavior.

perplexica-backend-1   | error: Unhandled Rejection at: [object Promise], reason: AxiosError: Request failed with status code 403
perplexica-backend-1   | error: Error in image search: Request failed with status code 403
perplexica-backend-1   | error: Unhandled Rejection at: [object Promise], reason: AxiosError: Request failed with status code 403

The chat just hangs until refreshed or a new chat is started. Happens most chats after 2-3+ responses.

ItzCrazyKns commented 4 weeks ago

What are the logs from SearXNG?

Using the example docker-compose.yaml I still see similar behavior.

perplexica-backend-1   | error: Unhandled Rejection at: [object Promise], reason: AxiosError: Request failed with status code 403
perplexica-backend-1   | error: Error in image search: Request failed with status code 403
perplexica-backend-1   | error: Unhandled Rejection at: [object Promise], reason: AxiosError: Request failed with status code 403

The chat just hangs until refreshed or a new chat is started. Happens most chats after 2-3+ responses.

susanin-ivan commented 2 weeks ago

Hi,

Have same issue, so at the issue time, the logs from SearXNG show empty query:

searxng | DEBUG searx.webapp : set locale en (from browser) searxng | [pid: 13|app: 0|req: 36/67] 172.27.0.1 () {36 vars in 554 bytes} [Sun Nov 10 18:15:07 2024] GET /search?format=json&q=&language=en => generated 21 bytes in 14 msecs (HTTP/1.1 400) 8 headers in 268 bytes (1 switches on core 2)

And before that empty query we can observe following warning from ollama:

ollama | time=2024-11-10T18:15:06.083Z level=WARN source=runner.go:126 msg="truncating input prompt" limit=2048 prompt=2207 numKeep=5

So, it looks like ollama did not return needed data (or RC), and then you send empty query to the SearXNG.

Hope this helps!