rexthecoder commited on
Commit
ac8786f
·
1 Parent(s): 67c7151

chore: added information

Browse files
Files changed (3) hide show
  1. main.py +11 -12
  2. src/agent/tools/text_summary.py +0 -2
  3. src/api.py +9 -0
main.py CHANGED
@@ -37,9 +37,7 @@ logger = logging.getLogger(__name__)
37
 
38
 
39
 
40
- async def hello(update: Update, context: CallbackContext) -> None:
41
- intro_text = f"🤖 Greetings human!🤗\nI'm a bot built by Rexthecoder\n🦾 I can do a lot of things"
42
- await update.message.reply_text(intro_text)
43
 
44
 
45
  # async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
@@ -76,16 +74,17 @@ def main():
76
 
77
 
78
  def run_agent(agent: GirlfriendGPT, as_api: bool = False) -> None:
 
79
  # For Debugging
80
- summary_handler = agent.conversation_summary_handler()
81
- agent.application.add_handler(summary_handler)
82
- agent.application.add_handler(CommandHandler('start', hello))
83
- # agent.application.add_handler(CommandHandler('summary', agent.conversation_summary))
84
- # agent.application.add_handler(MessageHandler(
85
- # filters.TEXT & ~filters.COMMAND, agent.create_response))
86
- agent.application.run_polling()
87
- # agent.application.add_handler(MessageHandler(
88
- # filters.TEXT & ~filters.COMMAND, agent.create_response))
89
 
90
 
91
  if __name__ == "__main__":
 
37
 
38
 
39
 
40
+
 
 
41
 
42
 
43
  # async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
 
74
 
75
 
76
  def run_agent(agent: GirlfriendGPT, as_api: bool = False) -> None:
77
+ agent.handlers()
78
  # For Debugging
79
+ # summary_handler = agent.conversation_summary_handler()
80
+ # agent.application.add_handler(summary_handler)
81
+ # agent.application.add_handler(CommandHandler('start', hello))
82
+ # # agent.application.add_handler(CommandHandler('summary', agent.conversation_summary))
83
+ # # agent.application.add_handler(MessageHandler(
84
+ # # filters.TEXT & ~filters.COMMAND, agent.create_response))
85
+ # agent.application.run_polling()
86
+ # # agent.application.add_handler(MessageHandler(
87
+ # # filters.TEXT & ~filters.COMMAND, agent.create_response))
88
 
89
 
90
  if __name__ == "__main__":
src/agent/tools/text_summary.py CHANGED
@@ -35,9 +35,7 @@ class ConversationSummary():
35
  "mrm8488/flan-t5-small-finetuned-samsum")
36
 
37
  async def summarize(self, input: str, words: int):
38
-
39
  logging.info(f"{input} {words}")
40
-
41
  input_ids = self.tokenizer(input, return_tensors="pt").input_ids
42
  outputs = self.model.generate(input_ids, max_length=words)
43
  decoded_output = self.tokenizer.decode(
 
35
  "mrm8488/flan-t5-small-finetuned-samsum")
36
 
37
  async def summarize(self, input: str, words: int):
 
38
  logging.info(f"{input} {words}")
 
39
  input_ids = self.tokenizer(input, return_tensors="pt").input_ids
40
  outputs = self.model.generate(input_ids, max_length=words)
41
  decoded_output = self.tokenizer.decode(
src/api.py CHANGED
@@ -20,6 +20,9 @@ class GirlFriendAIConfig():
20
  default="", description="Optional voice_id for ElevenLabs Voice Bot"
21
  )
22
 
 
 
 
23
 
24
  class GirlfriendGPT(LangChainAgentBot):
25
  """Deploy LangChain chatbots and connect them to Telegram."""
@@ -34,6 +37,12 @@ class GirlfriendGPT(LangChainAgentBot):
34
  # Run the bot until the user presses Ctrl-C
35
  # self.application.run_polling()
36
  self.token = token
 
 
 
 
 
 
37
 
38
  # async def echo(self, update: Update, context: CallbackContext) -> None:
39
  # """Echo the user message."""
 
20
  default="", description="Optional voice_id for ElevenLabs Voice Bot"
21
  )
22
 
23
+ async def hello(update: Update, context: CallbackContext) -> None:
24
+ intro_text = f"🤖 Greetings human!🤗\nI'm a bot built by Rexthecoder\n🦾 I can do a lot of things"
25
+ await update.message.reply_text(intro_text)
26
 
27
  class GirlfriendGPT(LangChainAgentBot):
28
  """Deploy LangChain chatbots and connect them to Telegram."""
 
37
  # Run the bot until the user presses Ctrl-C
38
  # self.application.run_polling()
39
  self.token = token
40
+
41
+ def handlers(self):
42
+ summary_handler = self.conversation_summary_handler()
43
+ self.application.add_handler(summary_handler)
44
+ self.application.add_handler(CommandHandler('start', hello))
45
+ self.application.run_polling()
46
 
47
  # async def echo(self, update: Update, context: CallbackContext) -> None:
48
  # """Echo the user message."""