Skip to content

Commit ae91cef

Browse files
committed
add api docs link in developer settings
1 parent 4f1aab3 commit ae91cef

3 files changed

Lines changed: 92 additions & 83 deletions

File tree

bun.lock

Lines changed: 72 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"devDependencies": {
2222
"@eslint/compat": "^2.0.0",
2323
"@eslint/js": "^9.39.2",
24-
"@iconify/json": "^2.2.425",
24+
"@iconify/json": "^2.2.426",
2525
"@playwright/test": "^1.57.0",
2626
"@shikijs/langs": "^3.21.0",
2727
"@shikijs/markdown-it": "^3.21.0",
@@ -38,7 +38,7 @@
3838
"dotenv": "^17.2.3",
3939
"eslint": "^9.39.2",
4040
"eslint-config-prettier": "^10.1.8",
41-
"eslint-plugin-svelte": "^3.13.1",
41+
"eslint-plugin-svelte": "^3.14.0",
4242
"globals": "^17.0.0",
4343
"melt": "^0.44.0",
4444
"mode-watcher": "^1.1.0",

src/routes/account/developer/+page.svelte

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import PlusIcon from '~icons/lucide/plus';
88
import TrashIcon from '~icons/lucide/trash-2';
99
import CopyIcon from '~icons/lucide/copy';
10+
import ExternalLinkIcon from '~icons/lucide/external-link';
1011
import { invalidateAll } from '$app/navigation';
1112
1213
let { data } = $props();
1314
15+
const API_DOCS_URL = 'https://github.com/nanogpt-community/nanochat/blob/main/api-docs.md';
16+
1417
let newKeyName = $state('');
1518
let newlyCreatedKey = $state<string | null>(null);
1619
let creating = $state(false);
@@ -81,6 +84,15 @@
8184
Personal Access Tokens for API authentication. Use these keys with the
8285
<code class="bg-muted rounded px-1">Authorization: Bearer &lt;KEY&gt;</code> header.
8386
</p>
87+
<a
88+
href={API_DOCS_URL}
89+
target="_blank"
90+
rel="noopener noreferrer"
91+
class="text-primary hover:text-primary/80 mt-2 inline-flex items-center gap-1 text-sm font-medium underline-offset-4 hover:underline"
92+
>
93+
View API Documentation
94+
<ExternalLinkIcon class="size-4" />
95+
</a>
8496
</div>
8597

8698
<Card.Root class="mt-8">
@@ -94,11 +106,7 @@
94106
<Card.Content>
95107
<!-- Create new key form -->
96108
<div class="mb-6 flex gap-2">
97-
<Input
98-
bind:value={newKeyName}
99-
placeholder="Key name (e.g., CLI Script)"
100-
class="flex-1"
101-
/>
109+
<Input bind:value={newKeyName} placeholder="Key name (e.g., CLI Script)" class="flex-1" />
102110
<Button onclick={createKey} disabled={creating || !newKeyName.trim()}>
103111
<PlusIcon class="mr-1 size-4" />
104112
Generate Key
@@ -117,12 +125,7 @@
117125
<CopyIcon class="size-4" />
118126
</Button>
119127
</div>
120-
<Button
121-
variant="ghost"
122-
size="sm"
123-
class="mt-2"
124-
onclick={() => (newlyCreatedKey = null)}
125-
>
128+
<Button variant="ghost" size="sm" class="mt-2" onclick={() => (newlyCreatedKey = null)}>
126129
Dismiss
127130
</Button>
128131
</div>
@@ -157,12 +160,14 @@
157160
<Card.Title>Usage Example</Card.Title>
158161
</Card.Header>
159162
<Card.Content>
160-
<pre class="bg-muted overflow-x-auto rounded-lg p-4 text-sm"><code>curl -X POST https://your-domain.com/api/generate-message \
163+
<pre class="bg-muted overflow-x-auto rounded-lg p-4 text-sm"><code
164+
>curl -X POST https://your-domain.com/api/generate-message \
161165
-H "Authorization: Bearer nc_your_api_key_here" \
162166
-H "Content-Type: application/json" \
163167
-d '{'{'}
164168
"message": "Hello!",
165169
"model_id": "gpt-4o"
166-
{'}'}'</code></pre>
170+
{'}'}'</code
171+
></pre>
167172
</Card.Content>
168173
</Card.Root>

0 commit comments

Comments
 (0)