mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-28 00:40:58 +02:00
Handle newlines + code blocks in answer
This commit is contained in:
parent
9738e5e628
commit
ffa24e2f09
935
web/package-lock.json
generated
935
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,7 @@
|
|||||||
"react-dropzone": "^14.2.3",
|
"react-dropzone": "^14.2.3",
|
||||||
"react-icons": "^4.8.0",
|
"react-icons": "^4.8.0",
|
||||||
"react-loader-spinner": "^5.4.5",
|
"react-loader-spinner": "^5.4.5",
|
||||||
|
"react-markdown": "^8.0.7",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"swr": "^2.1.5",
|
"swr": "^2.1.5",
|
||||||
"tailwindcss": "^3.3.1",
|
"tailwindcss": "^3.3.1",
|
||||||
@ -31,6 +32,7 @@
|
|||||||
"yup": "^1.1.1"
|
"yup": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tailwindcss/typography": "^0.5.10",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"eslint-config-next": "^13.4.9",
|
"eslint-config-next": "^13.4.9",
|
||||||
"prettier": "2.8.8"
|
"prettier": "2.8.8"
|
||||||
|
@ -50,8 +50,6 @@ const buildDocumentSummaryDisplay = (
|
|||||||
sections.push(["...", false, false]);
|
sections.push(["...", false, false]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(blurb);
|
|
||||||
console.log(sections);
|
|
||||||
|
|
||||||
let previousIsContinuation = sections[0][2];
|
let previousIsContinuation = sections[0][2];
|
||||||
let previousIsBold = sections[0][1];
|
let previousIsBold = sections[0][1];
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Quote } from "@/lib/search/interfaces";
|
import { Quote } from "@/lib/search/interfaces";
|
||||||
import { ResponseSection, StatusOptions } from "./ResponseSection";
|
import { ResponseSection, StatusOptions } from "./ResponseSection";
|
||||||
|
import ReactMarkdown from "react-markdown";
|
||||||
|
|
||||||
interface AnswerSectionProps {
|
interface AnswerSectionProps {
|
||||||
answer: string | null;
|
answer: string | null;
|
||||||
@ -39,7 +40,11 @@ const AnswerBody = ({ answer, error, isFetching }: AnswerSectionProps) => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (answer) {
|
} else if (answer) {
|
||||||
return <p className="">{answer}</p>;
|
return (
|
||||||
|
<ReactMarkdown className="prose prose-invert text-gray-100 text-sm max-w-full">
|
||||||
|
{answer.replaceAll("\\n", "\n")}
|
||||||
|
</ReactMarkdown>
|
||||||
|
);
|
||||||
} else if (!isFetching) {
|
} else if (!isFetching) {
|
||||||
return <div className="text-gray-300">Information not found</div>;
|
return <div className="text-gray-300">Information not found</div>;
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,5 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [],
|
plugins: [require("@tailwindcss/typography")],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user