CodeViewer() — ui Function Reference
Architecture documentation for the CodeViewer() function in code-viewer.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 091e5cb9_dad1_908b_56e9_a5c8bf9ca88c["CodeViewer()"] 951c5cbd_b2fd_ab32_959d_0fe7c7e5a262["code-viewer.tsx"] 091e5cb9_dad1_908b_56e9_a5c8bf9ca88c -->|defined in| 951c5cbd_b2fd_ab32_959d_0fe7c7e5a262 style 091e5cb9_dad1_908b_56e9_a5c8bf9ca88c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/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>
<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-white [&_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-muted-foreground text-sm">
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 apps/v4/app/(app)/examples/playground/components/code-viewer.tsx.
Where is CodeViewer() defined?
CodeViewer() is defined in apps/v4/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