mirror of
https://github.com/assafelovic/gpt-researcher.git
synced 2026-09-14 20:17:32 +08:00
add support markdown download
This commit is contained in:
@@ -1 +1,2 @@
|
||||
.git
|
||||
output/
|
||||
|
||||
+1
-1
@@ -38,4 +38,4 @@ USER gpt-researcher
|
||||
COPY --chown=gpt-researcher:gpt-researcher ./ ./
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ async def write_text_to_md(text: str, filename: str = "") -> str:
|
||||
"""
|
||||
file_path = f"outputs/{filename[:60]}.md"
|
||||
await write_to_file(file_path, text)
|
||||
return file_path
|
||||
return urllib.parse.quote(file_path)
|
||||
|
||||
async def write_md_to_pdf(text: str, filename: str = "") -> str:
|
||||
"""Converts Markdown text to a PDF file and returns the file path.
|
||||
|
||||
+1
-1
@@ -25,4 +25,4 @@ services:
|
||||
- ./multi_agents/frontend:/app
|
||||
restart: always
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 3000:3000
|
||||
|
||||
+3
-1
@@ -141,7 +141,9 @@
|
||||
<div id="reportActions">
|
||||
<div class="alert alert-info" role="alert" id="status"></div>
|
||||
<a id="copyToClipboard" onclick="GPTResearcher.copyToClipboard()" class="btn btn-secondary mt-3"
|
||||
style="margin-right: 10px;">Copy to clipboard</a>
|
||||
style="margin-right: 10px;">Copy to clipboard (markdown)</a>
|
||||
<a id="downloadLinkMd" href="#" class="btn btn-secondary mt-3" style="margin-right: 10px;"
|
||||
target="_blank">Download as Markdown</a>
|
||||
<a id="downloadLink" href="#" class="btn btn-secondary mt-3" style="margin-right: 10px;"
|
||||
target="_blank">Download as PDF</a>
|
||||
<a id="downloadLinkWord" href="#" class="btn btn-secondary mt-3" target="_blank">Download as Docx</a>
|
||||
|
||||
+4
-2
@@ -82,8 +82,10 @@ const GPTResearcher = (() => {
|
||||
const updateDownloadLink = (data) => {
|
||||
const pdf_path = data.output.pdf
|
||||
const docx_path = data.output.docx
|
||||
document.getElementById('downloadLink').setAttribute('href', pdf_path)
|
||||
document.getElementById('downloadLinkWord').setAttribute('href', docx_path)
|
||||
const md_path = data.output.md;
|
||||
document.getElementById('downloadLink').setAttribute('href', pdf_path);
|
||||
document.getElementById('downloadLinkWord').setAttribute('href', docx_path);
|
||||
document.getElementById("downloadLinkMd").setAttribute("href", md_path);
|
||||
}
|
||||
|
||||
const updateScroll = () => {
|
||||
|
||||
Reference in New Issue
Block a user