Spaces:
Running
Running
Update document_generator.py
Browse files- document_generator.py +4 -4
document_generator.py
CHANGED
@@ -222,7 +222,7 @@ class MarkdownDocumentRequest(BaseModel):
|
|
222 |
json_document: Dict
|
223 |
query: str
|
224 |
|
225 |
-
|
226 |
document_generator.document_outline = document_outline
|
227 |
|
228 |
overall_objective = query
|
@@ -252,7 +252,7 @@ async def generate_document_stream(document_generator: DocumentGenerator, docume
|
|
252 |
"section_title": section_title,
|
253 |
"content": content
|
254 |
}
|
255 |
-
}) + "\n"
|
256 |
|
257 |
for subsection in section.get("Subsections", []):
|
258 |
subsection_title = subsection.get("Title", "")
|
@@ -268,13 +268,13 @@ async def generate_document_stream(document_generator: DocumentGenerator, docume
|
|
268 |
"section_title": subsection_title,
|
269 |
"content": content
|
270 |
}
|
271 |
-
}) + "\n"
|
272 |
|
273 |
markdown_document = MarkdownConverter.convert_to_markdown(document_generator.document_outline["Document"])
|
274 |
yield json.dumps({
|
275 |
"type": "complete_document",
|
276 |
"content": markdown_document
|
277 |
-
}) + "\n"
|
278 |
|
279 |
@cache(expire=600*24*7)
|
280 |
@router.post("/generate-document/json", response_model=JsonDocumentResponse)
|
|
|
222 |
json_document: Dict
|
223 |
query: str
|
224 |
|
225 |
+
def generate_document_stream(document_generator: DocumentGenerator, document_outline: Dict, query: str):
|
226 |
document_generator.document_outline = document_outline
|
227 |
|
228 |
overall_objective = query
|
|
|
252 |
"section_title": section_title,
|
253 |
"content": content
|
254 |
}
|
255 |
+
}, ensure_ascii=False) + "\n"
|
256 |
|
257 |
for subsection in section.get("Subsections", []):
|
258 |
subsection_title = subsection.get("Title", "")
|
|
|
268 |
"section_title": subsection_title,
|
269 |
"content": content
|
270 |
}
|
271 |
+
}, ensure_ascii=False) + "\n"
|
272 |
|
273 |
markdown_document = MarkdownConverter.convert_to_markdown(document_generator.document_outline["Document"])
|
274 |
yield json.dumps({
|
275 |
"type": "complete_document",
|
276 |
"content": markdown_document
|
277 |
+
}, ensure_ascii=False) + "\n"
|
278 |
|
279 |
@cache(expire=600*24*7)
|
280 |
@router.post("/generate-document/json", response_model=JsonDocumentResponse)
|