AppFlowy-IO / AppFlowy

Bring projects, wikis, and teams together with AI. AppFlowy is an AI collaborative workspace where you achieve more without losing control of your data. The best open source alternative to Notion.
https://www.appflowy.io
GNU Affero General Public License v3.0
55.98k stars 3.64k forks source link

[Bug] OpenAI request gets stuck #4767

Closed suntorytimed closed 2 months ago

suntorytimed commented 6 months ago

Bug Description

I executed a command for the openAI Writer, but the execution got stuck with a spinning loading wheel. According to the logs no request is sent and openAI doesn't register a usage of the API key.

How to Reproduce

Use 0.5.0 from Flathub and execute an openAI Writer request with an OpenAPI API key and registered to a private hosted AppFlowy Cloud.

Expected Behavior

get a response from openAI

Operating System

openSUSE Tumbleweed

AppFlowy Version(s)

beginning with 0.5.0 (tested with each verison until 0.5.8)

Screenshots

image

Additional Context

No response

LucasXu0 commented 6 months ago

Hi, @suntorytimed. Was any error message displayed?

suntorytimed commented 6 months ago

@LucasXu0 I executed AppFlowy from terminal, but there are no log entries for errors or any request being sent to OpenAI. Is there any other way to get more verbose logging? The GUI gets stuck with the spinning wheel and needs to be closed and reopened to continue working on the document.

LucasXu0 commented 6 months ago

@suntorytimed Got it. By the way, could you confirm if the OpenAI key is valid?

smvueno commented 6 months ago

I have the same problem with latest on my mac m1 mabook air. The latest v0.5.0 only the right click text and spellcorrect works. The AI writing is not working.

The last version working version for me is [v0.4.3] (This version everything with AI works) AI writing is not working on versions [v0.4.4] - [v0.5.0]

suntorytimed commented 6 months ago

@LucasXu0 yes, the API key is valid and works with other requests outside of AppFlowy.

letanphuc commented 6 months ago

Hi all, I found that function _onGenerate() (file lib\plugins\document\presentation\editor_plugins\openai\widgets\auto_completion_node_widget.dart) got stuck because of following await calling:

I don't know why but it's seeming like all await calling are stuck.

suntorytimed commented 5 months ago

Issue persists with 0.5.3

theoden8 commented 5 months ago

And with 0.5.4

suntorytimed commented 4 months ago

Just here to say it's still an issue with 0.5.7. Which is quite unfortunate, as I consider the AI integration as a core functionality.

sverro2 commented 3 months ago

I didn't add any API key for openAI. When I try to ask AI by using '/' and selecting the option, I can ask my question, but when sending it, it just keeps spinning/loading. No option to abort. No error messages. My only option is to close the application and restart.

This is on Fedora with Flatpak installed version of AppFlowy.

wangtsiao commented 3 months ago

And with 0.5.9

wangtsiao commented 3 months ago

by the way, I am at a location that accessing openai should with a vpn proxy, still not clear how to set network proxy for AppFlowy.

DevOpsMage commented 3 months ago

I'm also seeing this issue as well on Windows 11 running Version 0.5.9.

image

kosta777 commented 3 months ago

Getting the same issue on Mac M3

suntorytimed commented 2 months ago

This issue also appears with the new functionality for AI chats.

suntorytimed commented 2 months ago

@appflowy @LucasXu0 is there anything we can provide as input for this issue? As is the AI capabilities of AppFlowy don't work since February.

annieappflowy commented 2 months ago

We fixed the OpenAI Writer block in v0.6.2 Could you please give it a try?

https://github.com/AppFlowy-IO/AppFlowy/assets/12026239/378f465f-0e28-4917-b943-e108dc4d24eb

suntorytimed commented 2 months ago

Will do as soon as the Flatpak for 0.6.2 got created 👍🏼

DevOpsMage commented 2 months ago

We fixed the OpenAI Writer block in v0.6.2 Could you please give it a try?

Screen.Recording.2024-07-02.at.10.00.06.PM.mov

I can confirm that the AI feature is now working. I'm assuming it is using the API key I provided before I updated the software. After the update I no longer have the option to set an API key to use for openai. So I'm not sure where we are pulling this information from now.

I also see there has been added support for Claude but yet again I don't see where an API key should be added for this either.

image

annieappflowy commented 2 months ago

Hi @DevOpsMage , Thank you for confirming that the feature works again.

We're switching from requiring users to provide API keys to offering AppFlowy AI services. You can consider it as the middle layer between AppFlowy end-user features and third-party AI providers. We're currently giving away free AI quota to our users. As you can see in the interface, you can select your preferred models to power AI inside AppFlowy. It's not completely done yet, as we're working on enabling local AI models for ultimate privacy.

Let me know if you have any questions!

suntorytimed commented 2 months ago

Couldn't verify the fix yet, as the Flatpak isn't released.

I am running my own AppFlowy Cloud instance and have my key added there. Updated it to the latest version just now, to make sure everything is fine on this end.

suntorytimed commented 2 months ago

Looks like it works, but I will have to fix my AI setup on the server-side :) {"code":1017,"message":"Invalid request:reqwest::Error { kind: Request, url: Url { scheme: \"http\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"ai\")), port: Some(5001), path: \"/completion/stream\", query: None, fragment: None }, source: Error { kind: Connect, source: Some(ConnectError(\"dns error\", Custom { kind: Uncategorized, error: \"failed to lookup address information: Name or service not known\" })) } }"}

suntorytimed commented 2 months ago

Can confirm it as fixed with my self-hosted AppFlowy Cloud now as well