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))
Warum ist das Ergebnis der Anforderung, in der Antwortvariablen nicht auszugeben? < /p> [code]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)
So I was trying to use the python chatterbot library to make a simple chatbot, I got a couple errors but after searching I was able to take care of them, but now I get this error and I dont know how...
Im Moment bin ich total verwirrt, warum meine Bewerbung nicht funktioniert. Ich meine, wenn ich eine Anfrage vom Postanwalt oder einem anderen API -Test -Tool sende, empfängt mein Backend diese...