mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 433d66482d | |||
| bd553bcf9e | |||
| f5894bcf74 | |||
| 1b59e7ce36 |
@@ -1,5 +1,15 @@
|
||||
# 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
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gitbook",
|
||||
"version": "0.13.0",
|
||||
"version": "0.13.1",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@gitbook/api": "catalog:",
|
||||
|
||||
@@ -16,7 +16,6 @@ import AIChatIcon from './AIChatIcon';
|
||||
import { AIChatInput } from './AIChatInput';
|
||||
import { AIChatMessages } from './AIChatMessages';
|
||||
import AIChatSuggestedQuestions from './AIChatSuggestedQuestions';
|
||||
import { AIChatFollowupSuggestions } from './AiChatFollowupSuggestions';
|
||||
|
||||
export function AIChat() {
|
||||
const chat = useAIChatState();
|
||||
@@ -169,7 +168,11 @@ export function AIChatWindow(props: { chat: AIChatState }) {
|
||||
) : null}
|
||||
</div>
|
||||
) : (
|
||||
<AIChatMessages chat={chat} lastUserMessageRef={lastUserMessageRef} />
|
||||
<AIChatMessages
|
||||
chat={chat}
|
||||
chatController={chatController}
|
||||
lastUserMessageRef={lastUserMessageRef}
|
||||
/>
|
||||
)}
|
||||
</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"
|
||||
>
|
||||
{/* Display an error banner when something went wrong. */}
|
||||
{chat.error ? (
|
||||
<AIChatError chatController={chatController} />
|
||||
) : (
|
||||
<AIChatFollowupSuggestions chat={chat} chatController={chatController} />
|
||||
)}
|
||||
{chat.error ? <AIChatError chatController={chatController} /> : null}
|
||||
|
||||
<AIChatInput
|
||||
value={input}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
import { AIMessageRole } from '@gitbook/api';
|
||||
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: {
|
||||
chat: AIChatState;
|
||||
chatController: AIChatController;
|
||||
lastUserMessageRef?: React.RefObject<HTMLDivElement>;
|
||||
}) {
|
||||
const { chat, lastUserMessageRef } = props;
|
||||
const { chat, chatController, lastUserMessageRef } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
{chat.messages.map((message, index) => {
|
||||
const isLastMessage = index === chat.messages.length - 1;
|
||||
const isLastUserMessage =
|
||||
message.role === 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]' : '',
|
||||
'shrink-0',
|
||||
'last:min-h-[calc(100%-5rem)]',
|
||||
'flex flex-col gap-6',
|
||||
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={{
|
||||
@@ -48,6 +52,12 @@ export function AIChatMessages(props: {
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
{isLastMessage ? (
|
||||
<AIChatFollowupSuggestions
|
||||
chat={chat}
|
||||
chatController={chatController}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -15,7 +15,7 @@ export function AIChatFollowupSuggestions(props: {
|
||||
}
|
||||
|
||||
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) => (
|
||||
<Button
|
||||
key={index}
|
||||
@@ -23,9 +23,9 @@ export function AIChatFollowupSuggestions(props: {
|
||||
chatController.postMessage({ message: suggestion });
|
||||
}}
|
||||
label={suggestion}
|
||||
className="max-w-full animate-[present_500ms_both] whitespace-normal text-right"
|
||||
size="small"
|
||||
variant="secondary"
|
||||
className="max-w-[80%] animate-[present_500ms_both] whitespace-normal text-left ring-1 ring-tint-subtle"
|
||||
size="medium"
|
||||
variant="blank"
|
||||
style={{
|
||||
animationDelay: `${250 + Math.min(index * 50, 150)}ms`,
|
||||
}}
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function servePageMarkdown(context: GitBookSiteContext, pagePath: s
|
||||
const markdown = await throwIfDataError(
|
||||
context.dataFetcher.getRevisionPageMarkdown({
|
||||
spaceId: context.space.id,
|
||||
revisionId: context.revision.id,
|
||||
revisionId: context.revisionId,
|
||||
pageId: page.id,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @gitbook/openapi-parser
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- bd553bc: Expose `isJson` and `isYaml` in OpenAPI parser
|
||||
|
||||
## 2.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"version": "2.1.5",
|
||||
"version": "2.2.0",
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@scalar/openapi-parser": "^0.18.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 * from '@scalar/openapi-types';
|
||||
export * from './error';
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @gitbook/react-openapi
|
||||
|
||||
## 1.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bd553bc]
|
||||
- @gitbook/openapi-parser@2.2.0
|
||||
|
||||
## 1.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"@gitbook/openapi-parser": "workspace:*",
|
||||
|
||||
Reference in New Issue
Block a user