chore: update something
Browse files- docsifer/router.py +1 -4
- requirements.txt +2 -2
docsifer/router.py
CHANGED
@@ -5,7 +5,6 @@ import json
|
|
5 |
import tempfile
|
6 |
import os
|
7 |
import aiohttp
|
8 |
-
import mimetypes
|
9 |
from pathlib import Path
|
10 |
|
11 |
from fastapi import APIRouter, HTTPException, UploadFile, File, Form, BackgroundTasks
|
@@ -67,10 +66,8 @@ async def convert_document(
|
|
67 |
# If a file is provided, use the existing flow
|
68 |
if file is not None:
|
69 |
with tempfile.TemporaryDirectory() as tmpdir:
|
|
|
70 |
contents = await file.read()
|
71 |
-
guessed_ext = mimetypes.guess_extension(file.content_type) or ".tmp"
|
72 |
-
new_name = f"{Path(file.filename).stem}{guessed_ext}"
|
73 |
-
temp_path = Path(tmpdir) / new_name
|
74 |
temp_path.write_bytes(contents)
|
75 |
result, token_count = await docsifer_service.convert_file(
|
76 |
file_path=str(temp_path),
|
|
|
5 |
import tempfile
|
6 |
import os
|
7 |
import aiohttp
|
|
|
8 |
from pathlib import Path
|
9 |
|
10 |
from fastapi import APIRouter, HTTPException, UploadFile, File, Form, BackgroundTasks
|
|
|
66 |
# If a file is provided, use the existing flow
|
67 |
if file is not None:
|
68 |
with tempfile.TemporaryDirectory() as tmpdir:
|
69 |
+
temp_path = Path(tmpdir) / file.filename
|
70 |
contents = await file.read()
|
|
|
|
|
|
|
71 |
temp_path.write_bytes(contents)
|
72 |
result, token_count = await docsifer_service.convert_file(
|
73 |
file_path=str(temp_path),
|
requirements.txt
CHANGED
@@ -4,11 +4,11 @@ uvicorn
|
|
4 |
requests
|
5 |
pydantic
|
6 |
cachetools
|
7 |
-
upstash_redis==1.2.0
|
8 |
markitdown
|
|
|
|
|
9 |
openai==1.59.7
|
10 |
pyquery==2.0.1
|
11 |
tiktoken==0.8.0
|
12 |
-
scuid
|
13 |
aiohttp==3.11.11
|
14 |
python-magic==0.4.27
|
|
|
4 |
requests
|
5 |
pydantic
|
6 |
cachetools
|
|
|
7 |
markitdown
|
8 |
+
scuid
|
9 |
+
upstash_redis==1.2.0
|
10 |
openai==1.59.7
|
11 |
pyquery==2.0.1
|
12 |
tiktoken==0.8.0
|
|
|
13 |
aiohttp==3.11.11
|
14 |
python-magic==0.4.27
|