@stainless-api/docs-ai-chat 0.1.0-beta.45 → 0.1.0-beta.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/ambient-modules.d.ts +7 -0
- package/package.json +2 -2
- package/src/DocsChat.tsx +24 -12
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @stainless-api/docs-ai-chat
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.47
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a8ed299: Adds the ability for AI chat to move into a sidebar “panel” position.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5b3b798]
|
|
12
|
+
- Updated dependencies [a8ed299]
|
|
13
|
+
- @stainless-api/ai-chat@0.1.0-beta.9
|
|
14
|
+
|
|
15
|
+
## 0.1.0-beta.46
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 9d24589: Steelie empty state
|
|
20
|
+
- 5263b85: Loading state for ai chat
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 9d24589: Various steelie UI fixes
|
|
25
|
+
- Updated dependencies [9d24589]
|
|
26
|
+
- Updated dependencies [9d24589]
|
|
27
|
+
- Updated dependencies [5263b85]
|
|
28
|
+
- @stainless-api/ai-chat@0.1.0-beta.8
|
|
29
|
+
|
|
3
30
|
## 0.1.0-beta.45
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainless-api/docs-ai-chat",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.47",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@streamparser/json-whatwg": "^0.0.22",
|
|
15
15
|
"zod": "^4.3.6",
|
|
16
|
-
"@stainless-api/ai-chat": "0.1.0-beta.
|
|
16
|
+
"@stainless-api/ai-chat": "0.1.0-beta.9"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/react": "19.2.14",
|
package/src/DocsChat.tsx
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import AiChat from '@stainless-api/ai-chat/src/AiChat.tsx';
|
|
2
2
|
import type { DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
3
3
|
import { setResponseMetadata, submitResponseFeedback } from './api';
|
|
4
|
+
import { useSyncExternalStore } from 'react';
|
|
4
5
|
import { useChat } from './hook';
|
|
5
6
|
|
|
7
|
+
function onCopyMessage(spanId: string) {
|
|
8
|
+
setResponseMetadata(spanId, { copied_to_clipboard: 'true' }).catch(() => {});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function rateMessage(spanId: string, rating: 'up' | 'down'): Promise<boolean> {
|
|
12
|
+
try {
|
|
13
|
+
const { success } = await submitResponseFeedback(spanId, { up: 1 as const, down: 0 as const }[rating]);
|
|
14
|
+
return success;
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
export default function DocsChat({
|
|
7
21
|
projectId,
|
|
8
22
|
language,
|
|
@@ -18,18 +32,15 @@ export default function DocsChat({
|
|
|
18
32
|
siteTitle,
|
|
19
33
|
});
|
|
20
34
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const onCopyMessage = (spanId: string) => {
|
|
31
|
-
setResponseMetadata(spanId, { copied_to_clipboard: 'true' }).catch(() => {});
|
|
32
|
-
};
|
|
35
|
+
// panel mode is supported only on larger viewports
|
|
36
|
+
const supportsPanel = useSyncExternalStore(
|
|
37
|
+
(cb) => {
|
|
38
|
+
window.addEventListener('resize', cb);
|
|
39
|
+
return () => window.removeEventListener('resize', cb);
|
|
40
|
+
},
|
|
41
|
+
() => window.innerWidth >= 968,
|
|
42
|
+
() => false,
|
|
43
|
+
);
|
|
33
44
|
|
|
34
45
|
return (
|
|
35
46
|
<AiChat
|
|
@@ -37,6 +48,7 @@ export default function DocsChat({
|
|
|
37
48
|
sendMessage={sendMessage}
|
|
38
49
|
rateMessage={rateMessage}
|
|
39
50
|
onCopyMessage={onCopyMessage}
|
|
51
|
+
supportsPanel={supportsPanel}
|
|
40
52
|
/>
|
|
41
53
|
);
|
|
42
54
|
}
|
package/tsconfig.json
CHANGED