trypromptly / LLMStack

No-code multi-agent framework to build LLM Agents, workflows and applications with your data
https://llmstack.trypromptly.com
Other
1.46k stars 219 forks source link

[v0.0.15] Unable to create app #48

Closed Moep90 closed 12 months ago

Moep90 commented 12 months ago

Describe the bug Since (I assume v0.0.13) I'm unable to create an app either from scratch nor from a quickstart template.

To Reproduce Steps to reproduce the behavior:

  1. unzip v0.0.13
  2. docker-compse pull
  3. docker-compose up -d
  4. docker-compose logs -f
  5. login admin and promptly
  6. click on Website Chatbot or any other (only tested a few)
  7. redirect to the login page
  8. remove /login from url and are able to start with 6 again

Expected behavior Ability to create a Website chatbot or else...

Version V0.0.13 - v0.0.15

Environment DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS" Docker version 24.0.5, build ced0996 Docker Compose version v2.20.3

Screenshots

Additional context

  1. Tested with latest Chrome and Firefox (client)
  2. cleared all cookies and site data
  3. tried in incognito window
llmstack-0015-nginx-1       | x.x.x.x - - [25/Sep/2023:06:38:39 +0000] "GET /api/apps/templates/website-chatbot HTTP/1.1" 200 7072 "http://172.16.78.12:3000/apps/templates/website-chatbot" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" "-"
llmstack-0015-nginx-1       | x.x.x.x - - [25/Sep/2023:06:38:40 +0000] "POST /api/apps HTTP/1.1" 403 111 "http://172.16.78.12:3000/apps/templates/website-chatbot" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" "-"
llmstack-0015-nginx-1       | x.x.x.x - - [25/Sep/2023:06:38:41 +0000] "GET /login HTTP/1.1" 200 1811 "http://172.16.78.12:3000/apps/templates/website-chatbot" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" "-"

As curl

$ curl 'http://x.x.x.x:3000/api/login' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en,de;q=0.9,en-GB;q=0.8,en-GB-oxendict;q=0.7' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: csrftoken=NUDAse24YXkiiW8gQ23ZUaUwccIjyi80; sessionid=vz3oz6myx3ku4opntowuvenigoru42pc' \
  -H 'DNT: 1' \
  -H 'Origin: http://x.x.x.x:3000' \
  -H 'Referer: http://x.x.x.x:3000/login' \
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' \
  -H 'X-CSRFToken: NUDAse24YXkiiW8gQ23ZUaUwccIjyi80' \
  --data-raw '{"username":"admin","password":"promptly"}' \
  --compressed \
  --insecure
{"detail":"Method \"GET\" not allowed."}
ajhai commented 12 months ago

@Moep90 do you see this in 0.0.15 too?

Moep90 commented 12 months ago

Version V0.0.13 - v0.0.15

Yes I observed it first in v0.0.13 and just tested the v0.0.15. THe issue might appear earlier but I only tested v0.0.7, v0.0.13 and v0.0.15 NOTE: I always start from scratch with no existing data.

ajhai commented 12 months ago

Can you share logs from llmstack-0015-api-1?

Moep90 commented 12 months ago

There are none:

[+] Running 8/0
 ✔ Container llmstack-0015-playwright-1  Running                                                                                                                                                                                         0.0s 
 ✔ Container llmstack-0015-postgres-1    Running                                                                                                                                                                                         0.0s 
 ✔ Container local-ai.example.com        Running                                                                                                                                                                                         0.0s 
 ✔ Container llmstack-0015-weaviate-1    Running                                                                                                                                                                                         0.0s 
 ✔ Container llmstack-0015-api-1         Running                                                                                                                                                                                         0.0s 
 ✔ Container llmstack-0015-redis-1       Running                                                                                                                                                                                         0.0s 
 ✔ Container llmstack-0015-rqworker-1    Running                                                                                                                                                                                         0.0s 
 ✔ Container llmstack-0015-nginx-1       Running                                                                                                                                                                                         0.0s 
