Radosław Wolnik commited on
Commit
e989fed
·
1 Parent(s): 7d528e3
Files changed (3) hide show
  1. ChatAI/chat_ai.py +1 -1
  2. app.py +12 -12
  3. requirements.txt +1 -1
ChatAI/chat_ai.py CHANGED
@@ -1,4 +1,4 @@
1
  from transformers import pipeline
2
 
3
 
4
- pipe = pipeline("text2text-generation", model="google/flan-t5-xxl")
 
1
  from transformers import pipeline
2
 
3
 
4
+ pipe = pipeline("text-generation", model="microsoft/phi-2")
app.py CHANGED
@@ -2,33 +2,33 @@ import discord
2
  from discord.ext import commands
3
  from ChatAI.chat_ai import pipe as ai
4
 
 
5
  # Set up Discord bot intents and command prefix
6
  intents = discord.Intents.default()
7
  intents.message_content = True
8
  intents.messages = True
9
  bot = commands.Bot(command_prefix="!", intents=intents)
10
-
11
  # Dictionary to track message count per channel
12
  message_counts = {}
13
 
14
  @bot.event
15
  async def on_message(message):
16
  guild = message.guild # Get the guild (server) the message is from
17
- channel = message.channel
18
- if message.channel != discord.utils.get(guild.text_channels, name="ai_chatter"):
19
- print("not ai_chatter channel"); return;
20
- print("channel: ai_chatter")
21
 
22
- if message.author.bot:
23
- print("not taking own messages into count"); return;
 
24
 
25
- if message.author.name!="sandra_n": pass;
26
- print("I can see its you, sis"); await message.channel.send("I can see its you, sis")
 
27
 
28
- if message.channel.id not in message_counts: # Ensure tracking exists for this channel
 
29
  message_counts[message.channel.id] = 0
30
-
31
- message_counts[message.channel.id] += 1 # Increment message count
32
  print(message_counts[message.channel.id])
33
 
34
  messages = []
 
2
  from discord.ext import commands
3
  from ChatAI.chat_ai import pipe as ai
4
 
5
+
6
  # Set up Discord bot intents and command prefix
7
  intents = discord.Intents.default()
8
  intents.message_content = True
9
  intents.messages = True
10
  bot = commands.Bot(command_prefix="!", intents=intents)
 
11
  # Dictionary to track message count per channel
12
  message_counts = {}
13
 
14
  @bot.event
15
  async def on_message(message):
16
  guild = message.guild # Get the guild (server) the message is from
17
+ channel = discord.utils.get(guild.text_channels, name="ai_chatter")
 
 
 
18
 
19
+ # Verification
20
+ if message.channel != channel: return;
21
+ if message.author.bot: return;
22
 
23
+ # Per user
24
+ x = guild.members
25
+ if message.author.name=="sandra_n": await message.channel.send("I can see its you, sis");
26
 
27
+ # Ensure tracking exists for this channel
28
+ if message.channel.id not in message_counts:
29
  message_counts[message.channel.id] = 0
30
+ # Increment message count
31
+ message_counts[message.channel.id] += 1
32
  print(message_counts[message.channel.id])
33
 
34
  messages = []
requirements.txt CHANGED
@@ -2,4 +2,4 @@ transformers
2
  huggingface_hub==0.25.2
3
  discord.py
4
  discord
5
- TensorFlow>=2.0
 
2
  huggingface_hub==0.25.2
3
  discord.py
4
  discord
5
+ torch