mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 14:00:28 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 433d66482d | |||
| bd553bcf9e | |||
| f5894bcf74 | |||
| 1b59e7ce36 |
@@ -1,5 +1,15 @@
|
|||||||
# gitbook
|
# gitbook
|
||||||
|
|
||||||
|
## 0.13.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- f5894bc: Fix incorrect revision ID in Markdown fetch logic
|
||||||
|
- 1b59e7c: Styling improvements to AI Chat Followup questions
|
||||||
|
- Updated dependencies [bd553bc]
|
||||||
|
- @gitbook/openapi-parser@2.2.0
|
||||||
|
- @gitbook/react-openapi@1.3.2
|
||||||
|
|
||||||
## 0.13.0
|
## 0.13.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "0.13.0",
|
"version": "0.13.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gitbook/api": "catalog:",
|
"@gitbook/api": "catalog:",
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import AIChatIcon from './AIChatIcon';
|
|||||||
import { AIChatInput } from './AIChatInput';
|
import { AIChatInput } from './AIChatInput';
|
||||||
import { AIChatMessages } from './AIChatMessages';
|
import { AIChatMessages } from './AIChatMessages';
|
||||||
import AIChatSuggestedQuestions from './AIChatSuggestedQuestions';
|
import AIChatSuggestedQuestions from './AIChatSuggestedQuestions';
|
||||||
import { AIChatFollowupSuggestions } from './AiChatFollowupSuggestions';
|
|
||||||
|
|
||||||
export function AIChat() {
|
export function AIChat() {
|
||||||
const chat = useAIChatState();
|
const chat = useAIChatState();
|
||||||
@@ -169,7 +168,11 @@ export function AIChatWindow(props: { chat: AIChatState }) {
|
|||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<AIChatMessages chat={chat} lastUserMessageRef={lastUserMessageRef} />
|
<AIChatMessages
|
||||||
|
chat={chat}
|
||||||
|
chatController={chatController}
|
||||||
|
lastUserMessageRef={lastUserMessageRef}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -177,11 +180,7 @@ export function AIChatWindow(props: { chat: AIChatState }) {
|
|||||||
className="absolute inset-x-0 bottom-0 mr-2 flex flex-col gap-4 bg-gradient-to-b from-transparent to-50% to-tint-base/9 p-4 pr-2"
|
className="absolute inset-x-0 bottom-0 mr-2 flex flex-col gap-4 bg-gradient-to-b from-transparent to-50% to-tint-base/9 p-4 pr-2"
|
||||||
>
|
>
|
||||||
{/* Display an error banner when something went wrong. */}
|
{/* Display an error banner when something went wrong. */}
|
||||||
{chat.error ? (
|
{chat.error ? <AIChatError chatController={chatController} /> : null}
|
||||||
<AIChatError chatController={chatController} />
|
|
||||||
) : (
|
|
||||||
<AIChatFollowupSuggestions chat={chat} chatController={chatController} />
|
|
||||||
)}
|
|
||||||
|
|
||||||
<AIChatInput
|
<AIChatInput
|
||||||
value={input}
|
value={input}
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
import { tcls } from '@/lib/tailwind';
|
import { tcls } from '@/lib/tailwind';
|
||||||
import { AIMessageRole } from '@gitbook/api';
|
import { AIMessageRole } from '@gitbook/api';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import type { AIChatState } from '../AI/useAIChat';
|
import type { AIChatController, AIChatState } from '../AI/useAIChat';
|
||||||
|
import { AIChatFollowupSuggestions } from './AiChatFollowupSuggestions';
|
||||||
|
|
||||||
export function AIChatMessages(props: {
|
export function AIChatMessages(props: {
|
||||||
chat: AIChatState;
|
chat: AIChatState;
|
||||||
|
chatController: AIChatController;
|
||||||
lastUserMessageRef?: React.RefObject<HTMLDivElement>;
|
lastUserMessageRef?: React.RefObject<HTMLDivElement>;
|
||||||
}) {
|
}) {
|
||||||
const { chat, lastUserMessageRef } = props;
|
const { chat, chatController, lastUserMessageRef } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{chat.messages.map((message, index) => {
|
{chat.messages.map((message, index) => {
|
||||||
|
const isLastMessage = index === chat.messages.length - 1;
|
||||||
const isLastUserMessage =
|
const isLastUserMessage =
|
||||||
message.role === AIMessageRole.User &&
|
message.role === AIMessageRole.User &&
|
||||||
index === chat.messages.map((m) => m.role).lastIndexOf(AIMessageRole.User);
|
index === chat.messages.map((m) => m.role).lastIndexOf(AIMessageRole.User);
|
||||||
@@ -23,8 +26,9 @@ export function AIChatMessages(props: {
|
|||||||
message.content ? 'animate-[fadeIn_500ms_both]' : '',
|
message.content ? 'animate-[fadeIn_500ms_both]' : '',
|
||||||
'shrink-0',
|
'shrink-0',
|
||||||
'last:min-h-[calc(100%-5rem)]',
|
'last:min-h-[calc(100%-5rem)]',
|
||||||
|
'flex flex-col gap-6',
|
||||||
message.role === AIMessageRole.User
|
message.role === AIMessageRole.User
|
||||||
? 'max-w-[80%] self-end rounded-md bg-tint px-4 py-2'
|
? 'max-w-[80%] self-end circular-corners:rounded-2xl rounded-corners:rounded-md bg-tint px-4 py-2'
|
||||||
: ''
|
: ''
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
@@ -48,6 +52,12 @@ export function AIChatMessages(props: {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
{isLastMessage ? (
|
||||||
|
<AIChatFollowupSuggestions
|
||||||
|
chat={chat}
|
||||||
|
chatController={chatController}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export function AIChatFollowupSuggestions(props: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row flex-wrap justify-end gap-2 pt-8">
|
<div className="mt-auto flex flex-row flex-wrap justify-end gap-2">
|
||||||
{chat.followUpSuggestions.map((suggestion, index) => (
|
{chat.followUpSuggestions.map((suggestion, index) => (
|
||||||
<Button
|
<Button
|
||||||
key={index}
|
key={index}
|
||||||
@@ -23,9 +23,9 @@ export function AIChatFollowupSuggestions(props: {
|
|||||||
chatController.postMessage({ message: suggestion });
|
chatController.postMessage({ message: suggestion });
|
||||||
}}
|
}}
|
||||||
label={suggestion}
|
label={suggestion}
|
||||||
className="max-w-full animate-[present_500ms_both] whitespace-normal text-right"
|
className="max-w-[80%] animate-[present_500ms_both] whitespace-normal text-left ring-1 ring-tint-subtle"
|
||||||
size="small"
|
size="medium"
|
||||||
variant="secondary"
|
variant="blank"
|
||||||
style={{
|
style={{
|
||||||
animationDelay: `${250 + Math.min(index * 50, 150)}ms`,
|
animationDelay: `${250 + Math.min(index * 50, 150)}ms`,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export async function servePageMarkdown(context: GitBookSiteContext, pagePath: s
|
|||||||
const markdown = await throwIfDataError(
|
const markdown = await throwIfDataError(
|
||||||
context.dataFetcher.getRevisionPageMarkdown({
|
context.dataFetcher.getRevisionPageMarkdown({
|
||||||
spaceId: context.space.id,
|
spaceId: context.space.id,
|
||||||
revisionId: context.revision.id,
|
revisionId: context.revisionId,
|
||||||
pageId: page.id,
|
pageId: page.id,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @gitbook/openapi-parser
|
# @gitbook/openapi-parser
|
||||||
|
|
||||||
|
## 2.2.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- bd553bc: Expose `isJson` and `isYaml` in OpenAPI parser
|
||||||
|
|
||||||
## 2.1.5
|
## 2.1.5
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"default": "./dist/index.js"
|
"default": "./dist/index.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": "2.1.5",
|
"version": "2.2.0",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@scalar/openapi-parser": "^0.18.0",
|
"@scalar/openapi-parser": "^0.18.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export { parseOpenAPI } from './parse';
|
export { parseOpenAPI } from './parse';
|
||||||
|
|
||||||
export { dereference } from '@scalar/openapi-parser';
|
export { dereference, isJson, isYaml } from '@scalar/openapi-parser';
|
||||||
export type { AnyObject } from '@scalar/openapi-parser';
|
export type { AnyObject } from '@scalar/openapi-parser';
|
||||||
export type * from '@scalar/openapi-types';
|
export type * from '@scalar/openapi-types';
|
||||||
export * from './error';
|
export * from './error';
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @gitbook/react-openapi
|
# @gitbook/react-openapi
|
||||||
|
|
||||||
|
## 1.3.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [bd553bc]
|
||||||
|
- @gitbook/openapi-parser@2.2.0
|
||||||
|
|
||||||
## 1.3.1
|
## 1.3.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"default": "./dist/index.js"
|
"default": "./dist/index.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gitbook/openapi-parser": "workspace:*",
|
"@gitbook/openapi-parser": "workspace:*",
|
||||||
|
|||||||
Reference in New Issue
Block a user