Kilvoctu / aiyabot

A neat Discord bot for AUTOMATIC1111's Web UI
GNU General Public License v2.0
309 stars 79 forks source link

Crash on fresh install #46

Closed ChucklesTheBeard closed 1 year ago

ChucklesTheBeard commented 1 year ago

fresh install excluding .env which sets a URL and discord token.

C:\sd\aiyabot>git show
commit 61331b72c85ec120c9c6111c7610739cddfceb50 (HEAD -> main, origin/main, origin/HEAD)
Merge: 04b68e8 9353f79
Author: Kilvoctu <kilvoctu@zoho.com>
Date:   Tue Nov 8 23:29:48 2022 -0600

    Merge pull request #45 from Kilvoctu/model-activator-token

    Option to provide preset model activation token

C:\sd\aiyabot>git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

C:\sd\aiyabot>.\launch.bat

C:\sd\aiyabot>python -m venv venv

C:\sd\aiyabot>venv\Scripts\pip.exe install -r requirements.txt
Requirement already satisfied: py-cord in c:\sd\aiyabot\venv\lib\site-packages (from -r requirements.txt (line 1)) (2.2.2)
Requirement already satisfied: python-dotenv in c:\sd\aiyabot\venv\lib\site-packages (from -r requirements.txt (line 2)) (0.21.0)
Requirement already satisfied: requests in c:\sd\aiyabot\venv\lib\site-packages (from -r requirements.txt (line 3)) (2.28.1)
Requirement already satisfied: Pillow in c:\sd\aiyabot\venv\lib\site-packages (from -r requirements.txt (line 4)) (9.3.0)
Requirement already satisfied: aiohttp<3.9.0,>=3.6.0 in c:\sd\aiyabot\venv\lib\site-packages (from py-cord->-r requirements.txt (line 1)) (3.8.3)
Requirement already satisfied: idna<4,>=2.5 in c:\sd\aiyabot\venv\lib\site-packages (from requests->-r requirements.txt (line 3)) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\sd\aiyabot\venv\lib\site-packages (from requests->-r requirements.txt (line 3)) (1.26.12)
Requirement already satisfied: certifi>=2017.4.17 in c:\sd\aiyabot\venv\lib\site-packages (from requests->-r requirements.txt (line 3)) (2022.9.24)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\sd\aiyabot\venv\lib\site-packages (from requests->-r requirements.txt (line 3)) (2.1.1)
Requirement already satisfied: yarl<2.0,>=1.0 in c:\sd\aiyabot\venv\lib\site-packages (from aiohttp<3.9.0,>=3.6.0->py-cord->-r requirements.txt (line 1)) (1.8.1)
Requirement already satisfied: aiosignal>=1.1.2 in c:\sd\aiyabot\venv\lib\site-packages (from aiohttp<3.9.0,>=3.6.0->py-cord->-r requirements.txt (line 1)) (1.3.1)
Requirement already satisfied: attrs>=17.3.0 in c:\sd\aiyabot\venv\lib\site-packages (from aiohttp<3.9.0,>=3.6.0->py-cord->-r requirements.txt (line 1)) (22.1.0)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\sd\aiyabot\venv\lib\site-packages (from aiohttp<3.9.0,>=3.6.0->py-cord->-r requirements.txt (line 1)) (6.0.2)
Requirement already satisfied: frozenlist>=1.1.1 in c:\sd\aiyabot\venv\lib\site-packages (from aiohttp<3.9.0,>=3.6.0->py-cord->-r requirements.txt (line 1)) (1.3.3)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in c:\sd\aiyabot\venv\lib\site-packages (from aiohttp<3.9.0,>=3.6.0->py-cord->-r requirements.txt (line 1)) (4.0.2)

[notice] A new release of pip available: 22.2.1 -> 22.3.1
[notice] To update, run: C:\sd\aiyabot\venv\Scripts\python.exe -m pip install --upgrade pip

C:\sd\aiyabot>venv\Scripts\python.exe aiya.py
[2022-11-09 21:03:37] WARNING: PyNaCl is not installed, voice will NOT be supported
Using URL: http://localhost:9595
Using outputs directory: outputs
Traceback (most recent call last):
  File "C:\sd\aiyabot\aiya.py", line 19, in <module>
    settings.files_check()
  File "C:\sd\aiyabot\core\settings.py", line 134, in files_check
    sampler = s1['name']
TypeError: string indices must be integers

Python 3.10.6 Windows 10 Pro, 21H1

Solution: ...this is apparently what a connection problem looks like. Remember to launch a1111 with --listen --api etc...

Leaving the issue open - this needs a safety check to make sure it can talk to the api, and it needs to throw a reasonable error (ideally without immediately exiting when launched by double-clicking the .bat).

Kilvoctu commented 1 year ago

You are right, if the Web UI is not active, then AIYA will crash immediately. I've been meaning to put in a safety check, but I kept putting it off. It should be pretty simple to put in (an early version of AIYA did have a safety check actually), thanks for bringing it up.

Kilvoctu commented 1 year ago

All right, I pushed an update to have a checker for Web UI. She'll patiently wait for a connection and put out a message every 20s image Once a connection is made, then it'll proceed like normal.

The URL displayed is what's entered into the .env file. For --share users I know it's not perfect, since the URL is unknown until Web UI is launched, but it should be helpful to know when the Web UI is unreachable.

ChucklesTheBeard commented 1 year ago

It now waits for the main web ui to load, but not the api; if auto1111 is launched without --api, aiyabot will currently (edit: updated to 6ab86b2865d2745251caeb117382564df3179bf4 ) crash and disappear entirely when launched from explorer -> launch.bat, or show the following unhelpful error if launched from command prompt

Traceback (most recent call last):
  File "C:\sd\aiyabot\aiya.py", line 20, in <module>
    settings.files_check()
  File "C:\sd\aiyabot\core\settings.py", line 155, in files_check
    global_var.sampler_names.append(s1['name'])
TypeError: string indices must be integers

If launched without --api auto1111 will return {"detail":"Not Found"} at several endpoints including GET /sdapi/v1/options - this could be used to show a specific error and not proceed until the api is set up correctly.

Kilvoctu commented 1 year ago

I would hope that people are reading the setup instructions in the readme lol. 😅

I've added a simple check for the API. It'll try to get a response from one of the API endpoints; I chose one at random. If response is 404 / not found, then we get this image Then aiyabot closes. I tried a few ways to get it to wait like it does for general Web UI connection but was unsuccessful, so this is what I'm going with.

ChucklesTheBeard commented 1 year ago

You'd think so! Experience has taught me otherwise! :)

Solid error messages are also super useful for idiots like me who play with lots of different settings;

"I read the setup instructions when I originally set it up, sure, but now I want to use it again and it keeps crashing with this obscure error, wat do?"

Looks good, thank you!

Kilvoctu commented 1 year ago

Was there anything else, or do you think this particular issue is good to close? I just want to make sure.

ChucklesTheBeard commented 1 year ago

just couldn't close via email and haven't checked this account recently <3