mirror of
https://github.com/cdryzun/tg_bot_collections.git
synced 2025-08-05 05:06:43 +08:00
fix: some break change for markdown
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
@ -16,8 +16,12 @@ from telebot.util import smart_split
|
||||
from telegramify_markdown.customize import get_runtime_config
|
||||
from urlextract import URLExtract
|
||||
|
||||
get_runtime_config().markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
|
||||
get_runtime_config().markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
get_runtime_config().markdown_symbol.head_level_1 = (
|
||||
"📌" # If you want, Customizing the head level 1 symbol
|
||||
)
|
||||
get_runtime_config().markdown_symbol.link = (
|
||||
"🔗" # If you want, Customizing the link symbol
|
||||
)
|
||||
|
||||
T = TypeVar("T", bound=Callable)
|
||||
logger = logging.getLogger("bot")
|
||||
|
@ -6,7 +6,7 @@ from expiringdict import ExpiringDict
|
||||
from openai import OpenAI
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown import convert
|
||||
from telegramify_markdown import markdownify
|
||||
|
||||
from . import *
|
||||
|
||||
@ -150,7 +150,7 @@ def yi_pro_handler(message: Message, bot: TeleBot) -> None:
|
||||
player_message.append(
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": convert(s),
|
||||
"content": markdownify(s),
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -3,8 +3,7 @@ import time
|
||||
from expiringdict import ExpiringDict
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown import convert
|
||||
from telegramify_markdown.customize import markdown_symbol
|
||||
from telegramify_markdown import markdownify
|
||||
|
||||
from config import settings
|
||||
|
||||
@ -16,8 +15,6 @@ from ._utils import (
|
||||
logger,
|
||||
)
|
||||
|
||||
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
|
||||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
|
||||
CHATGPT_MODEL = settings.openai_model
|
||||
CHATGPT_PRO_MODEL = settings.openai_model
|
||||
@ -153,7 +150,7 @@ def chatgpt_pro_handler(message: Message, bot: TeleBot) -> None:
|
||||
player_message.append(
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": convert(s),
|
||||
"content": markdownify(s),
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -6,13 +6,10 @@ from anthropic import Anthropic, APITimeoutError
|
||||
from expiringdict import ExpiringDict
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown import convert
|
||||
from telegramify_markdown.customize import markdown_symbol
|
||||
from telegramify_markdown import markdownify
|
||||
|
||||
from ._utils import bot_reply_first, bot_reply_markdown, enrich_text_with_urls
|
||||
|
||||
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
|
||||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
|
||||
ANTHROPIC_API_KEY = environ.get("ANTHROPIC_API_KEY")
|
||||
ANTHROPIC_BASE_URL = environ.get("ANTHROPIC_BASE_URL")
|
||||
@ -155,7 +152,7 @@ def claude_pro_handler(message: Message, bot: TeleBot) -> None:
|
||||
player_message.append(
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": convert(s),
|
||||
"content": markdownify(s),
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -7,15 +7,12 @@ import cohere
|
||||
from expiringdict import ExpiringDict
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown import convert
|
||||
from telegramify_markdown.customize import markdown_symbol
|
||||
from telegramify_markdown import markdownify
|
||||
|
||||
from config import settings
|
||||
|
||||
from ._utils import bot_reply_first, bot_reply_markdown, enrich_text_with_urls
|
||||
|
||||
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
|
||||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
|
||||
COHERE_API_KEY = environ.get("COHERE_API_KEY")
|
||||
COHERE_MODEL = "command-r-plus" # command-r may cause Chinese garbled code, and non stream mode also may cause garbled code.
|
||||
@ -154,7 +151,7 @@ def cohere_handler(message: Message, bot: TeleBot) -> None:
|
||||
player_message.append(
|
||||
{
|
||||
"role": "Chatbot",
|
||||
"message": convert(s),
|
||||
"message": markdownify(s),
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -7,14 +7,9 @@ import time
|
||||
from dify_client import ChatClient
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown.customize import markdown_symbol
|
||||
|
||||
from ._utils import bot_reply_first, bot_reply_markdown, enrich_text_with_urls
|
||||
|
||||
# If you want, Customizing the head level 1 symbol
|
||||
markdown_symbol.head_level_1 = "📌"
|
||||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
|
||||
|
||||
def dify_handler(message: Message, bot: TeleBot) -> None:
|
||||
"""dify : /dify API_Key <question>"""
|
||||
|
@ -8,12 +8,9 @@ from google.generativeai import ChatSession
|
||||
from google.generativeai.types.generation_types import StopCandidateException
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown.customize import markdown_symbol
|
||||
|
||||
from ._utils import bot_reply_first, bot_reply_markdown, enrich_text_with_urls, logger
|
||||
|
||||
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
|
||||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
|
||||
GOOGLE_GEMINI_KEY = environ.get("GEMIMI_PRO_KEY")
|
||||
|
||||
|
@ -5,13 +5,10 @@ from expiringdict import ExpiringDict
|
||||
from groq import Groq
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown import convert
|
||||
from telegramify_markdown.customize import markdown_symbol
|
||||
from telegramify_markdown import markdownify
|
||||
|
||||
from ._utils import bot_reply_first, bot_reply_markdown, enrich_text_with_urls, logger
|
||||
|
||||
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
|
||||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
|
||||
LLAMA_API_KEY = environ.get("GROQ_API_KEY")
|
||||
LLAMA_MODEL = "llama-3.1-70b-versatile"
|
||||
@ -143,7 +140,7 @@ def llama_pro_handler(message: Message, bot: TeleBot) -> None:
|
||||
player_message.append(
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": convert(s),
|
||||
"content": markdownify(s),
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -5,14 +5,11 @@ from os import environ
|
||||
from expiringdict import ExpiringDict
|
||||
from telebot import TeleBot
|
||||
from telebot.types import Message
|
||||
from telegramify_markdown import convert
|
||||
from telegramify_markdown.customize import markdown_symbol
|
||||
from telegramify_markdown import markdownify
|
||||
from together import Together
|
||||
|
||||
from ._utils import bot_reply_first, bot_reply_markdown, enrich_text_with_urls, logger
|
||||
|
||||
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
|
||||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
|
||||
|
||||
QWEN_API_KEY = environ.get("TOGETHER_API_KEY")
|
||||
QWEN_MODEL = "Qwen/Qwen2-72B-Instruct"
|
||||
@ -145,7 +142,7 @@ def qwen_pro_handler(message: Message, bot: TeleBot) -> None:
|
||||
player_message.append(
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": convert(s),
|
||||
"content": markdownify(s),
|
||||
}
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user