llmstack-0015-api-1  | postgres:5432 - accepting connections
llmstack-0015-api-1  | Postgres is up - continuing
llmstack-0015-api-1  | Starting API server
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | Operations to perform:
llmstack-0015-api-1  |   Apply all migrations: account, admin, apiabstractor, apps, auth, authtoken, base, contenttypes, datasources, django_rq, flags, organizations, sessions, sites, socialaccount
llmstack-0015-api-1  | Running migrations:
llmstack-0015-api-1  |   Applying contenttypes.0001_initial... OK
llmstack-0015-api-1  |   Applying auth.0001_initial... OK
llmstack-0015-api-1  |   Applying account.0001_initial... OK
llmstack-0015-api-1  |   Applying account.0002_email_max_length... OK
llmstack-0015-api-1  |   Applying admin.0001_initial... OK
llmstack-0015-api-1  |   Applying admin.0002_logentry_remove_auto_add... OK
llmstack-0015-api-1  |   Applying admin.0003_logentry_add_action_flag_choices... OK
llmstack-0015-api-1  |   Applying apiabstractor.0001_initial... OK
llmstack-0015-api-1  |   Applying apps.0001_initial... OK
llmstack-0015-api-1  |   Applying apiabstractor.0002_initial... OK
llmstack-0015-api-1  |   Applying apiabstractor.0003_rename_processor_slugs... OK
llmstack-0015-api-1  |   Applying apps.0002_app_template_slug... OK
llmstack-0015-api-1  |   Applying apps.0003_appdata... OK
llmstack-0015-api-1  |   Applying apps.0004_app_data_from_app... OK
llmstack-0015-api-1  |   Applying apps.0005_appdata_version... OK
llmstack-0015-api-1  |   Applying apps.0006_app_read_accessible_by_app_write_accessible_by... OK
llmstack-0015-api-1  |   Applying apps.0007_migrate_access_permissions... OK
llmstack-0015-api-1  |   Applying contenttypes.0002_remove_content_type_name... OK
llmstack-0015-api-1  |   Applying auth.0002_alter_permission_name_max_length... OK
llmstack-0015-api-1  |   Applying auth.0003_alter_user_email_max_length... OK
llmstack-0015-api-1  |   Applying auth.0004_alter_user_username_opts... OK
llmstack-0015-api-1  |   Applying auth.0005_alter_user_last_login_null... OK
llmstack-0015-api-1  |   Applying auth.0006_require_contenttypes_0002... OK
llmstack-0015-api-1  |   Applying auth.0007_alter_validators_add_error_messages... OK
llmstack-0015-api-1  |   Applying auth.0008_alter_user_username_max_length... OK
llmstack-0015-api-1  |   Applying auth.0009_alter_user_last_name_max_length... OK
llmstack-0015-api-1  |   Applying auth.0010_alter_group_name_max_length... OK
llmstack-0015-api-1  |   Applying auth.0011_update_proxy_permissions... OK
llmstack-0015-api-1  |   Applying auth.0012_alter_user_first_name_max_length... OK
llmstack-0015-api-1  |   Applying authtoken.0001_initial... OK
llmstack-0015-api-1  |   Applying authtoken.0002_auto_20160226_1747... OK
llmstack-0015-api-1  |   Applying authtoken.0003_tokenproxy... OK
llmstack-0015-api-1  |   Applying organizations.0001_initial... OK
llmstack-0015-api-1  |   Applying base.0001_initial... OK
llmstack-0015-api-1  |   Applying base.0002_defaultprofile_localai_api_key_and_more... OK
llmstack-0015-api-1  |   Applying base.0003_defaultprofile_anthropic_api_key... OK
llmstack-0015-api-1  |   Applying datasources.0001_initial... OK
llmstack-0015-api-1  |   Applying datasources.0002_datasource_config_and_more... OK
llmstack-0015-api-1  |   Applying django_rq.0001_initial... OK
llmstack-0015-api-1  |   Applying flags.0012_replace_migrations_for_wagtail_independence... OK
llmstack-0015-api-1  |   Applying flags.0013_add_required_field... OK
llmstack-0015-api-1  |   Applying organizations.0002_organizationsettings_localai_api_key_and_more... OK
llmstack-0015-api-1  |   Applying organizations.0003_organizationsettings_anthropic_api_key_and_more... OK
llmstack-0015-api-1  |   Applying sessions.0001_initial... OK
llmstack-0015-api-1  |   Applying sites.0001_initial... OK
llmstack-0015-api-1  |   Applying sites.0002_alter_domain_unique... OK
llmstack-0015-api-1  |   Applying socialaccount.0001_initial... OK
llmstack-0015-api-1  |   Applying socialaccount.0002_token_max_lengths... OK
llmstack-0015-api-1  |   Applying socialaccount.0003_extra_data_default_dict... OK
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | Admin user created.
llmstack-0015-api-1  | Installed 38 object(s) from 1 fixture(s)
llmstack-0015-api-1  | Initial data loaded.
llmstack-0015-api-1  | 0 static files copied to '/code/llmstack/static', 340 unmodified.
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | Cache cleared successfully.
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [176] [INFO] Starting gunicorn 20.1.0
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [176] [INFO] Listening at: http://0.0.0.0:9000 (176)
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [176] [INFO] Using worker: uvicorn.workers.UvicornWorker
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [177] [INFO] Booting worker with pid: 177
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [178] [INFO] Booting worker with pid: 178
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [179] [INFO] Booting worker with pid: 179
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [180] [INFO] Booting worker with pid: 180
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [181] [INFO] Booting worker with pid: 181
llmstack-0015-api-1  | [2023-09-25 06:30:09 +0000] [182] [INFO] Booting worker with pid: 182
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | /usr/local/lib/python3.11/site-packages/pydub/utils.py:14: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
llmstack-0015-api-1  |   import audioop
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [179] [INFO] Started server process [179]
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [179] [INFO] Waiting for application startup.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [179] [INFO] ASGI 'lifespan' protocol appears unsupported.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [179] [INFO] Application startup complete.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [177] [INFO] Started server process [177]
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [177] [INFO] Waiting for application startup.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [177] [INFO] ASGI 'lifespan' protocol appears unsupported.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [177] [INFO] Application startup complete.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [181] [INFO] Started server process [181]
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [181] [INFO] Waiting for application startup.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [181] [INFO] ASGI 'lifespan' protocol appears unsupported.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [181] [INFO] Application startup complete.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [178] [INFO] Started server process [178]
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [178] [INFO] Waiting for application startup.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [178] [INFO] ASGI 'lifespan' protocol appears unsupported.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [178] [INFO] Application startup complete.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [180] [INFO] Started server process [180]
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [180] [INFO] Waiting for application startup.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [180] [INFO] ASGI 'lifespan' protocol appears unsupported.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [180] [INFO] Application startup complete.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [182] [INFO] Started server process [182]
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [182] [INFO] Waiting for application startup.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [182] [INFO] ASGI 'lifespan' protocol appears unsupported.
llmstack-0015-api-1  | [2023-09-25 06:30:13 +0000] [182] [INFO] Application startup complete.
ajhai commented 12 months ago

