CodeViewer() — ui Function Reference
Architecture documentation for the CodeViewer() function in code-viewer.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 8daedbd4_2c17_0efd_1e56_87cbeebcbc42["CodeViewer()"] 48859566_1a54_c160_15d6_ebd1ee91cb56["code-viewer.tsx"] 8daedbd4_2c17_0efd_1e56_87cbeebcbc42 -->|defined in| 48859566_1a54_c160_15d6_ebd1ee91cb56 style 8daedbd4_2c17_0efd_1e56_87cbeebcbc42 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
deprecated/www/app/(app)/examples/playground/components/code-viewer.tsx lines 11–89
export function CodeViewer() {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="secondary">View code</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[625px]">
<DialogHeader>
<DialogTitle>View code</DialogTitle>
<DialogDescription>
You can use the following code to start integrating your current
prompt and settings into your application.
</DialogDescription>
</DialogHeader>
<div className="grid gap-4">
<div className="rounded-md bg-black p-6">
<pre>
<code className="grid gap-1 text-sm text-muted-foreground [&_span]:h-4">
<span>
<span className="text-sky-300">import</span> os
</span>
<span>
<span className="text-sky-300">import</span> openai
</span>
<span />
<span>
openai.api_key = os.getenv(
<span className="text-green-300">
"OPENAI_API_KEY"
</span>
)
</span>
<span />
<span>response = openai.Completion.create(</span>
<span>
{" "}
model=
<span className="text-green-300">"davinci"</span>,
</span>
<span>
{" "}
prompt=<span className="text-amber-300">""</span>,
</span>
<span>
{" "}
temperature=<span className="text-amber-300">0.9</span>,
</span>
<span>
{" "}
max_tokens=<span className="text-amber-300">5</span>,
</span>
<span>
{" "}
top_p=<span className="text-amber-300">1</span>,
</span>
<span>
{" "}
frequency_penalty=<span className="text-amber-300">0</span>,
</span>
<span>
{" "}
presence_penalty=<span className="text-green-300">0</span>,
</span>
<span>)</span>
</code>
</pre>
</div>
<div>
<p className="text-sm text-muted-foreground">
Your API Key can be found here. You should use environment
variables or a secret management tool to expose your key to your
applications.
</p>
</div>
</div>
</DialogContent>
</Dialog>
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does CodeViewer() do?
CodeViewer() is a function in the ui codebase, defined in deprecated/www/app/(app)/examples/playground/components/code-viewer.tsx.
Where is CodeViewer() defined?
CodeViewer() is defined in deprecated/www/app/(app)/examples/playground/components/code-viewer.tsx at line 11.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free