Skip to content

Commit

Permalink
Merge pull request #3418 from quantified-uncertainty/fumadocs
Browse files Browse the repository at this point in the history
Nextra -> Fumadocs migration
  • Loading branch information
berekuk authored Oct 26, 2024
2 parents 94b5ceb + 78a66ca commit 2defc88
Show file tree
Hide file tree
Showing 105 changed files with 6,722 additions and 9,721 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"turbo": "^2.0.6",
"turbo-ignore": "^2.0.6"
},
"pnpm": {
"overrides": {
"@headlessui/react": "^2.2.0"
}
},
"version": "0.0.1-0",
"packageManager": "[email protected]+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4"
}
36 changes: 13 additions & 23 deletions packages/ai/src/generateSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function generateDetailedStepLogs<Shape extends IOShape>(
detailedLogs += "### Logs:\n";
step.getLogs().forEach((log) => {
detailedLogs += `#### **${getLogEntryFullName(log.entry)}:**\n`;
detailedLogs += getFullMessage(log);
detailedLogs += getFullMessage(log) + "\n";
});
});
return detailedLogs;
Expand All @@ -124,38 +124,30 @@ function getFullMessage(log: TimestampedLogEntry): string {
return log.entry.message;
case "llmResponse": {
const llmResponse = log.entry;
return `<details>
<summary>Content</summary>
return `##### Content
\`\`\`\`
${llmResponse.content}
\`\`\`\`
</details>\n\n
<details>
<summary>Prompt</summary>
##### Prompt
\`\`\`\`
${llmResponse.prompt}
\`\`\`\`
</details>\n\n
<details>
<summary>Messages</summary>
##### Messages
\`\`\`\`json
${JSON.stringify(llmResponse.messages, null, 2)}
\`\`\`\`
</details>\n\n
<details>
<summary>Full Response</summary>
##### Full Response
\`\`\`\`json
${JSON.stringify(llmResponse.response, null, 2)}
\`\`\`\`
</details>\n\n\n`;
`;
}
default:
return "❓ Unknown log type";
Expand Down Expand Up @@ -196,8 +188,7 @@ ${formatCode(artifact.value)}
function formatCode(code: Code): string {
switch (code.type) {
case "formattingFailed":
return `<details>
<summary>🔴 Code Update: [Error] - Formatting failed</summary>
return `🔴 Code Update: [Error] - Formatting failed
**Error:**
\`\`\`
Expand All @@ -208,10 +199,10 @@ ${code.error}
\`\`\`squiggleEditor
${code.source}
\`\`\`
</details>\n\n`;
`;
case "runFailed":
return `<details>
<summary>🔴 Code Update: [Error] - Run failed</summary>
return `🔴 Code Update: [Error] - Run failed
**Error:**
\`\`\`
Expand All @@ -222,15 +213,14 @@ ${code.error}
\`\`\`squiggleEditor
${code.source}
\`\`\`
</details>\n\n`;
`;
case "success":
return `<details>
<summary>✅ Code Update: [Success] - Code executed successfully</summary>
return `✅ Code Update: [Success] - Code executed successfully
\`\`\`squiggleEditor
${code.source}
\`\`\`
</details>\n\n`;
`;
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"react-hook-form": "^7.50.0",
"react-markdown": "^9.0.1",
"reactflow": "^11.11.4",
"rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0",
"shikiji": "^0.10.2",
"unist-util-visit": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import Dagre from "@dagrejs/dagre";
import { FC, useEffect, useMemo } from "react";
import {
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/SquiggleChart.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import { FC, memo } from "react";

import { SqValuePath } from "@quri/squiggle-lang";
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/SquiggleEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import { FC, useRef } from "react";

import { useUncontrolledCode } from "../lib/hooks/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import React, { CSSProperties, useCallback, useEffect, useRef } from "react";

import { SqLinker, SqValuePath } from "@quri/squiggle-lang";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import { FC, forwardRef, memo } from "react";

import { SqValue } from "@quri/squiggle-lang";
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/ui/FnDocumentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export const FnDocumentation: FC<{
</div>
) : (
<MarkdownViewer
backgroundColor="bg-slate-100"
className="max-width-[200px]"
key={i}
md={`\`\`\`squiggle\n${text}\n\`\`\``}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import { clsx } from "clsx";
import { ComponentType, FC, ReactNode } from "react";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use client";
import { FC, PropsWithChildren } from "react";

import {
Expand Down
12 changes: 8 additions & 4 deletions packages/components/src/lib/CodeSyntaxHighlighter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { FC, HTMLAttributes, useEffect, useState } from "react";
"use client";
import { FC, HTMLAttributes, useEffect, useState } from "react";
import {
type BundledLanguage,
bundledLanguages,
Expand Down Expand Up @@ -58,7 +59,7 @@ export const CodeSyntaxHighlighter: FC<
"children"
>
> = ({ children, language, theme, ...rest }) => {
const [html, setHtml] = useState(children);
const [html, setHtml] = useState<string | undefined>();

// Syntax-highlighted blocks will start unstyled, that's fine.
useEffect(() => {
Expand All @@ -69,11 +70,14 @@ export const CodeSyntaxHighlighter: FC<
})();
});

return (
<pre
return html ? (
// This must be a div, shiki creates its own `<pre>`, and we don't want nested `<pre>`s, to avoid styling issues.
<div
className="*:!bg-inherit" // shiki themes add background color, so we have to override it
dangerouslySetInnerHTML={{ __html: html }}
{...rest}
/>
) : (
<pre {...rest}>{children}</pre>
);
};
Loading

0 comments on commit 2defc88

Please sign in to comment.