Commit df7977c

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-04-10 02:12:16
chore(gpt): include Markdown files in contexts
1 parent 35dc3f6
Changed files (1)
src
src/llm/contexts.py
@@ -94,7 +94,7 @@ async def single_context(client: Client, message: Message) -> dict:
                     contexts.append({"type": "image_url", "image_url": {"url": f"data:image/{res['ext']};base64,{res['base64']}"}})
                 # elif info["mtype"] == "video":
                 #     media.append({"type": "video_url", "video_url": {"url": b64}})
-                elif info["mtype"] == "document" and info["mime_type"] == "text/plain":
+                elif info["mtype"] == "document" and info["mime_type"] in ["text/plain", "text/markdown"]:
                     res = await base64_media(client, msg)
                     contexts.append(
                         {
@@ -109,7 +109,7 @@ async def single_context(client: Client, message: Message) -> dict:
                     contexts.append({"type": "image_url", "image_url": {"url": f"{GPT.MEDIA_SERVER}/{Path(path).name}"}})
                 # elif info["mtype"] == "video":
                 #     media.append({"type": "video_url", "video_url": {"url": f"{GPT.MEDIA_SERVER}/{Path(path).name}"}})
-                elif info["mtype"] == "document" and info["mime_type"] == "text/plain":
+                elif info["mtype"] == "document" and info["mime_type"] in ["text/plain", "text/markdown"]:
                     contexts.append(
                         {
                             "type": "text",