fix: title generation + ai sdk upgrade (#1392)
This commit is contained in:
parent
f19d3d4071
commit
9d5d8a3ea7
38 changed files with 1422 additions and 2360 deletions
|
|
@ -18,7 +18,6 @@ import {
|
|||
CollapsibleTrigger,
|
||||
} from "@/components/ui/collapsible";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { CodeBlock } from "./code-block";
|
||||
|
||||
export type ToolProps = ComponentProps<typeof Collapsible>;
|
||||
|
||||
|
|
@ -111,9 +110,9 @@ export const ToolInput = ({ className, input, ...props }: ToolInputProps) => (
|
|||
<h4 className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
|
||||
Parameters
|
||||
</h4>
|
||||
<div className="rounded-md bg-muted/50">
|
||||
<CodeBlock code={JSON.stringify(input, null, 2)} language="json" />
|
||||
</div>
|
||||
<pre className="overflow-x-auto rounded-md bg-muted/50 p-3 font-mono text-xs">
|
||||
{JSON.stringify(input, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
|
@ -132,15 +131,21 @@ export const ToolOutput = ({
|
|||
return null;
|
||||
}
|
||||
|
||||
let Output = <div>{output as ReactNode}</div>;
|
||||
|
||||
if (typeof output === "object" && !isValidElement(output)) {
|
||||
Output = (
|
||||
<CodeBlock code={JSON.stringify(output, null, 2)} language="json" />
|
||||
);
|
||||
} else if (typeof output === "string") {
|
||||
Output = <CodeBlock code={output} language="json" />;
|
||||
}
|
||||
const renderOutput = () => {
|
||||
if (typeof output === "object" && !isValidElement(output)) {
|
||||
return (
|
||||
<pre className="overflow-x-auto p-3 font-mono text-xs">
|
||||
{JSON.stringify(output, null, 2)}
|
||||
</pre>
|
||||
);
|
||||
}
|
||||
if (typeof output === "string") {
|
||||
return (
|
||||
<pre className="overflow-x-auto p-3 font-mono text-xs">{output}</pre>
|
||||
);
|
||||
}
|
||||
return <div className="p-3">{output as ReactNode}</div>;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={cn("space-y-2 p-4", className)} {...props}>
|
||||
|
|
@ -155,8 +160,8 @@ export const ToolOutput = ({
|
|||
: "bg-muted/50 text-foreground"
|
||||
)}
|
||||
>
|
||||
{errorText && <div>{errorText}</div>}
|
||||
{Output}
|
||||
{errorText && <div className="p-3">{errorText}</div>}
|
||||
{!errorText && renderOutput()}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue