Skip to content

Commit

Permalink
🔌 Plugins: Add paper comprehension prompt before reading arXiv papers
Browse files Browse the repository at this point in the history
💻 Code: 1. Adjust the beginning of the robot's reply message to not show the robot's name by default. The robot's name in the message can be turned on or off in the preferences. The TITLE environment variable can be used to control whether the robot's name is displayed.

2. Upgrade ModelMerge version to 0.6.2
  • Loading branch information
yym68686 committed May 29, 2024
1 parent 37dfcfd commit 76f04fc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
10 changes: 6 additions & 4 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ async def command_bot(update, context, language=None, prompt=translator_prompt,
message = [{"type": "text", "text": message}]
message = get_image_message(image_url, message, chatid)
await context.bot.send_chat_action(chat_id=chatid, action=ChatAction.TYPING)
title = f"`🤖️ {engine}`\n\n"
if PREFERENCES["TITLE"]:
title = f"`🤖️ {engine}`\n\n"
await getChatGPT(update, context, title, robot, message, chatid, messageid)
else:
message = await context.bot.send_message(
Expand Down Expand Up @@ -205,8 +206,9 @@ async def getChatGPT(update, context, title, robot, message, chatid, messageid):
text = message
modifytime = 0
time_out = 600
model_name = Users.get_config(chatid, "engine")
Frequency_Modification = 20
if "gemini" in title:
if "gemini" in model_name:
Frequency_Modification = 2
lastresult = title
tmpresult = ""
Expand All @@ -222,7 +224,7 @@ async def getChatGPT(update, context, title, robot, message, chatid, messageid):
image_has_send = 0

try:
for data in robot.ask_stream(text, convo_id=str(chatid), pass_history=pass_history, model=Users.get_config(chatid, "engine")):
for data in robot.ask_stream(text, convo_id=str(chatid), pass_history=pass_history, model=model_name):
if "🌐" not in data:
result = result + data
tmpresult = result
Expand All @@ -231,7 +233,7 @@ async def getChatGPT(update, context, title, robot, message, chatid, messageid):
if sum([line.strip().startswith("```") for line in result.split('\n')]) % 2 != 0:
tmpresult = tmpresult + "\n```"
tmpresult = title + tmpresult
if "claude" in title:
if "claude" in model_name:
tmpresult = claude_replace(tmpresult)
if "🌐" in data:
tmpresult = data
Expand Down
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def replace_with_asterisk(string, start=10, end=45):
"PASS_HISTORY": (os.environ.get('PASS_HISTORY', "True") == "False") == False,
"LONG_TEXT" : (os.environ.get('LONG_TEXT', "True") == "False") == False,
"FOLLOW_UP" : (os.environ.get('FOLLOW_UP', "False") == "False") == False,
"TITLE" : (os.environ.get('TITLE', "False") == "False") == False,
}

LANGUAGE = os.environ.get('LANGUAGE', 'English')
Expand Down
5 changes: 1 addition & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
--index-url https://pypi.python.org/simple/
pytz
python-dotenv
md2tgmd==0.2.2
ModelMerge==0.6.1
fake_useragent
oauth2client==3.0.0
ModelMerge==0.6.2
python-telegram-bot[webhooks,rate-limiter]==21.0.1
5 changes: 5 additions & 0 deletions utils/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
"en": "Long text merge",
"zh-hk": "長文本合併",
},
"TITLE": {
"zh": "标题",
"en": "Title",
"zh-hk": "標題",
},
"message_think": {
"zh": "`思考中💭`",
"en": "`thinking💭`",
Expand Down

0 comments on commit 76f04fc

Please sign in to comment.