Commit d32e151

benny-dou <60535774+benny-dou@users.noreply.github.com>
2026-05-21 02:25:02
chore(ai): treat `.tex` file as txt file
1 parent 0b25bbc
Changed files (1)
src
ai
src/ai/texts/contexts.py
@@ -74,7 +74,7 @@ async def single_openai_chat_context(client: Client, message: Message) -> dict:
     if info["mtype"] not in ["text", "photo", "audio", "voice", "video", "document", "web_page"]:
         return {}
 
-    extra_txt_extensions = [".sh", ".json", ".xml"]  # treat these as txt file
+    extra_txt_extensions = [".sh", ".json", ".xml", ".tex"]  # treat these as txt file
     extra_markdown_extensions = [".pdf", ".html", ".docx", ".pptx", ".xls", ".xlsx"]  # convert to markdown
 
     messages = await client.get_media_group(message.chat.id, message.id) if message.media_group_id else [message]
@@ -174,7 +174,7 @@ async def single_openai_response_context(client: Client, message: Message, opena
     if info["mtype"] not in ["text", "photo", "audio", "voice", "video", "document", "web_page"]:
         return {}
 
-    extra_txt_extensions = [".sh", ".json", ".xml"]  # treat these as txt file
+    extra_txt_extensions = [".sh", ".json", ".xml", ".tex"]  # treat these as txt file
     extra_markdown_extensions = [".html", ".docx", ".pptx", ".xls", ".xlsx"]  # convert to markdown
 
     messages = await client.get_media_group(message.chat.id, message.id) if message.media_group_id else [message]
@@ -414,7 +414,7 @@ async def single_anthropic_context(
     if info["mtype"] not in ["text", "photo", "audio", "voice", "video", "document", "web_page"]:
         return {}
 
-    extra_txt_extensions = [".sh", ".json", ".xml"]  # treat these as txt file
+    extra_txt_extensions = [".sh", ".json", ".xml", ".tex"]  # treat these as txt file
     extra_markdown_extensions = [".html", ".docx", ".pptx", ".xls", ".xlsx"]  # convert to markdown
 
     messages = await client.get_media_group(message.chat.id, message.id) if message.media_group_id else [message]