What do you see in llmstack-0015-api-1 logs when you try to open http://localhost:3000/api/apps/templates/website-chatbot?

I just downloaded 0.0.15 and brought it up from scratch on my mac without issues.

Edit: Actually, what do you see in llmstack-0015-api-1 logs when you create the app? Also, check if the app is created in the backend by going to http://localhost:3000/admin/apps/app/

Moep90 commented 12 months ago

no logs when trying to access http://x.x.x.x:3000/api/apps/templates/website-chatbot as well as http://x.x.x.x:3000/admin/apps/app/ no logs for both and both pages are loading normally.

Running it locally might work for me as well but I deploy it on a server and access it trough the network via IP

ajhai commented 12 months ago

Do you see any apps in http://x.x.x.x:3000/admin/apps/app/?

Moep90 commented 12 months ago

/admin/apps/app/?

yes

ajhai commented 12 months ago

Oh that means apps did create fine but somehow we ended up returning 403. Do you see those apps on / when you login into your account? I will see if I can reproduce this.

Also, try adding LOG_LEVEL=INFO to your env and stop and start containers to get more logs when you are seeing this error.

Moep90 commented 12 months ago

LOG_LEVEL=INFO

@ajhai ah oh sorry, I missunderstood. I can see this page but do not see any app.

image

