Skip to content

Commit

Permalink
enh: support un-indented numbered lists (#8359)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Oct 30, 2024
1 parent 0bbd3aa commit addfd9c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 14 additions & 3 deletions front/components/assistant/markdown/RenderMessageMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,26 +420,37 @@ function UlBlock({ children }: { children: React.ReactNode }) {
<ul className="list-disc py-2 pl-8 first:pt-0 last:pb-0">{children}</ul>
);
}
function OlBlock({ children }: { children: React.ReactNode }) {
function OlBlock({
children,
start,
}: {
children: React.ReactNode;
start?: number;
}) {
return (
<ol className="list-decimal py-3 pl-8 first:pt-0 last:pb-0">{children}</ol>
<ol start={start} className="list-decimal py-3 pl-8 first:pt-0 last:pb-0">
{children}
</ol>
);
}
function LiBlock({
textSize,
textColor,
children,
className = "",
}: {
textSize?: string;
textColor?: string;
children: React.ReactNode;
className?: string;
}) {
return (
<li
className={classNames(
"break-words first:pt-0 last:pb-0",
textSize === "sm" ? "py-1" : "py-2",
textColor ? textColor : "text-element-800"
textColor ? textColor : "text-element-800",
className
)}
>
{children}
Expand Down
4 changes: 0 additions & 4 deletions front/lib/api/assistant/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,6 @@ export async function constructPromptMultiActions(
additionalInstructions +=
"\nWhen generating latex formulas, solely rely on the $$ escape sequence, single $ latex sequences are not supported.\n";

additionalInstructions +=
"\nIn numbered lists, align all content with the item's text to preserve list continuity " +
"in markdown - otherwise the list numbering breaks and restarts when rendered.\n";

let prompt = `${context}\n${instructions}`;
if (additionalInstructions) {
prompt += `\nADDITIONAL INSTRUCTIONS:\n${additionalInstructions}`;
Expand Down

0 comments on commit addfd9c

Please sign in to comment.