-1

Why is the result of the request to Chatterbot not output in the response variable?

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import disnake as discord
from disnake import ApplicationCommandInteraction
from disnake.ext import commands


class KICog(commands.Cog):
    def __init__(self, bot):
        self.client = bot

    @commands.slash_command(
        name="ki",
        description="Interagiert mit dem Chaosgaming Chat-Bot",
        options=[
            discord.Option(
                type=discord.OptionType.string,
                name="sprache",
                description="Sprache der Interaktion mit dem Bot",
                required=True
            ),
            discord.Option(
                type=discord.OptionType.string,
                name="prompt",
                description="Prompt zur Verarbeitung in der Chaosgaming KI",
                required=True
            )
        ]
    ) 
    async def ki(self, interaction: ApplicationCommandInteraction, sprache=None, prompt=None):
        print("Sprache:" + sprache)
        print("Prompt:" + prompt)
        bot = ChatBot('Chaosgaming-KI')
        # Erstelle einen Trainer und trainiere den Chatbot mit den vordefinierten Corpusdaten
        trainer = ChatterBotCorpusTrainer(bot)

        trainer.train(
            "chatterbot.corpus.english")  # Passe die Sprache an, wenn du eine andere Sprache verwenden möchtest
        response = bot.get_response(prompt)
        print(response)
        await interaction.send(response, ephemeral=True)


def setup(bot):
    bot.add_cog(KICog(bot))
UpAndAdam
  • 4,515
  • 3
  • 28
  • 46

1 Answers1

0
  1. did you train the chatbot using any other data then removed the data or removed the function is so the chatterbot still remembers that training so you will have to manually change the chatterbots training data

  2. also training it with english corpus can confuse it just as mine does

  3. the file your looking for is usually in the same directory / folder as the .py script

Apex862-2
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 06 '23 at 23:03