Skip to content

Commit ea62dc3

Browse files
authored
Merge pull request #128 from openai/add-missing-docstring-links
[docs] Add missing docstring links; add quick link to github project; fix title
2 parents 8aaf91e + fa093ba commit ea62dc3

File tree

8 files changed

+217
-42
lines changed

8 files changed

+217
-42
lines changed

packages/chatkit/types/index.d.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,11 @@ export type StartScreenPrompt = {
354354
label: string;
355355
/** Text inserted into the composer when the prompt is chosen. */
356356
prompt: string;
357-
/** Optional icon displayed with the prompt. */
357+
/**
358+
* Optional icon displayed with the prompt.
359+
*
360+
* @see {@link ChatKitIcon}
361+
*/
358362
icon?: ChatKitIcon;
359363
};
360364

@@ -446,7 +450,11 @@ export type ToolOption = {
446450
/** Label displayed in the tool menu */
447451
label: string;
448452

449-
/** Icon displayed next to the tool in the menu. */
453+
/**
454+
* Icon displayed next to the tool in the menu.
455+
*
456+
* @see {@link ChatKitIcon}
457+
*/
450458
icon: ChatKitIcon;
451459

452460
/** Optional label displayed in the button when the tool is selected. */
@@ -609,6 +617,8 @@ export type CustomApiConfig = {
609617

610618
/**
611619
* How attachments will be uploaded to your server. Required when attachments are enabled.
620+
*
621+
* @see {@link FileUploadStrategy}
612622
*/
613623
uploadStrategy?: FileUploadStrategy;
614624
};

packages/docs/astro.config.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,20 @@ const sidebar = [
6565
},
6666
chatkitTypeDocSidebarGroup,
6767
{
68-
label: 'Managed backend',
68+
label: 'Self-hosted backend',
6969
items: [
7070
{
71-
label: 'ChatKit API',
72-
link: 'https://platform.openai.com/docs/guides/chatkit',
71+
label: 'ChatKit Python SDK',
72+
link: 'https://openai.github.io/chatkit-python',
7373
},
7474
],
7575
},
7676
{
77-
label: 'Self-hosted backend',
77+
label: 'OpenAI-hosted backend',
7878
items: [
7979
{
80-
label: 'Python SDK',
81-
link: 'https://openai.github.io/chatkit-python',
80+
label: 'Managed ChatKit Docs',
81+
link: 'https://platform.openai.com/docs/guides/chatkit',
8282
},
8383
],
8484
},
@@ -119,6 +119,13 @@ export default defineConfig({
119119
Sidebar: './src/components/Sidebar.astro',
120120
MobileMenuFooter: './src/components/MobileFooter.astro',
121121
},
122+
social: [
123+
{
124+
icon: 'github',
125+
label: 'ChatKit.js',
126+
href: 'https://github.com/openai/chatkit-js',
127+
},
128+
],
122129
locales: {
123130
root: {
124131
label: 'English',

packages/docs/src/components/MobileFooter.astro

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
11
---
2-
import { Icon } from '@astrojs/starlight/components';
32
import LanguageSelect from '@astrojs/starlight/components/LanguageSelect.astro';
4-
import SocialIcons from '@astrojs/starlight/components/SocialIcons.astro';
3+
import SocialIcons from 'virtual:starlight/components/SocialIcons';
54
import ThemeSelect from '@astrojs/starlight/components/ThemeSelect.astro';
6-
import { ParseStatus } from 'astro:schema';
7-
8-
const additionalLinks = [
9-
{
10-
label: 'Chatkit.js',
11-
href: 'https://github.com/openai/chatkit-js',
12-
icon: 'github' as const,
13-
},
14-
];
155
---
166

177
<div class="mobile-preferences sl-flex">
188
<div class="social-icons">
199
<SocialIcons />
20-
{
21-
additionalLinks.map(({ label, href, icon }) => (
22-
<a {href} target="_blank" rel="noopener noreferrer" class="sl-flex">
23-
<Icon name={icon as any} />
24-
<span>{label}</span>
25-
</a>
26-
))
27-
}
2810
</div>
2911
<ThemeSelect />
3012
<LanguageSelect />
@@ -61,12 +43,6 @@ const additionalLinks = [
6143
font-size: var(--sl-text-sm);
6244
margin-inline-start: 0.3rem;
6345
}
64-
65-
@media (max-width: 72rem) {
66-
span {
67-
@apply sr-only;
68-
}
69-
}
7046
}
7147
a:hover {
7248
opacity: 0.66;
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
---
2-
import Default from '@astrojs/starlight/components/Sidebar.astro';
2+
import MobileMenuFooter from 'virtual:starlight/components/MobileMenuFooter';
3+
import SidebarPersister from '@astrojs/starlight/components/SidebarPersister.astro';
4+
import SidebarSublist from './SidebarSublist.astro';
5+
6+
const { sidebar } = Astro.locals.starlightRoute;
37
---
48

5-
<Default />
9+
<SidebarPersister>
10+
<SidebarSublist sublist={sidebar} />
11+
</SidebarPersister>
12+
13+
<div class="md:sl-hidden">
14+
<MobileMenuFooter />
15+
</div>
616

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
/** Unique symbol for storing a running index in `locals`. */
3+
const currentGroupIndexSymbol = Symbol.for('starlight-sidebar-group-index');
4+
const locals = Astro.locals as App.Locals & { [currentGroupIndexSymbol]?: number };
5+
6+
const index = locals[currentGroupIndexSymbol] || 0;
7+
locals[currentGroupIndexSymbol] = index + 1;
8+
---
9+
10+
<sl-sidebar-restore data-index={index}></sl-sidebar-restore>
11+
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
import SidebarRestorePoint from './SidebarRestorePoint.astro';
3+
import { Badge, Icon } from '@astrojs/starlight/components';
4+
import type { SidebarEntry } from '@astrojs/starlight/utils/routing/types';
5+
6+
interface Props {
7+
sublist: SidebarEntry[];
8+
nested?: boolean;
9+
}
10+
11+
const { sublist, nested } = Astro.props;
12+
const isExternalHref = (href: string) => /^https?:\/\//.test(href);
13+
const hasCurrentChild = (entries: SidebarEntry[]): boolean =>
14+
entries.some((entry) =>
15+
entry.type === 'link' ? entry.isCurrent : hasCurrentChild(entry.entries)
16+
);
17+
---
18+
19+
<ul class:list={{ 'top-level': !nested }}>
20+
{
21+
sublist.map((entry) => (
22+
<li>
23+
{entry.type === 'link' ? (
24+
<a
25+
href={entry.href}
26+
aria-current={entry.isCurrent && 'page'}
27+
class:list={[{ large: !nested }, entry.attrs.class]}
28+
{...entry.attrs}
29+
>
30+
<span>{entry.label}</span>
31+
{entry.badge && (
32+
<Badge
33+
variant={entry.badge.variant}
34+
class={entry.badge.class}
35+
text={entry.badge.text}
36+
/>
37+
)}
38+
{isExternalHref(entry.href) && (
39+
<Icon name="external" class="nav-external-icon" size="0.9rem" />
40+
)}
41+
</a>
42+
) : (
43+
<details open={hasCurrentChild(entry.entries) || !entry.collapsed}>
44+
<SidebarRestorePoint />
45+
<summary>
46+
<span class="group-label">
47+
<span class="large">{entry.label}</span>
48+
{entry.badge && (
49+
<Badge
50+
variant={entry.badge.variant}
51+
class={entry.badge.class}
52+
text={entry.badge.text}
53+
/>
54+
)}
55+
</span>
56+
<Icon name="right-caret" class="caret" size="1.25rem" />
57+
</summary>
58+
<Astro.self sublist={entry.entries} nested />
59+
</details>
60+
)}
61+
</li>
62+
))
63+
}
64+
</ul>
65+
66+
<style>
67+
@layer starlight.core {
68+
ul {
69+
--sl-sidebar-item-padding-inline: 0.5rem;
70+
list-style: none;
71+
padding: 0;
72+
}
73+
74+
li {
75+
overflow-wrap: anywhere;
76+
}
77+
78+
ul ul li {
79+
margin-inline-start: var(--sl-sidebar-item-padding-inline);
80+
border-inline-start: 1px solid var(--sl-color-hairline-light);
81+
padding-inline-start: var(--sl-sidebar-item-padding-inline);
82+
}
83+
84+
.large {
85+
font-size: var(--sl-text-lg);
86+
font-weight: 600;
87+
color: var(--sl-color-white);
88+
}
89+
90+
.top-level > li + li {
91+
margin-top: 0.75rem;
92+
}
93+
94+
summary {
95+
display: flex;
96+
align-items: center;
97+
justify-content: space-between;
98+
padding: 0.2em var(--sl-sidebar-item-padding-inline);
99+
line-height: 1.4;
100+
cursor: pointer;
101+
user-select: none;
102+
}
103+
summary::marker,
104+
summary::-webkit-details-marker {
105+
display: none;
106+
}
107+
108+
.caret {
109+
transition: transform 0.2s ease-in-out;
110+
flex-shrink: 0;
111+
}
112+
:global([dir='rtl']) .caret {
113+
transform: rotateZ(180deg);
114+
}
115+
[open] > summary .caret {
116+
transform: rotateZ(90deg);
117+
}
118+
119+
a {
120+
display: flex;
121+
align-items: center;
122+
border-radius: 0.25rem;
123+
text-decoration: none;
124+
color: var(--sl-color-gray-2);
125+
padding: 0.3em var(--sl-sidebar-item-padding-inline);
126+
line-height: 1.4;
127+
gap: 0.35rem;
128+
}
129+
130+
a:hover,
131+
a:focus {
132+
color: var(--sl-color-white);
133+
}
134+
135+
[aria-current='page'],
136+
[aria-current='page']:hover,
137+
[aria-current='page']:focus {
138+
font-weight: 600;
139+
color: var(--sl-color-text-invert);
140+
background-color: var(--sl-color-text-accent);
141+
}
142+
143+
.group-label {
144+
display: inline-flex;
145+
align-items: center;
146+
gap: 0.25rem;
147+
}
148+
149+
.nav-external-icon {
150+
flex-shrink: 0;
151+
color: inherit;
152+
}
153+
154+
@media (min-width: 50rem) {
155+
.top-level > li + li {
156+
margin-top: 0.5rem;
157+
}
158+
.large {
159+
font-size: var(--sl-text-base);
160+
}
161+
a {
162+
font-size: var(--sl-text-sm);
163+
}
164+
}
165+
}
166+
</style>
167+

packages/docs/src/components/SocialIcons.astro

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ const links = config.social || [];
3131
font-size: var(--sl-text-sm);
3232
margin-inline-start: 0.3rem;
3333
}
34-
35-
@media (max-width: 72rem) {
36-
span {
37-
@apply sr-only;
38-
}
39-
}
4034
}
4135
a:hover {
4236
opacity: 0.66;

packages/docs/src/content/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: OpenAI Agent Embeds
2+
title: ChatKit.js
33
description: Embed ChatKit in your app using React or the Web Component.
44
tableOfContents: false
55
---

0 commit comments

Comments
 (0)