Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions client/src/components/Chat/Messages/Content/Parts/Reasoning.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { memo, useMemo } from 'react';
import { ContentTypes } from 'librechat-data-provider';
import { ThinkingContent } from '~/components/Artifacts/Thinking';
import { useMessageContext } from '~/Providers';
import Markdown from '~/components/Chat/Messages/Content/Markdown';
import { cn } from '~/utils';

type ReasoningProps = {
reasoning: string;
};

const Reasoning = memo(({ reasoning }: ReasoningProps) => {
const { isExpanded, nextType } = useMessageContext();
const { isExpanded, nextType, isLatestMessage } = useMessageContext();
const reasoningText = useMemo(() => {
return reasoning
.replace(/^<think>\s*/, '')
Expand All @@ -31,8 +31,44 @@
gridTemplateRows: isExpanded ? '1fr' : '0fr',
}}
>
<div className="overflow-hidden">
<ThinkingContent isPart={true}>{reasoningText}</ThinkingContent>
<div className="prose-se dark:prose-invert overflow-hidden break-words">
<div className="mb-2.5 ml-1.5 mt-0 flex items-center gap-2">
<div
className="rounded-full bg-black p-1 dark:bg-white"
style={{
width: '18px',
height: '18px',
minWidth: '18px',
minHeight: '18px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: 'white',
dark: { color: 'black' },
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="12"
height="12"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="icon-sm"
>
<path d="m12 3-1.9 4.2-4.1.6 3 2.9-.7 4.1 3.7-2 3.7 2-.7-4.1 3-2.9-4.1-.6Z" />
<path d="M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2" />
<path d="M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2" />
</svg>
</div>
<div className="font-bold">Thoughts</div>

Check failure

Code scanning / ESLint

disallow literal string Error

disallow literal string: Thoughts
</div>
<div className="px-2.5">
<Markdown content={reasoningText} isLatestMessage={isLatestMessage} />
</div>
</div>
</div>
);
Expand Down
20 changes: 20 additions & 0 deletions jules-scratch/verification/verify_markdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

from playwright.sync_api import sync_playwright

def run():
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
page.goto("http://localhost:3090/")
page.fill('input[name="email"]', "test@test.com")
page.fill('input[name="password"]', "12345678")
page.click('button[type="submit"]')
page.wait_for_selector('textarea')
page.fill('textarea', "What is the capital of France?")
page.press('textarea', 'Enter')
page.wait_for_selector('[data-testid="thinking-summary"]', timeout=60000)
page.screenshot(path="jules-scratch/verification/verification.png")
browser.close()

if __name__ == "__main__":
run()
Loading