zhaobenny / bz-cogs

Interesting cogs for Red Bot
MIT License
23 stars 14 forks source link

Aimage Seems to timeout often #38

Closed Strider27 closed 6 months ago

Strider27 commented 6 months ago

Thanks for a handy cog, unfortunately it seems to timeout most of the time on lower end hardware.

I keep getting this 9 out of 10 times when running /imagine "Command 'imagine' raised an exception: NotFound: 404 Not Found" in the Docker log. Doing some googling shows that slash commands timeout after 3 seconds if no response is given, looks like my redbot instance is too slow. According to stackoverflow, one solution is to use defer(), any chance it can be tweaked?

zhaobenny commented 6 months ago

The response should be deferred already.

https://github.com/zhaobenny/bz-cogs/blob/dd573984b68c542f14d5757d659def474e6868bd/aimage/functions.py#L41

Just to confirm a few things:

Strider27 commented 6 months ago

Ok this might be long,

When it returns "The application did not respond" I get the following in the docker log

discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
[2024-02-19 20:30:51] [ERROR] red: Exception in command 'imagine'
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/aimage/aimage.py", line 184, in imagine_app
    await self.generate_image(interaction,
  File "/data/cogs/CogManager/cogs/aimage/functions.py", line 41, in generate_image
    await context.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
[2024-02-19 20:30:51] [ERROR] asyncio: Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py:1087> exception=NotFound('404 Not Found (error code: 10062): Unknown interaction')>
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/aimage/aimage.py", line 184, in imagine_app
    await self.generate_image(interaction,
  File "/data/cogs/CogManager/cogs/aimage/functions.py", line 41, in generate_image
    await context.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'imagine' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1089, in wrapper
    await self._call(interaction)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1252, in _call
    await self.on_error(interaction, e)
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 296, in on_error
    await self._send_from_interaction(
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 260, in _send_from_interaction
    return await interaction.response.send_message(*args, ephemeral=True, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 801, in send_message
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

When it gets stuck on " ...Scarlet is thinking" there is nothing in the docker logs.

Sometimes short prompts get through, i.e. /imagine prompt: black cat but have not been able to get a single complex prompt to work.

In all cases I barely notice any hardware utilisation by the docker container.

Strider27 commented 6 months ago

Additionally trying to upscale the occasionally successful prompts returns This interaction failed with the following in the docker log

discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
[2024-02-19 20:53:31] [ERROR] discord.ui.view: Ignoring exception in view <ImageActions timeout=300 children=4> for item <Button style=<ButtonStyle.secondary: 2> url=None disabled=True label=None emoji=<PartialEmoji animated=False name='🔄' id=None> row=None>
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/ui/view.py", line 427, in _scheduled_task
    await item.callback(interaction)
  File "/data/cogs/CogManager/cogs/aimage/views.py", line 69, in regenerate_image
    await self.generate_image(interaction, payload=self.payload)
  File "/data/cogs/CogManager/cogs/aimage/functions.py", line 41, in generate_image
    await context.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
zhaobenny commented 6 months ago

Thank you for the logs - your hardware shouldn't be bottlenecking the cog in any manner, and I doubt your SD endpoint is taking more then 15 minutes to generate pictures.

Can you swap to a branch where I add debugging logs? [p]add bz-cogs https://github.com/zhaobenny/bz-cogs/ 38-aimage-seems-to-timeout-often

The interaction is not deferring properly for some reason...

Strider27 commented 6 months ago

Here you go, This is what I get when it says The Application did not respond:

[2024-02-19 22:49:35] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - start generate_image function
[2024-02-19 22:49:35] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - Deferring message
[2024-02-19 22:49:35] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - object is <class 'discord.interactions.Interaction'>
[2024-02-19 22:49:35] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - raw data {
    "type": 1,
    "options": [
        {
            "value": "black cat",
            "type": 3,
            "name": "prompt"
        }
    ],
    "name": "imagine",
    "id": "1208583487888822325"
}
[2024-02-19 22:49:35] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - interaction created at 2024-02-19 22:49:35.848000+00:00
[2024-02-19 22:49:35] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - interaction expires at 2024-02-19 23:04:35.848000+00:00
[2024-02-19 22:49:35] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - interaction is expired: False
[2024-02-19 22:49:39] [ERROR] red: Exception in command 'imagine'
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/aimage/aimage.py", line 186, in imagine_app
    await self.generate_image(interaction,
  File "/data/cogs/CogManager/cogs/aimage/functions.py", line 48, in generate_image
    await context.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
[2024-02-19 22:49:39] [ERROR] asyncio: Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py:1087> exception=NotFound('404 Not Found (error code: 10062): Unknown interaction')>
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/aimage/aimage.py", line 186, in imagine_app
    await self.generate_image(interaction,
  File "/data/cogs/CogManager/cogs/aimage/functions.py", line 48, in generate_image
    await context.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'imagine' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1089, in wrapper
    await self._call(interaction)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1252, in _call
    await self.on_error(interaction, e)
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 296, in on_error
    await self._send_from_interaction(
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 260, in _send_from_interaction
    return await interaction.response.send_message(*args, ephemeral=True, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 801, in send_message
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
zhaobenny commented 6 months ago

Maybe it's taking more then 5 seconds before the deferral..

I added timers to the logs, can you pull the updates and output the logs again?

Strider27 commented 6 months ago

Sorry deleted last reply, didn't reload the cog after update, requested log output below:

[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - imagine_app called at 1708384318.6170866
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - start generate_image function
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - Deferring message
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - object is <class 'discord.interactions.Interaction'>
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - raw data {
    "type": 1,
    "options": [
        {
            "value": "black cat",
            "type": 3,
            "name": "prompt"
        }
    ],
    "name": "imagine",
    "id": "1208583487888822325"
}
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - interaction created at 2024-02-19 23:11:58.479000+00:00
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - interaction expires at 2024-02-19 23:26:58.479000+00:00
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - interaction is expired: False
[2024-02-19 23:11:58] [INFO] red.bz_cogs.aimage: gh issue troubleshoot - trying to defer at 1708384318.6378918
[2024-02-19 23:12:01] [ERROR] red: Exception in command 'imagine'
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/aimage/aimage.py", line 190, in imagine_app
    await self.generate_image(interaction,
  File "/data/cogs/CogManager/cogs/aimage/functions.py", line 50, in generate_image
    await context.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
[2024-02-19 23:12:02] [ERROR] asyncio: Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py:1087> exception=NotFound('404 Not Found (error code: 10062): Unknown interaction')>
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/aimage/aimage.py", line 190, in imagine_app
    await self.generate_image(interaction,
  File "/data/cogs/CogManager/cogs/aimage/functions.py", line 50, in generate_image
    await context.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'imagine' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1089, in wrapper
    await self._call(interaction)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1252, in _call
    await self.on_error(interaction, e)
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 296, in on_error
    await self._send_from_interaction(
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 260, in _send_from_interaction
    return await interaction.response.send_message(*args, ephemeral=True, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 801, in send_message
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
zhaobenny commented 6 months ago

Looks like it was taking more then >5 seconds somehow before the deferral call (guess that's python for you)

I pushed changes to the main branch to move the defers earlier, should be fixed there, let me know if it works.

Strider27 commented 6 months ago

Still getting the same error, also when bot is stuck "thinking" I got this in the log:

[2024-02-19 23:48:47] [WARNING] py.warnings: /data/cogs/CogManager/cogs/aimage/aimage.py:187: RuntimeWarning: coroutine 'Functions.send_response' was never awaited
  await self.generate_image(interaction,

Cant confirm if it pulled latest version, Any way to check what version I have?

I did the following: I removed debug branch with [p]repo delete bz-cogs added main branch with [p]repo add bz-cogs https://github.com/zhaobenny/bz-cogs Ran [p]repo update Then [p]cog update

It returned All installed cogs are already up to date

So deleted aimage with [p]cog uninstall aimage ran [p]repo update then [p]cog install bz-cogs aimage and load aimage

zhaobenny commented 6 months ago

Ran [p]repo update Then [p]cog update

Yup, looks right.

Some awaits were missing in the code. Should be resolved now by updating the cog for the final time...

Strider27 commented 6 months ago

Thanks for that, Updated,

Short prompts are now working reliably (Never mind, short prompts are still the same), longer prompts return: Prompt contains blacklisted words!

The prompt is A strikingly majestic MaineCoon cat, its fur exhibiting a stunning blend of colors, from rich browns to lustrous blacks, reminiscent of the intricate strokes of a master painter. Never mind this was working as intended, it was homing in on the last part in MaineCoon, but the issue with aimage blacklist list command is still present.

runing [p]aimage blacklist list returns Error in command 'aimage blacklist list'. Check your console or logs for details.

Logs show this:

[2024-02-20 00:04:33] [ERROR] red: Exception in command 'aimage blacklist list'
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
TypeError: Settings.blacklist_list() missing 1 required positional argument: 'ctx'

Running [p]aimageowner blacklist list results in no reply, the bot deleted the command though.

The blacklist is default, I looked at the source on GitHub no words match from the prompt.

Strider27 commented 6 months ago

Still getting this randomly, but not as often as before, for both short and longer prompts.

[2024-02-20 00:15:01] [ERROR] asyncio: Task exception was never retrieved
future: <Task finished name='CommandTree-invoker' coro=<CommandTree._from_interaction.<locals>.wrapper() done, defined at /data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py:1087> exception=NotFound('404 Not Found (error code: 10062): Unknown interaction')>
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 827, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/aimage/aimage.py", line 178, in imagine_app
    await interaction.response.defer(thinking=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 661, in defer
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'imagine' raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1089, in wrapper
    await self._call(interaction)
  File "/data/venv/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1252, in _call
    await self.on_error(interaction, e)
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 296, in on_error
    await self._send_from_interaction(
  File "/data/venv/lib/python3.11/site-packages/redbot/core/tree.py", line 260, in _send_from_interaction
    return await interaction.response.send_message(*args, ephemeral=True, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 801, in send_message
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
Strider27 commented 6 months ago

Also, clicking on the magnifying glass after the image is generated and then on view full results in the below:

[2024-02-20 00:30:13] [ERROR] discord.ui.view: Ignoring exception in view <ImageActions timeout=300 children=2> for item <Button style=<ButtonStyle.secondary: 2> url=None disabled=False label=None emoji=<PartialEmoji animated=False name='🔎' id=None> row=None>
Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/ui/view.py", line 427, in _scheduled_task
    await item.callback(interaction)
  File "/data/cogs/CogManager/cogs/aimage/views.py", line 50, in get_caption
    await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
  File "/data/venv/lib/python3.11/site-packages/discord/interactions.py", line 801, in send_message
    await adapter.create_interaction_response(
  File "/data/venv/lib/python3.11/site-packages/discord/webhook/async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
zhaobenny commented 6 months ago

runing [p]aimage blacklist list returns Error in command 'aimage blacklist list'. Check your console or logs for details.

Fixed this, another minor oversight again. (woops)

Still getting this randomly, but not as often as before, for both short and longer prompts.

Not sure why it's taking >5 seconds to defer the interaction when it's the first thing that occurs,

Does this occur with other slash commands? Does the bot have a good connection to Discord servers?

Strider27 commented 6 months ago

Does this occur with other slash commands?

Have no other slash commands enabled on Redbot but have another very basic discord bot on the same server in another container which uses 2 slash commands with no problems.

Does the bot have a good connection to Discord servers?

Seems to be, ping to discord voice servers 26ms, to local Google Cloud and Cloudflare datacentres under 30ms. Connection is 2Gbit Down, 200Mbit Up, with average ping of 14ms under load to a regional datacentre. No disconnects etc.

zhaobenny commented 6 months ago

Could you try other slash commands on Redbot?

Seems like you shouldn't be bottlenecked hardware/network wise, and the cog code should be fine enough. Not really sure what else could be the problem. 🤔

Strider27 commented 6 months ago

Could you try other slash commands on Redbot?

Oh Wow!!! enabled some other cogs with slash commands and you are right! Other Redbot slash commands are also intermittent, sorry for wasting your time! I guess now have to try to figure out what's going on with Redbot container. (a bot in another container has no issues with slash commands)

zhaobenny commented 6 months ago

No problem, got some minor bugs fixed anyways as part of it 😂