mirror of
https://github.com/cdryzun/tg_bot_collections.git
synced 2025-04-29 00:27:09 +08:00
fix: make gemini safe to None
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
parent
9e5d5db767
commit
2952b81521
@ -22,16 +22,10 @@ generation_config = {
|
||||
}
|
||||
|
||||
safety_settings = [
|
||||
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
|
||||
{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
|
||||
{
|
||||
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
||||
"threshold": "BLOCK_MEDIUM_AND_ABOVE",
|
||||
},
|
||||
{
|
||||
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
|
||||
"threshold": "BLOCK_MEDIUM_AND_ABOVE",
|
||||
},
|
||||
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE"},
|
||||
{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE"},
|
||||
{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_NONE"},
|
||||
{"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_NONE"},
|
||||
]
|
||||
|
||||
# Global history cache
|
||||
|
@ -53,7 +53,6 @@ def yi_handler(message: Message, bot: TeleBot) -> None:
|
||||
player_message.pop()
|
||||
r = client.chat.completions.create(messages=player_message, model=YI_MODEL)
|
||||
content = r.choices[0].message.content.encode("utf8").decode()
|
||||
print(content)
|
||||
if not content:
|
||||
yi_reply_text = "yi did not answer."
|
||||
player_message.pop()
|
||||
@ -140,7 +139,6 @@ def yi_photo_handler(message: Message, bot: TeleBot) -> None:
|
||||
headers=headers,
|
||||
json=payload,
|
||||
).json()
|
||||
print(response)
|
||||
try:
|
||||
text = response["choices"][0]["message"]["content"].encode("utf8").decode()
|
||||
bot.reply_to(message, "yi vision answer:\n" + text)
|
||||
|
Loading…
x
Reference in New Issue
Block a user