@@ -58,18 +58,19 @@ async def aireply(self, ctx, *, instructions: str = None):
5858 data = await tools .get_data (self .bot , ctx .guild .id )
5959
6060 history = await self .generate_history (ctx .channel )
61+ truncated_history = "\n " .join (history .splitlines ()[- 100 :])
6162 prompt = (
6263 "You are a Discord moderator for a server. The following is the entire history of "
6364 "the conversation between staff and the user. Please fill in the suitable response "
6465 "given the transcript. Only give 1 response option. Do not output additional text such "
6566 "as 'My response would be...'. Try to appear as supportive as possible.\n Here are "
6667 f"additional information you should consider (if any): { data [13 ]} \n Here are additional "
6768 f"instructions for your response (if any): { instructions } \n \n Full transcript: "
68- f"{ history } .\n \n Staff response: "
69+ f"{ truncated_history } .\n \n Staff response: "
6970 )
7071
7172 try :
72- response = await self .bot .ai . generate_content_async (prompt )
73+ response = await self .bot .ai_generate (prompt )
7374 except Exception :
7475 await ctx .send (ErrorEmbed ("Failed to generate a response." ))
7576 return
@@ -79,7 +80,7 @@ async def aireply(self, ctx, *, instructions: str = None):
7980 except (discord .Forbidden , discord .NotFound ):
8081 pass
8182
82- msg = await ctx .send (Embed ("AI Reply" , response . text [:2048 ]))
83+ msg = await ctx .send (Embed ("AI Reply" , response [:2048 ]))
8384
8485 await msg .add_reaction ("✅" )
8586 await msg .add_reaction ("❌" )
@@ -235,14 +236,14 @@ async def close_channel(self, ctx, reason, anon: bool = False):
235236
236237 if self .bot .ai is not None and data [7 ] == 1 :
237238 try :
238- summary = await self .bot .ai .generate_content_async (
239+ truncated_history = "\n " .join (history .splitlines ()[- 100 :])
240+ summary = await self .bot .ai_generate (
239241 "The following is the entire history of the conversation between staff and "
240- "the user. Please summarise the entire interaction into 1 or 2 sentences, "
241- "with at most 20 words. Only give 1 response option. Do not output "
242- "additional text such as 'My response would be...'.\n \n Full transcript:\n "
243- + history
242+ "the user. Please summarise the entire interaction into 1 or 2 sentences. "
243+ "Only give 1 response option. Do not output additional text such as 'Here "
244+ "is the summary...'.\n \n Full transcript:\n " + truncated_history
244245 )
245- embed .add_field ("AI Summary" , summary . text )
246+ embed .add_field ("AI Summary" , summary [: 1024 ] )
246247 except Exception :
247248 pass
248249
0 commit comments