@rayvision/ai-chat 0.0.1 → 0.0.2-beta
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/README.md +2 -2
- package/dist/index.d.ts +7 -427
- package/dist/index.js +45 -16461
- package/dist/index.mjs +9305 -12143
- package/dist/src/ai-chat.d.ts +4 -0
- package/dist/src/components/attachment-image-modal.d.ts +9 -0
- package/dist/src/components/chat-composer.d.ts +16 -0
- package/dist/src/components/chat-header.d.ts +10 -0
- package/dist/src/components/chat-launcher.d.ts +9 -0
- package/dist/src/components/chat-messages.d.ts +14 -0
- package/dist/src/components/chat-toast.d.ts +9 -0
- package/dist/src/components/message-bubble.d.ts +10 -0
- package/dist/src/components/modal.d.ts +11 -0
- package/dist/src/components/panel.d.ts +3 -0
- package/dist/src/components/popover.d.ts +11 -0
- package/dist/src/components/portal.d.ts +10 -0
- package/dist/src/components/tooltip.d.ts +11 -0
- package/dist/src/context/ai-chat-ui-context.d.ts +20 -0
- package/dist/src/controller/ai-chat-controller.d.ts +2 -0
- package/dist/src/hooks/use-ai-chat-layout.d.ts +10 -0
- package/dist/src/i18n/attachment-error-messages.d.ts +2 -0
- package/dist/src/i18n/index.d.ts +5 -0
- package/dist/src/i18n/messages.en.d.ts +61 -0
- package/dist/src/i18n/messages.zh.d.ts +61 -0
- package/dist/src/i18n/phase-labels.d.ts +2 -0
- package/dist/src/i18n/types.d.ts +1 -0
- package/dist/src/markdown/render.d.ts +3 -0
- package/dist/src/services/customer-v1/attachments/client.d.ts +9 -0
- package/dist/src/services/customer-v1/client.d.ts +9 -0
- package/dist/src/services/customer-v1/error.d.ts +3 -0
- package/dist/src/services/customer-v1/protocol.d.ts +93 -0
- package/dist/src/services/customer-v1/sse-parser.d.ts +2 -0
- package/dist/src/store/ai-chat-store.d.ts +41 -0
- package/dist/src/theme/global-style.d.ts +24 -0
- package/dist/src/theme/panel-style.d.ts +6 -0
- package/dist/src/types.d.ts +294 -0
- package/dist/src/utils/build-chat-content.d.ts +6 -0
- package/dist/src/utils/copy-text.d.ts +1 -0
- package/dist/src/utils/format-chat-file-error.d.ts +3 -0
- package/package.json +3 -3
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AIChatMountOptions, AIChatMountResult, AIChatProps } from './types';
|
|
3
|
+
export declare function mountAIChat(target: HTMLElement, options?: AIChatMountOptions): AIChatMountResult;
|
|
4
|
+
export declare function AIChat(props: AIChatProps): JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface AttachmentImageModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
imageUrl: string | null;
|
|
5
|
+
anchor?: Node | null;
|
|
6
|
+
onClose(): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AttachmentImageModal({ open, imageUrl, anchor, onClose, }: AttachmentImageModalProps): JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PendingAttachment } from '../types';
|
|
3
|
+
interface ChatComposerProps {
|
|
4
|
+
attachments: PendingAttachment[];
|
|
5
|
+
draft: string;
|
|
6
|
+
busy: boolean;
|
|
7
|
+
accept: string;
|
|
8
|
+
attachmentsAvailable: boolean;
|
|
9
|
+
onDraftChange(value: string): void;
|
|
10
|
+
onPaste(event: React.ClipboardEvent<HTMLTextAreaElement>): void;
|
|
11
|
+
onFiles(files: File[]): void;
|
|
12
|
+
onRemoveAttachment(id: string): void;
|
|
13
|
+
onSubmit(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function ChatComposer({ attachments, draft, busy, accept, attachmentsAvailable, onDraftChange, onPaste, onFiles, onRemoveAttachment, onSubmit, }: ChatComposerProps): JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ChatHeaderProps {
|
|
3
|
+
isWelcome: boolean;
|
|
4
|
+
onNewChat(): void;
|
|
5
|
+
onShare(): void;
|
|
6
|
+
shareDisabled?: boolean;
|
|
7
|
+
onCollapse(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function ChatHeader({ isWelcome, onNewChat, onShare, shareDisabled, onCollapse, }: ChatHeaderProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import type { AIChatPanelProps } from '../types';
|
|
3
|
+
export declare function AIChatLauncher({ controller, disabled, className, onPositionChange, style, }: {
|
|
4
|
+
controller: AIChatPanelProps['controller'];
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
onPositionChange?: (left: number, top: number) => void;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ChatMessage, Citation, SuggestedQuestion } from '../types';
|
|
3
|
+
interface ChatMessagesProps {
|
|
4
|
+
messages: ChatMessage[];
|
|
5
|
+
phase: string | null;
|
|
6
|
+
dragging: boolean;
|
|
7
|
+
suggestedQuestions: SuggestedQuestion[];
|
|
8
|
+
onSuggestedQuestion(question: SuggestedQuestion): void;
|
|
9
|
+
onCitationClick?(messageId: string, citationId: string): Promise<Citation | undefined>;
|
|
10
|
+
onRetry?(): void;
|
|
11
|
+
onFeedback?(messageId: string, rating: 'like' | 'dislike' | null, comment?: string): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare function ChatMessages({ messages, phase, dragging, suggestedQuestions, onSuggestedQuestion, onCitationClick, onRetry, onFeedback, }: ChatMessagesProps): JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ChatToast } from '../types';
|
|
3
|
+
interface ChatToastProps {
|
|
4
|
+
toast: ChatToast | null;
|
|
5
|
+
duration?: number;
|
|
6
|
+
onClose(): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AIChatToast({ toast, duration, onClose, }: ChatToastProps): JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ChatFeedbackRating, ChatMessage, Citation } from '../types';
|
|
3
|
+
interface MessageBubbleProps {
|
|
4
|
+
message: ChatMessage;
|
|
5
|
+
onCitationClick?: (messageId: string, citationId: string) => Promise<Citation | undefined>;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
onFeedback?: (messageId: string, rating: ChatFeedbackRating | null, comment?: string) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const MessageBubble: import("react").NamedExoticComponent<MessageBubbleProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type AIChatPortalContainer } from './portal';
|
|
3
|
+
export interface AIChatModalProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
anchor?: Node | null;
|
|
7
|
+
container?: AIChatPortalContainer | null;
|
|
8
|
+
className?: string;
|
|
9
|
+
onClose?(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function AIChatModal({ open, children, anchor, container, className, onClose, }: AIChatModalProps): JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type AIChatPortalContainer } from './portal';
|
|
3
|
+
export interface AIChatPopoverProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
anchor?: HTMLElement | null;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
container?: AIChatPortalContainer | null;
|
|
8
|
+
className?: string;
|
|
9
|
+
onClose?(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function AIChatPopover({ open, anchor, children, container, className, onClose, }: AIChatPopoverProps): JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type AIChatPortalContainer = Element | DocumentFragment;
|
|
3
|
+
export declare function resolveAIChatPortalContainer(anchor: Node | null | undefined): AIChatPortalContainer | null;
|
|
4
|
+
interface AIChatPortalProps {
|
|
5
|
+
anchor?: Node | null;
|
|
6
|
+
container?: AIChatPortalContainer | null;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function AIChatPortal({ anchor, container, children, }: AIChatPortalProps): JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type AIChatPortalContainer } from './portal';
|
|
3
|
+
export interface AIChatTooltipProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
anchor?: Node | null;
|
|
7
|
+
container?: AIChatPortalContainer | null;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export declare function AIChatTooltip({ open, children, anchor, container, className, style, }: AIChatTooltipProps): JSX.Element | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { AIChatMessages } from '../i18n';
|
|
3
|
+
import type { AIChatLanguage, AIChatTheme } from '../types';
|
|
4
|
+
interface AIChatUIContextValue {
|
|
5
|
+
labels: AIChatMessages;
|
|
6
|
+
language: AIChatLanguage;
|
|
7
|
+
theme: AIChatTheme;
|
|
8
|
+
toggleTheme: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function AIChatUIProvider({ labels, language, theme, toggleTheme, children, }: {
|
|
11
|
+
labels: AIChatMessages;
|
|
12
|
+
language: AIChatLanguage;
|
|
13
|
+
theme: AIChatTheme;
|
|
14
|
+
toggleTheme: () => void;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}): JSX.Element;
|
|
17
|
+
export declare function useAIChatUI(): AIChatUIContextValue;
|
|
18
|
+
export declare function useAIChatMessages(): Pick<AIChatUIContextValue, 'labels' | 'language'>;
|
|
19
|
+
export declare function useAIChatTheme(): Pick<AIChatUIContextValue, 'theme' | 'toggleTheme'>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CSSProperties, type PointerEvent } from 'react';
|
|
2
|
+
type ResizeEdge = 'left' | 'top' | 'right' | 'bottom';
|
|
3
|
+
interface AIChatLayout {
|
|
4
|
+
launcherStyle: CSSProperties;
|
|
5
|
+
panelStyle?: CSSProperties;
|
|
6
|
+
onPositionChange: (left: number, top: number) => void;
|
|
7
|
+
onResizeStart: (edge: ResizeEdge, event: PointerEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useAIChatLayout(enabled: boolean): AIChatLayout;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ZH_MESSAGES } from './messages.zh';
|
|
2
|
+
import type { AIChatLanguage } from './types';
|
|
3
|
+
export type AIChatMessages = typeof ZH_MESSAGES;
|
|
4
|
+
export declare function getMessages(language: AIChatLanguage): AIChatMessages;
|
|
5
|
+
export { getPhaseLabel } from './phase-labels';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const EN_MESSAGES: {
|
|
2
|
+
title: string;
|
|
3
|
+
openAssistant: string;
|
|
4
|
+
welcome: string;
|
|
5
|
+
welcomeDescription: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
send: string;
|
|
8
|
+
stop: string;
|
|
9
|
+
newChat: string;
|
|
10
|
+
collapse: string;
|
|
11
|
+
citations: (count: number) => string;
|
|
12
|
+
expandCitations: string;
|
|
13
|
+
collapseCitations: string;
|
|
14
|
+
share: string;
|
|
15
|
+
sharing: string;
|
|
16
|
+
shareCopied: string;
|
|
17
|
+
shareFailed: string;
|
|
18
|
+
attach: string;
|
|
19
|
+
removeAttachment: string;
|
|
20
|
+
emptyInput: string;
|
|
21
|
+
dropFiles: string;
|
|
22
|
+
copied: string;
|
|
23
|
+
copyFailed: string;
|
|
24
|
+
copy: string;
|
|
25
|
+
humanSupport: string;
|
|
26
|
+
like: string;
|
|
27
|
+
dislike: string;
|
|
28
|
+
feedbackTitle: string;
|
|
29
|
+
feedbackSubmit: string;
|
|
30
|
+
feedbackThanks: string;
|
|
31
|
+
feedbackFailed: string;
|
|
32
|
+
closeFeedback: string;
|
|
33
|
+
feedbackOtherPlaceholder: string;
|
|
34
|
+
feedbackUnprofessional: string;
|
|
35
|
+
feedbackUnresolved: string;
|
|
36
|
+
feedbackMisunderstood: string;
|
|
37
|
+
feedbackSlow: string;
|
|
38
|
+
feedbackOther: string;
|
|
39
|
+
attachment: string;
|
|
40
|
+
fileLimitExceeded: (maxCount: number | string) => string;
|
|
41
|
+
fileTooLarge: (fileName: number | string) => string;
|
|
42
|
+
unsupportedFile: (fileName: number | string) => string;
|
|
43
|
+
attachmentError: (errorCode: string) => string;
|
|
44
|
+
processing: string;
|
|
45
|
+
syncing: string;
|
|
46
|
+
loading: string;
|
|
47
|
+
retry: string;
|
|
48
|
+
requestFailed: string;
|
|
49
|
+
darkMode: string;
|
|
50
|
+
lightMode: string;
|
|
51
|
+
previewImage: string;
|
|
52
|
+
closeImagePreview: string;
|
|
53
|
+
closeCitation: string;
|
|
54
|
+
assistantName: string;
|
|
55
|
+
citationCategoryPath: string;
|
|
56
|
+
citationPublishedAt: string;
|
|
57
|
+
citationUpdatedAt: string;
|
|
58
|
+
citationContentVersion: string;
|
|
59
|
+
attachmentUploaded: string;
|
|
60
|
+
disclaimer: string;
|
|
61
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const ZH_MESSAGES: {
|
|
2
|
+
title: string;
|
|
3
|
+
openAssistant: string;
|
|
4
|
+
welcome: string;
|
|
5
|
+
welcomeDescription: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
send: string;
|
|
8
|
+
stop: string;
|
|
9
|
+
newChat: string;
|
|
10
|
+
collapse: string;
|
|
11
|
+
citations: (count: number) => string;
|
|
12
|
+
expandCitations: string;
|
|
13
|
+
collapseCitations: string;
|
|
14
|
+
share: string;
|
|
15
|
+
sharing: string;
|
|
16
|
+
shareCopied: string;
|
|
17
|
+
shareFailed: string;
|
|
18
|
+
attach: string;
|
|
19
|
+
removeAttachment: string;
|
|
20
|
+
emptyInput: string;
|
|
21
|
+
dropFiles: string;
|
|
22
|
+
copied: string;
|
|
23
|
+
copyFailed: string;
|
|
24
|
+
copy: string;
|
|
25
|
+
humanSupport: string;
|
|
26
|
+
like: string;
|
|
27
|
+
dislike: string;
|
|
28
|
+
feedbackTitle: string;
|
|
29
|
+
feedbackSubmit: string;
|
|
30
|
+
feedbackThanks: string;
|
|
31
|
+
feedbackFailed: string;
|
|
32
|
+
closeFeedback: string;
|
|
33
|
+
feedbackOtherPlaceholder: string;
|
|
34
|
+
feedbackUnprofessional: string;
|
|
35
|
+
feedbackUnresolved: string;
|
|
36
|
+
feedbackMisunderstood: string;
|
|
37
|
+
feedbackSlow: string;
|
|
38
|
+
feedbackOther: string;
|
|
39
|
+
attachment: string;
|
|
40
|
+
fileLimitExceeded: (maxCount: number | string) => string;
|
|
41
|
+
fileTooLarge: (fileName: number | string) => string;
|
|
42
|
+
unsupportedFile: (fileName: number | string) => string;
|
|
43
|
+
attachmentError: (errorCode: string) => string;
|
|
44
|
+
processing: string;
|
|
45
|
+
syncing: string;
|
|
46
|
+
loading: string;
|
|
47
|
+
retry: string;
|
|
48
|
+
requestFailed: string;
|
|
49
|
+
darkMode: string;
|
|
50
|
+
lightMode: string;
|
|
51
|
+
previewImage: string;
|
|
52
|
+
closeImagePreview: string;
|
|
53
|
+
closeCitation: string;
|
|
54
|
+
assistantName: string;
|
|
55
|
+
citationCategoryPath: string;
|
|
56
|
+
citationPublishedAt: string;
|
|
57
|
+
citationUpdatedAt: string;
|
|
58
|
+
citationContentVersion: string;
|
|
59
|
+
attachmentUploaded: string;
|
|
60
|
+
disclaimer: string;
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AIChatLanguage = 'zh' | 'en';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Attachment, AttachmentOptions, GatewayError } from '../../../types';
|
|
2
|
+
export interface AttachmentClient {
|
|
3
|
+
getOptions(): Promise<AttachmentOptions>;
|
|
4
|
+
upload(file: File, clientUploadId: string): Promise<Attachment>;
|
|
5
|
+
getContent(attachmentId: string, download?: boolean): Promise<Blob>;
|
|
6
|
+
delete(attachmentId: string): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createAttachmentClient(baseUrl: string): AttachmentClient;
|
|
9
|
+
export declare function isGatewayError(value: unknown): value is GatewayError;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChatAdapter, ConversationItem, Attachment, AttachmentOptions } from '../../types';
|
|
2
|
+
export interface CustomerV1ChatAdapterOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
shareOrigin?: string;
|
|
5
|
+
module?: string;
|
|
6
|
+
knowledgeScope?: 'public';
|
|
7
|
+
}
|
|
8
|
+
export declare function createCustomerV1ChatAdapter(options?: CustomerV1ChatAdapterOptions): ChatAdapter;
|
|
9
|
+
export type { Attachment, AttachmentOptions, ConversationItem };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Attachment, AttachmentOptions, ChatFeedback, Citation, ConversationItem, GatewayError, SuggestedQuestion } from '../../types';
|
|
2
|
+
export interface FreeQueryRequest {
|
|
3
|
+
query?: string;
|
|
4
|
+
attachment_ids?: string[];
|
|
5
|
+
client_message_id: string;
|
|
6
|
+
conversation_id?: string;
|
|
7
|
+
module?: string;
|
|
8
|
+
knowledge_scope?: 'public';
|
|
9
|
+
}
|
|
10
|
+
export interface SuggestedQuestionRequest {
|
|
11
|
+
suggested_question_id: string;
|
|
12
|
+
suggested_question_version: number;
|
|
13
|
+
attachment_ids?: string[];
|
|
14
|
+
client_message_id: string;
|
|
15
|
+
conversation_id?: string;
|
|
16
|
+
module?: string;
|
|
17
|
+
knowledge_scope?: 'public';
|
|
18
|
+
}
|
|
19
|
+
export interface RunReadRequest {
|
|
20
|
+
run_id: string;
|
|
21
|
+
}
|
|
22
|
+
export type ChatStreamRequest = FreeQueryRequest | SuggestedQuestionRequest | RunReadRequest;
|
|
23
|
+
export interface RunStartedEvent {
|
|
24
|
+
conversation_id: string;
|
|
25
|
+
run_id: string;
|
|
26
|
+
request_id: string;
|
|
27
|
+
sequence: number;
|
|
28
|
+
}
|
|
29
|
+
export interface RunProgressEvent {
|
|
30
|
+
run_id: string;
|
|
31
|
+
phase: string;
|
|
32
|
+
progress_sequence: number;
|
|
33
|
+
}
|
|
34
|
+
export interface AnswerDeltaEvent {
|
|
35
|
+
run_id: string;
|
|
36
|
+
sequence: number;
|
|
37
|
+
text: string;
|
|
38
|
+
}
|
|
39
|
+
export interface AnswerSnapshotEvent {
|
|
40
|
+
run_id: string;
|
|
41
|
+
sequence: number;
|
|
42
|
+
answer: string;
|
|
43
|
+
status: string;
|
|
44
|
+
citations: Citation[];
|
|
45
|
+
}
|
|
46
|
+
export interface RunTerminalEvent {
|
|
47
|
+
run_id?: string;
|
|
48
|
+
conversation_id?: string;
|
|
49
|
+
sequence?: number;
|
|
50
|
+
status: string;
|
|
51
|
+
answer?: string;
|
|
52
|
+
citations?: Citation[];
|
|
53
|
+
error_code: string;
|
|
54
|
+
message?: string;
|
|
55
|
+
retry_after?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface GatewaySseEvent {
|
|
58
|
+
id?: string;
|
|
59
|
+
event: string;
|
|
60
|
+
data: unknown;
|
|
61
|
+
}
|
|
62
|
+
export interface ConversationResponse {
|
|
63
|
+
request_id: string;
|
|
64
|
+
conversation_id: string;
|
|
65
|
+
items: ConversationItem[];
|
|
66
|
+
}
|
|
67
|
+
export interface ShareConversationResponse {
|
|
68
|
+
request_id: string;
|
|
69
|
+
conversation_id: string;
|
|
70
|
+
}
|
|
71
|
+
export interface SuggestedQuestionsResponse {
|
|
72
|
+
module: string;
|
|
73
|
+
items: SuggestedQuestion[];
|
|
74
|
+
}
|
|
75
|
+
export type AttachmentOptionsResponse = AttachmentOptions;
|
|
76
|
+
export interface AttachmentResponse {
|
|
77
|
+
request_id: string;
|
|
78
|
+
attachment: Attachment;
|
|
79
|
+
}
|
|
80
|
+
export interface CitationResponse {
|
|
81
|
+
request_id: string;
|
|
82
|
+
status: string;
|
|
83
|
+
citations: Citation[];
|
|
84
|
+
}
|
|
85
|
+
export interface FeedbackResponse {
|
|
86
|
+
request_id: string;
|
|
87
|
+
run_id: string;
|
|
88
|
+
feedback: ChatFeedback | null;
|
|
89
|
+
}
|
|
90
|
+
export type ErrorPayload = Partial<GatewayError> & {
|
|
91
|
+
error_code?: string;
|
|
92
|
+
status?: string;
|
|
93
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { StoreApi, UseBoundStore } from 'zustand';
|
|
2
|
+
import type { AttachmentOptions, AttachmentPolicy, ChatFileError, ChatMessage, ChatToast, GatewayError, PendingAttachment, SuggestedQuestion } from '../types';
|
|
3
|
+
export declare const DEFAULT_ATTACHMENT_POLICY: AttachmentPolicy;
|
|
4
|
+
export interface AIChatStoreState {
|
|
5
|
+
open: boolean;
|
|
6
|
+
restoring: boolean;
|
|
7
|
+
messages: ChatMessage[];
|
|
8
|
+
busy: boolean;
|
|
9
|
+
draft: string;
|
|
10
|
+
attachments: PendingAttachment[];
|
|
11
|
+
attachmentError: ChatFileError | GatewayError | null;
|
|
12
|
+
toast: ChatToast | null;
|
|
13
|
+
attachmentPolicy: AttachmentPolicy;
|
|
14
|
+
attachmentOptions: AttachmentOptions | null;
|
|
15
|
+
suggestedQuestions: SuggestedQuestion[];
|
|
16
|
+
conversationId: string | null;
|
|
17
|
+
activeRunId: string | null;
|
|
18
|
+
phase: string | null;
|
|
19
|
+
toggle(show?: boolean): void;
|
|
20
|
+
setMessages(messages: ChatMessage[]): void;
|
|
21
|
+
updateMessages(update: (current: ChatMessage[]) => ChatMessage[]): void;
|
|
22
|
+
setBusy(busy: boolean): void;
|
|
23
|
+
setRestoring(restoring: boolean): void;
|
|
24
|
+
setDraft(draft: string): void;
|
|
25
|
+
clearMessages(): void;
|
|
26
|
+
clearDraft(): void;
|
|
27
|
+
resetComposer(): void;
|
|
28
|
+
setAttachmentOptions(options: AttachmentOptions): void;
|
|
29
|
+
setSuggestedQuestions(items: SuggestedQuestion[]): void;
|
|
30
|
+
setConversation(conversationId: string | null, runId?: string | null): void;
|
|
31
|
+
setPhase(phase: string | null): void;
|
|
32
|
+
setAttachmentState(id: string, update: Partial<PendingAttachment>): void;
|
|
33
|
+
setAttachmentError(error: ChatFileError | GatewayError | null): void;
|
|
34
|
+
showToast(toast: ChatToast): void;
|
|
35
|
+
clearToast(): void;
|
|
36
|
+
addAttachment(attachment: PendingAttachment): void;
|
|
37
|
+
removeAttachmentLocal(id: string): void;
|
|
38
|
+
clearAttachments(): void;
|
|
39
|
+
}
|
|
40
|
+
export type AIChatStore = UseBoundStore<StoreApi<AIChatStoreState>>;
|
|
41
|
+
export declare function createAIChatStore(defaultOpen?: boolean): AIChatStore;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const CHAT_TOKENS: {
|
|
2
|
+
readonly '--rb-chat-ink': "#182027";
|
|
3
|
+
readonly '--rb-chat-muted': "#71808a";
|
|
4
|
+
readonly '--rb-chat-line': "#e8edf0";
|
|
5
|
+
readonly '--rb-chat-surface': "#ffffff";
|
|
6
|
+
readonly '--rb-chat-soft': "#f6f8f9";
|
|
7
|
+
readonly '--rb-chat-accent': "#19c47a";
|
|
8
|
+
readonly '--rb-chat-accent-strong': "#0ca866";
|
|
9
|
+
readonly '--rb-chat-accent-pale': "#e8faf2";
|
|
10
|
+
readonly '--rb-chat-shadow': "0 24px 70px rgba(23,44,54,.2), 0 4px 14px rgba(23,44,54,.08)";
|
|
11
|
+
};
|
|
12
|
+
export declare const CHAT_DARK_TOKENS: {
|
|
13
|
+
readonly '--rb-chat-ink': "#f1f5f7";
|
|
14
|
+
readonly '--rb-chat-muted': "#9aa8b0";
|
|
15
|
+
readonly '--rb-chat-line': "#34434b";
|
|
16
|
+
readonly '--rb-chat-surface': "#1f2b31";
|
|
17
|
+
readonly '--rb-chat-soft': "#2b3941";
|
|
18
|
+
readonly '--rb-chat-accent': "#21d783";
|
|
19
|
+
readonly '--rb-chat-accent-strong': "#13cb75";
|
|
20
|
+
readonly '--rb-chat-accent-pale': "#173b2d";
|
|
21
|
+
readonly '--rb-chat-shadow': "0 24px 60px rgba(0, 0, 0, .42)";
|
|
22
|
+
};
|
|
23
|
+
export declare function buildStyleText(): string;
|
|
24
|
+
export declare function injectStyles(root: ShadowRoot | HTMLElement): HTMLStyleElement;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS remains in real stylesheets for IDE completion and class-to-selector navigation.
|
|
3
|
+
* The bundled text is injected into the chat Shadow DOM at runtime.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CHAT_PANEL_STYLES: string;
|
|
6
|
+
export declare function getChatPanelStyles(): string;
|