I see this in the Chrome Console:

Uncaught (in promise) 
Object { stack: "q@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:29659\n11912/Te.xhr</</d/<@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:43980\nd@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:44125\nEventHandlerNonNull*11912/Te.xhr</<@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:44401\n11912/Te.xhr<@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:43317\nje@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:46881\nvalue@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:50521\n11912/</t/<@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:51000\n11912/r/<@http://x.x.x.x:3000/static/js/4353.6d6c72f8.chunk.js:1:24124\ncreateApp@http://x.x.x.x:3000/static/js/3967.3f8e73f2.chunk.js:1:10238\nNe@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:245126\nVe@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:245280\n34463/jr/<@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:265180\njr@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:265274\nDr@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:265691\n34463/Hr/<@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:271133\ncc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:334800\nRe@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:244258\nHr@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:266985\nqt@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:251381\n$t@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:251163\nEventListener.handleEvent*Br@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:266488\nIr@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:265887\n34463/Ur/<@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:266053\nUr@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:265997\nqu@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:317240\nwc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:337800\nbc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:337681\ngc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:337550\nmc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:337411\nlc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:334529\nBo@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:275165\n34463/kc/<@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:341005\nkc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:341010\noc@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:333470\nS@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:463454\nA@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:463987\nEventHandlerNonNull*36813@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:464158\nn@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:487551\n45296@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:465938\nn@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:487551\n34463@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:228366\nn@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:487551\n54164@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:358244\nn@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:487551\n1250@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:357929\nn@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:487551\n@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:492807\n@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:499452\n@http://x.x.x.x:3000/static/js/main.ed3d5fe6.js:2:499455\n", message: "Request failed with status code 403", name: "AxiosError", code: "ERR_BAD_REQUEST", config: {…}, request: XMLHttpRequest, response: {…} }
ajhai commented 12 months ago

Since you are not running locally, did you have allowed_hosts and csrf origins configured in your environment?

https://llmstack.ai/docs/getting-started/config

Moep90 commented 12 months ago

Since you are not running locally, did you have allowed_hosts and csrf origins configured in your environment?

https://llmstack.ai/docs/getting-started/config

Sure, it allows ALLOWED_HOSTS="127.0.0.1,localhost,x.x.x.x" and it worked with the exact settings on v0.0.7 already. Since then I just try to test your enhancements and stumple across several issues since then :smile:

ajhai commented 12 months ago

@Moep90 What does your CSRF_TRUSTED_ORIGINS look like?

Moep90 commented 12 months ago

@Moep90 What does your CSRF_TRUSTED_ORIGINS look like?

Unchanged so it should be the default

ajhai commented 12 months ago

Can you set CSRF_TRUSTED_ORIGINS=http://x.x.x.x:3000 in your env? I think that is the issue you are hitting (was able to reproduce this). Backend is failing requests because client is not allowed in csrf list. See the note below the video in https://llmstack.ai/docs/getting-started/introduction#:~:text=logging%20in.-,NOTE,-If%20you%20are.

The default list assumes the server is running on localhost/127.0.0.1.

Moep90 commented 12 months ago

Can you set CSRF_TRUSTED_ORIGINS=http://x.x.x.x:3000 in your env? I think that is the issue you are hitting (was able to reproduce this). Backend is failing requests because client is not allowed in csrf list. See the note below the video in https://llmstack.ai/docs/getting-started/introduction#:~:text=logging%20in.-,NOTE,-If%20you%20are.

The default list assumes the server is running on localhost/127.0.0.1.

This have fixed it.