Skip to content

Commit

Permalink
enhance prompt and UI
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn committed Sep 27, 2024
1 parent d9bf348 commit 1650f17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion helpers/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ For better results, you can specify the region parameter to get results from a s
description: "System prompt for code interpreter tool.",
value: `You are a code executor that can run code in a secure environment.
You can run code in a sandbox and return the sandbox url to the user for them to view the result.
Do not show the code in chat, just describe the detail information of application: step by step to build the application, description, and dependencies.`,
Do not show the code or sandbox url in chat, just describe the steps to build the application. If having image url, you should show the image in chat.`,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,18 @@ function ArtifactOutput({ data }: { data: ArtifactData }) {
</div>
<Button onClick={handleClosePanel}>Close</Button>
</div>
<Tabs defaultValue="output" className="h-full p-4 overflow-auto">
<TabsList className="grid w-full grid-cols-3 max-w-[600px]">
<Tabs defaultValue="preview" className="h-full p-4 overflow-auto">
<TabsList className="grid w-full grid-cols-3 max-w-[600px] mx-auto">
<TabsTrigger value="code">Code</TabsTrigger>
<TabsTrigger value="output">Output</TabsTrigger>
<TabsTrigger value="preview">Preview</TabsTrigger>
<TabsTrigger value="logs">Logs</TabsTrigger>
</TabsList>
<TabsContent value="code" className="h-[90%]">
<div className="m-4 overflow-auto">
<Markdown content={markdownCode} />
</div>
</TabsContent>
<TabsContent value="output" className="h-[90%]">
<TabsContent value="preview" className="h-[90%]">
{sandboxUrl && <CodeSandboxPreview url={sandboxUrl} />}
{outputUrls && <InterpreterOutput outputUrls={outputUrls} />}
</TabsContent>
Expand Down Expand Up @@ -180,23 +180,28 @@ function InterpreterOutput({
outputUrls: Array<{ url: string; filename: string }>;
}) {
return (
<div>
<h3>Click to output files below to open in the browser</h3>
<ul className="flex flex-col gap-2 list-disc list-inside">
{outputUrls.map((url, index) => (
<li key={url.url}>
<span>File Output {index + 1}: </span>
<ul className="flex flex-col gap-2 list-disc list-inside">
{outputUrls.map((url, index) => (
<li key={url.url}>
<span>
File Output {index + 1}:{" "}
<a
href={url.url}
target="_blank"
className="text-blue-400 underline"
>
{url.filename}
</a>
</li>
))}
</ul>
</div>
</span>
{url.filename.endsWith(".png") ||
url.filename.endsWith(".jpg") ||
url.filename.endsWith(".jpeg") ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={url.url} alt={url.filename} className="my-4 w-2/3" />
) : null}
</li>
))}
</ul>
);
}

Expand Down

0 comments on commit 1650f17

Please sign in to comment.