mirror of
https://git.mirrors.martin98.com/https://github.com/bytedance/deer-flow
synced 2025-10-04 22:36:34 +08:00
feat: enable dark mode in code
This commit is contained in:
parent
9e07ed178d
commit
2ed47c42ae
@ -5,9 +5,11 @@ import { PythonOutlined } from "@ant-design/icons";
|
|||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import { LRUCache } from "lru-cache";
|
import { LRUCache } from "lru-cache";
|
||||||
import { BookOpenText, PencilRuler, Search } from "lucide-react";
|
import { BookOpenText, PencilRuler, Search } from "lucide-react";
|
||||||
|
import { useTheme } from "next-themes";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import SyntaxHighlighter from "react-syntax-highlighter";
|
import SyntaxHighlighter from "react-syntax-highlighter";
|
||||||
import { docco } from "react-syntax-highlighter/dist/esm/styles/hljs";
|
import { docco } from "react-syntax-highlighter/dist/esm/styles/hljs";
|
||||||
|
import { dark } from "react-syntax-highlighter/dist/esm/styles/prism";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Accordion,
|
Accordion,
|
||||||
@ -272,6 +274,7 @@ function PythonToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
|
|||||||
const code = useMemo<string>(() => {
|
const code = useMemo<string>(() => {
|
||||||
return (toolCall.args as { code: string }).code;
|
return (toolCall.args as { code: string }).code;
|
||||||
}, [toolCall.args]);
|
}, [toolCall.args]);
|
||||||
|
const { resolvedTheme } = useTheme();
|
||||||
return (
|
return (
|
||||||
<section className="mt-4 pl-4">
|
<section className="mt-4 pl-4">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
@ -286,9 +289,11 @@ function PythonToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
|
|||||||
<div className="px-5">
|
<div className="px-5">
|
||||||
<div className="bg-accent mt-2 max-h-[400px] w-[800px] overflow-y-auto rounded-md p-2 text-sm">
|
<div className="bg-accent mt-2 max-h-[400px] w-[800px] overflow-y-auto rounded-md p-2 text-sm">
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
customStyle={{ background: "transparent" }}
|
customStyle={{
|
||||||
|
background: "transparent",
|
||||||
|
}}
|
||||||
language="python"
|
language="python"
|
||||||
style={docco}
|
style={resolvedTheme === "dark" ? dark : docco}
|
||||||
>
|
>
|
||||||
{code}
|
{code}
|
||||||
</SyntaxHighlighter>
|
</SyntaxHighlighter>
|
||||||
@ -300,6 +305,7 @@ function PythonToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
|
|||||||
|
|
||||||
function MCPToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
|
function MCPToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
|
||||||
const tool = useMemo(() => findMCPTool(toolCall.name), [toolCall.name]);
|
const tool = useMemo(() => findMCPTool(toolCall.name), [toolCall.name]);
|
||||||
|
const { resolvedTheme } = useTheme();
|
||||||
return (
|
return (
|
||||||
<section className="mt-4 pl-4">
|
<section className="mt-4 pl-4">
|
||||||
<div className="w-fit overflow-y-auto rounded-md py-0">
|
<div className="w-fit overflow-y-auto rounded-md py-0">
|
||||||
@ -322,9 +328,13 @@ function MCPToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
|
|||||||
{toolCall.result && (
|
{toolCall.result && (
|
||||||
<div className="bg-accent max-h-[400px] w-[800px] overflow-y-auto rounded-md text-sm">
|
<div className="bg-accent max-h-[400px] w-[800px] overflow-y-auto rounded-md text-sm">
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
customStyle={{ background: "transparent" }}
|
customStyle={{
|
||||||
|
background: "transparent",
|
||||||
|
border: "none",
|
||||||
|
boxShadow: "none",
|
||||||
|
}}
|
||||||
language="json"
|
language="json"
|
||||||
style={docco}
|
style={resolvedTheme === "dark" ? dark : docco}
|
||||||
>
|
>
|
||||||
{toolCall.result}
|
{toolCall.result}
|
||||||
</SyntaxHighlighter>
|
</SyntaxHighlighter>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user