Spaces:
Running
Running
Update document_generator.py
Browse files- document_generator.py +17 -4
document_generator.py
CHANGED
@@ -456,10 +456,13 @@ class JsonDocumentResponse(BaseModel):
|
|
456 |
class JsonDocumentRequest(BaseModel):
|
457 |
query: str
|
458 |
template: bool = False
|
459 |
-
images: Optional[List[UploadFile]] =
|
460 |
-
|
461 |
conversation_id: str = ""
|
462 |
|
|
|
|
|
|
|
463 |
class MarkdownDocumentRequest(BaseModel):
|
464 |
json_document: Dict
|
465 |
query: str
|
@@ -553,9 +556,19 @@ async def generate_markdown_document_stream_endpoint(request: MarkdownDocumentRe
|
|
553 |
@cache(expire=600*24*7)
|
554 |
@router.post("/generate-document/json", response_model=JsonDocumentResponse)
|
555 |
async def generate_document_outline_endpoint(
|
556 |
-
|
557 |
-
|
|
|
|
|
|
|
558 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
ai_client = AIClient()
|
560 |
document_generator = DocumentGenerator(ai_client)
|
561 |
vision_tools = VisionTools(ai_client)
|
|
|
456 |
class JsonDocumentRequest(BaseModel):
|
457 |
query: str
|
458 |
template: bool = False
|
459 |
+
images: Optional[List[UploadFile]] = None
|
460 |
+
documents: Optional[List[UploadFile]] = None
|
461 |
conversation_id: str = ""
|
462 |
|
463 |
+
class Config:
|
464 |
+
arbitrary_types_allowed = True
|
465 |
+
|
466 |
class MarkdownDocumentRequest(BaseModel):
|
467 |
json_document: Dict
|
468 |
query: str
|
|
|
556 |
@cache(expire=600*24*7)
|
557 |
@router.post("/generate-document/json", response_model=JsonDocumentResponse)
|
558 |
async def generate_document_outline_endpoint(
|
559 |
+
query: str,
|
560 |
+
template: bool = False,
|
561 |
+
images: Optional[List[UploadFile]] = File(None),
|
562 |
+
documents: Optional[List[UploadFile]] = File(None),
|
563 |
+
conversation_id: str = ""
|
564 |
):
|
565 |
+
request = JsonDocumentRequest(
|
566 |
+
query=query,
|
567 |
+
template=template,
|
568 |
+
images=images,
|
569 |
+
documents=documents,
|
570 |
+
conversation_id=conversation_id
|
571 |
+
)
|
572 |
ai_client = AIClient()
|
573 |
document_generator = DocumentGenerator(ai_client)
|
574 |
vision_tools = VisionTools(ai_client)
|