@hkyhy/marsun-components-core 0.1.3 → 0.1.5

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.
Files changed (136) hide show
  1. package/README.md +5 -7
  2. package/dist/components/AgentHub/AgentHubAccessGuard.d.ts +11 -0
  3. package/dist/components/AgentHub/AgentHubIndexRedirect.d.ts +8 -0
  4. package/dist/components/AgentHub/Chat/Action/CreateButton.d.ts +6 -0
  5. package/dist/components/AgentHub/Chat/Action/ManageActionButtons.d.ts +6 -0
  6. package/dist/components/AgentHub/Chat/Action/SessionActionButtons.d.ts +8 -0
  7. package/dist/components/AgentHub/Chat/Action/handlers.d.ts +11 -0
  8. package/dist/components/AgentHub/Chat/Action/index.d.ts +7 -0
  9. package/dist/components/AgentHub/Chat/Detail/ChatInput/index.d.ts +11 -0
  10. package/dist/components/AgentHub/Chat/Detail/CitationContent/index.d.ts +6 -0
  11. package/dist/components/AgentHub/Chat/Detail/CitationInlineBadge/index.d.ts +7 -0
  12. package/dist/components/AgentHub/Chat/Detail/CitationMarkdownContent/index.d.ts +12 -0
  13. package/dist/components/AgentHub/Chat/Detail/CitationPanel/index.d.ts +9 -0
  14. package/dist/components/AgentHub/Chat/Detail/MermaidBlock/index.d.ts +7 -0
  15. package/dist/components/AgentHub/Chat/Detail/MessageActions/index.d.ts +33 -0
  16. package/dist/components/AgentHub/Chat/Detail/MessageEditPopover/index.d.ts +13 -0
  17. package/dist/components/AgentHub/Chat/Detail/MessageItem/index.d.ts +14 -0
  18. package/dist/components/AgentHub/Chat/Detail/ThinkingSection/index.d.ts +13 -0
  19. package/dist/components/AgentHub/Chat/Detail/index.d.ts +12 -0
  20. package/dist/components/AgentHub/Chat/Form/Form.d.ts +16 -0
  21. package/dist/components/AgentHub/Chat/Form/index.d.ts +2 -0
  22. package/dist/components/AgentHub/Chat/List/ChatCard/index.d.ts +11 -0
  23. package/dist/components/AgentHub/Chat/List/FilterBar.d.ts +7 -0
  24. package/dist/components/AgentHub/Chat/List/SessionSidebar/index.d.ts +15 -0
  25. package/dist/components/AgentHub/Chat/List/index.d.ts +6 -0
  26. package/dist/components/AgentHub/Chat/Modal/FormModal.d.ts +12 -0
  27. package/dist/components/AgentHub/Chat/Modal/index.d.ts +2 -0
  28. package/dist/components/AgentHub/Chat/constants/index.d.ts +1 -0
  29. package/dist/components/AgentHub/Chat/constants/types.d.ts +2 -0
  30. package/dist/components/AgentHub/Chat/hooks/index.d.ts +5 -0
  31. package/dist/components/AgentHub/Chat/hooks/useAutoScrollToBottom.d.ts +21 -0
  32. package/dist/components/AgentHub/Chat/hooks/useChat.d.ts +19 -0
  33. package/dist/components/AgentHub/Chat/hooks/useChatSessions.d.ts +20 -0
  34. package/dist/components/AgentHub/Chat/hooks/useSSECompletion.d.ts +13 -0
  35. package/dist/components/AgentHub/Chat/hooks/useTypewriter.d.ts +16 -0
  36. package/dist/components/AgentHub/Chat/index.d.ts +7 -0
  37. package/dist/components/AgentHub/Chat/utils/citationContent.d.ts +37 -0
  38. package/dist/components/AgentHub/Chat/utils/index.d.ts +5 -0
  39. package/dist/components/AgentHub/Chat/utils/messageContent.d.ts +18 -0
  40. package/dist/components/AgentHub/Chat/utils/sanitizeMermaidChart.d.ts +7 -0
  41. package/dist/components/AgentHub/Chat/utils/sessionMessages.d.ts +21 -0
  42. package/dist/components/AgentHub/Chat/utils/smoothScroll.d.ts +14 -0
  43. package/dist/components/AgentHub/ChatSessionAccessGuard.d.ts +8 -0
  44. package/dist/components/AgentHub/KnowledgeBase/Action/CreateButton.d.ts +6 -0
  45. package/dist/components/AgentHub/KnowledgeBase/Action/ManageActionButtons.d.ts +6 -0
  46. package/dist/components/AgentHub/KnowledgeBase/Action/handlers.d.ts +5 -0
  47. package/dist/components/AgentHub/KnowledgeBase/Action/index.d.ts +5 -0
  48. package/dist/components/AgentHub/KnowledgeBase/Detail/DocumentTable/index.d.ts +16 -0
  49. package/dist/components/AgentHub/KnowledgeBase/Detail/ParseStatusTag/index.d.ts +6 -0
  50. package/dist/components/AgentHub/KnowledgeBase/Detail/index.d.ts +4 -0
  51. package/dist/components/AgentHub/KnowledgeBase/Form/Form.d.ts +13 -0
  52. package/dist/components/AgentHub/KnowledgeBase/Form/index.d.ts +2 -0
  53. package/dist/components/AgentHub/KnowledgeBase/List/FilterBar.d.ts +7 -0
  54. package/dist/components/AgentHub/KnowledgeBase/List/KnowledgeCard/index.d.ts +11 -0
  55. package/dist/components/AgentHub/KnowledgeBase/List/index.d.ts +4 -0
  56. package/dist/components/AgentHub/KnowledgeBase/Modal/FormModal.d.ts +11 -0
  57. package/dist/components/AgentHub/KnowledgeBase/Modal/index.d.ts +2 -0
  58. package/dist/components/AgentHub/KnowledgeBase/constants/index.d.ts +1 -0
  59. package/dist/components/AgentHub/KnowledgeBase/constants/types.d.ts +16 -0
  60. package/dist/components/AgentHub/KnowledgeBase/hooks/index.d.ts +2 -0
  61. package/dist/components/AgentHub/KnowledgeBase/hooks/useKBDocuments.d.ts +10 -0
  62. package/dist/components/AgentHub/KnowledgeBase/hooks/useKnowledgeBase.d.ts +13 -0
  63. package/dist/components/AgentHub/KnowledgeBase/index.d.ts +7 -0
  64. package/dist/components/AgentHub/types.d.ts +83 -0
  65. package/dist/components/Auth/PermissionGuard.d.ts +19 -0
  66. package/dist/components/Auth/ProtectedRoute.d.ts +10 -0
  67. package/dist/components/Auth/hasPermission.d.ts +2 -0
  68. package/dist/components/Auth/index.d.ts +3 -0
  69. package/dist/components/Auth/types.d.ts +1 -0
  70. package/dist/components/Descriptions/CommonDescriptions.d.ts +23 -0
  71. package/dist/components/Descriptions/index.d.ts +2 -0
  72. package/dist/components/File/FileItem/index.d.ts +22 -0
  73. package/dist/components/File/FileLink/index.d.ts +8 -0
  74. package/dist/components/File/FilePreview/index.d.ts +11 -0
  75. package/dist/components/File/FilePreviewModal/index.d.ts +10 -0
  76. package/dist/components/File/fileDisplay.d.ts +11 -0
  77. package/dist/components/File/index.d.ts +10 -0
  78. package/dist/components/File/types.d.ts +20 -0
  79. package/dist/components/Filter/CommonFilter/index.d.ts +41 -0
  80. package/dist/components/Filter/FilterDateRange/index.d.ts +18 -0
  81. package/dist/components/Filter/FilterInput/index.d.ts +10 -0
  82. package/dist/components/Filter/FilterNumberRange/index.d.ts +12 -0
  83. package/dist/components/Filter/FilterPanel/index.d.ts +11 -0
  84. package/dist/components/Filter/FilterPopover/index.d.ts +24 -0
  85. package/dist/components/Filter/FilterSelect/index.d.ts +18 -0
  86. package/dist/components/Filter/FilterTreeSelect/index.d.ts +22 -0
  87. package/dist/components/Filter/FilterTrigger/index.d.ts +16 -0
  88. package/dist/components/Filter/index.d.ts +30 -0
  89. package/dist/components/Filter/types.d.ts +35 -0
  90. package/dist/components/Filter/useFilterState.d.ts +49 -0
  91. package/dist/components/Form/FetchSelect.d.ts +21 -0
  92. package/dist/components/Form/FetchTreeSelect.d.ts +22 -0
  93. package/dist/components/Form/PersonOptionRow/index.d.ts +9 -0
  94. package/dist/components/Form/StepForm.d.ts +42 -0
  95. package/dist/components/Form/index.d.ts +8 -0
  96. package/dist/components/Icons/index.d.ts +85 -0
  97. package/dist/components/Layout/PageHeaderLayout/index.d.ts +12 -0
  98. package/dist/components/Layout/index.d.ts +2 -0
  99. package/dist/components/Modal/StepModal/index.d.ts +25 -0
  100. package/dist/components/Modal/StepModalTypes.d.ts +40 -0
  101. package/dist/components/Modal/index.d.ts +2 -0
  102. package/dist/components/Stat/StatCard/index.d.ts +22 -0
  103. package/dist/components/Stat/StatCardList.d.ts +26 -0
  104. package/dist/components/Stat/StatPendingBreakdown/index.d.ts +25 -0
  105. package/dist/components/Stat/index.d.ts +6 -0
  106. package/dist/components/Tag/FileTags.d.ts +6 -0
  107. package/dist/components/Tag/SemanticTag.d.ts +52 -0
  108. package/dist/components/Tag/Tags/index.d.ts +16 -0
  109. package/dist/components/Tag/index.d.ts +6 -0
  110. package/dist/components/TooltipInfo/TooltipInfo.d.ts +19 -0
  111. package/dist/components/TooltipInfo/index.d.ts +2 -0
  112. package/dist/components/Tour/AppTour/index.d.ts +19 -0
  113. package/dist/components/Tour/index.d.ts +2 -0
  114. package/dist/components/Upload/index.d.ts +66 -0
  115. package/dist/components/Upload/index.js +181 -0
  116. package/dist/components/Upload/index.js.map +1 -0
  117. package/dist/components/Upload/style.module.scss.js +19 -0
  118. package/dist/components/Upload/style.module.scss.js.map +1 -0
  119. package/dist/components/VirtualScrollbar/VirtualScrollbar/index.d.ts +14 -0
  120. package/dist/components/VirtualScrollbar/index.d.ts +3 -0
  121. package/dist/components/VirtualScrollbar/useVirtualScrollbar.d.ts +23 -0
  122. package/dist/components/index.d.ts +15 -0
  123. package/dist/hooks/useFetchData.d.ts +22 -0
  124. package/dist/index.d.ts +26 -28
  125. package/dist/index.js +166 -164
  126. package/dist/index.js.map +1 -1
  127. package/dist/marsun-components-core.css +1 -1
  128. package/dist/provider/MarsunCoreProvider.d.ts +20 -0
  129. package/dist/provider/context.d.ts +24 -0
  130. package/dist/provider/index.d.ts +3 -0
  131. package/dist/styles/global.css +1 -0
  132. package/dist/theme/constants.d.ts +12 -0
  133. package/dist/theme/theme.d.ts +11 -0
  134. package/dist/utils/format.d.ts +2 -0
  135. package/dist/utils/resolveMaybeFn.d.ts +11 -0
  136. package/package.json +9 -4
package/README.md CHANGED
@@ -80,19 +80,17 @@ npm run typecheck
80
80
 
81
81
  ### 发布版本(npm)
82
82
 
83
- 包名为 **`@hkyhy/marsun-components-core`**(npm scope 与 GitHub 发布账号 `hkyhy` 对齐;若需 `@marsun` 须先在 npm 创建该组织)。
83
+ 包名为 **`@hkyhy/marsun-components-core`**(npm scope 与 GitHub 发布账号 `hkyhy` 对齐)。
84
84
 
85
85
  1. 在 GitHub 仓库 **Settings → Secrets → Actions** 配置 `HKYHY_PACKAGE_PUBLISH`(npm Automation Token,对 `@hkyhy` 有 publish 权限)
86
- 2. 更新 `package.json` 的 `version`,提交后打 tag 并推送:
86
+ 2. **推送 `main` 即自动发布**:`.github/workflows/release.yml` 会 patch 版本号、提交 `chore(release): v* `、打 tag 并 `npm publish`(`chore(release)` 提交本身不会再次触发,避免循环)
87
+ 3. 日常只需正常开发提交并 push:
87
88
 
88
89
  ```bash
89
- npm version patch # 或 minor / major
90
- git push origin main --tags
90
+ git push origin main
91
91
  ```
92
92
 
93
- 推送 `v*` tag 后 `.github/workflows/publish.yml` 自动执行 `npm publish`(仅发布 `dist/`,不含 dev showcase)。
94
-
95
- 也可在 Actions 中手动运行 **Publish npm**,填写已有 tag(如 `v0.1.2`)。
93
+ 也可在 Actions 中手动运行 **Publish npm**,填写已有 tag 重新发布。
96
94
 
97
95
  ## 后续接入 maoyang
98
96
 
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ export interface AgentHubAccessGuardProps {
3
+ mode: 'admin-only' | 'chat-manage';
4
+ /** 是否管理员 */
5
+ isAdmin?: boolean;
6
+ /** 无权限时重定向路径 */
7
+ redirectTo?: string;
8
+ children: React.ReactNode;
9
+ }
10
+ declare const AgentHubAccessGuard: React.FC<AgentHubAccessGuardProps>;
11
+ export default AgentHubAccessGuard;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface AgentHubIndexRedirectProps {
3
+ isAdmin?: boolean;
4
+ adminPath?: string;
5
+ userPath?: string;
6
+ }
7
+ declare const AgentHubIndexRedirect: React.FC<AgentHubIndexRedirectProps>;
8
+ export default AgentHubIndexRedirect;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface ChatCreateButtonProps {
3
+ onClick?: () => void;
4
+ }
5
+ declare const CreateButton: React.FC<ChatCreateButtonProps>;
6
+ export default CreateButton;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface ChatManageActionButtonsProps {
3
+ onCreateClick: () => void;
4
+ }
5
+ declare const ManageActionButtons: React.FC<ChatManageActionButtonsProps>;
6
+ export default ManageActionButtons;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface SessionActionButtonsProps {
3
+ streaming?: boolean;
4
+ clearDisabled?: boolean;
5
+ onClearConversation: () => void;
6
+ }
7
+ declare const SessionActionButtons: React.FC<SessionActionButtonsProps>;
8
+ export default SessionActionButtons;
@@ -0,0 +1,11 @@
1
+ /** Action handlers 由消费方注入 API 回调;core 仅导出类型占位 */
2
+ export type ChatActionHandlers = {
3
+ onDelete?: (id: string) => Promise<void>;
4
+ onCreate?: () => void;
5
+ onEdit?: (id: string) => void;
6
+ };
7
+ export type KnowledgeBaseActionHandlers = {
8
+ onDelete?: (id: string) => Promise<void>;
9
+ onCreate?: () => void;
10
+ onUpload?: (datasetId: string) => void;
11
+ };
@@ -0,0 +1,7 @@
1
+ export { default as ChatCreateButton } from './CreateButton';
2
+ export type { ChatCreateButtonProps } from './CreateButton';
3
+ export * from './handlers';
4
+ export { default as ChatManageActionButtons } from './ManageActionButtons';
5
+ export type { ChatManageActionButtonsProps } from './ManageActionButtons';
6
+ export { default as SessionActionButtons } from './SessionActionButtons';
7
+ export type { SessionActionButtonsProps } from './SessionActionButtons';
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ export interface ChatInputProps {
3
+ value: string;
4
+ loading: boolean;
5
+ onChange: (v: string) => void;
6
+ onSend: () => void;
7
+ onStop?: () => void;
8
+ placeholder?: string;
9
+ }
10
+ declare const ChatInput: React.FC<ChatInputProps>;
11
+ export default ChatInput;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface CitationContentProps {
3
+ content: string;
4
+ }
5
+ declare const CitationContent: React.FC<CitationContentProps>;
6
+ export default CitationContent;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export interface CitationInlineBadgeProps {
3
+ number: number;
4
+ onClick?: () => void;
5
+ }
6
+ declare const CitationInlineBadge: React.FC<CitationInlineBadgeProps>;
7
+ export default CitationInlineBadge;
@@ -0,0 +1,12 @@
1
+ import { Citation } from '../../../types';
2
+ import { default as React } from 'react';
3
+ export interface CitationMarkdownContentProps {
4
+ content: string;
5
+ citations: Citation[];
6
+ citationSourceContent: string;
7
+ onCitationClick?: (citations: Citation[], index?: number) => void;
8
+ className?: string;
9
+ deferMermaid?: boolean;
10
+ }
11
+ declare const CitationMarkdownContent: React.FC<CitationMarkdownContentProps>;
12
+ export default CitationMarkdownContent;
@@ -0,0 +1,9 @@
1
+ import { Citation } from '../../../types';
2
+ import { default as React } from 'react';
3
+ export interface CitationPanelProps {
4
+ citations: Citation[];
5
+ highlightedIndex?: number;
6
+ onClose?: () => void;
7
+ }
8
+ declare const CitationPanel: React.FC<CitationPanelProps>;
9
+ export default CitationPanel;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export interface MermaidBlockProps {
3
+ chart: string;
4
+ enabled?: boolean;
5
+ }
6
+ declare const MermaidBlock: React.FC<MermaidBlockProps>;
7
+ export default MermaidBlock;
@@ -0,0 +1,33 @@
1
+ import { default as React } from 'react';
2
+ import { MessageEditPopoverProps } from '../MessageEditPopover';
3
+ export type MessageActionKey = 'edit' | 'copy' | 'resend' | 'like' | 'dislike';
4
+ export interface MessageActionItem {
5
+ key: MessageActionKey;
6
+ label: string;
7
+ icon: React.ReactNode;
8
+ onClick: () => void;
9
+ hidden?: boolean;
10
+ disabled?: boolean;
11
+ active?: boolean;
12
+ }
13
+ export interface MessageActionsProps {
14
+ items: MessageActionItem[];
15
+ align?: 'left' | 'right';
16
+ editPopover?: Omit<MessageEditPopoverProps, 'children'>;
17
+ actionsVisible?: boolean;
18
+ }
19
+ declare const MessageActions: React.FC<MessageActionsProps>;
20
+ export declare const createUserMessageActions: (options: {
21
+ onEdit?: () => void;
22
+ onCopy: () => void;
23
+ onResend?: () => void;
24
+ editDisabled?: boolean;
25
+ }) => MessageActionItem[];
26
+ export declare const createAssistantMessageActions: (options: {
27
+ onCopy: () => void;
28
+ onLike?: () => void;
29
+ onDislike?: () => void;
30
+ thumbup?: boolean | null;
31
+ feedbackDisabled?: boolean;
32
+ }) => MessageActionItem[];
33
+ export default MessageActions;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ export interface MessageEditPopoverProps {
3
+ open: boolean;
4
+ value: string;
5
+ originalContent: string;
6
+ onOpenChange: (open: boolean) => void;
7
+ onChange: (value: string) => void;
8
+ onConfirm: () => void;
9
+ onCancel: () => void;
10
+ children: React.ReactNode;
11
+ }
12
+ declare const MessageEditPopover: React.FC<MessageEditPopoverProps>;
13
+ export default MessageEditPopover;
@@ -0,0 +1,14 @@
1
+ import { ChatMessage, Citation } from '../../../types';
2
+ import { default as React } from 'react';
3
+ export interface MessageItemProps {
4
+ message: ChatMessage;
5
+ onCitationClick?: (citations: Citation[], index?: number) => void;
6
+ onTypingChange?: (typing: boolean) => void;
7
+ onEditMessage?: (messageId: string, content: string) => void;
8
+ onResendMessage?: (content: string) => void;
9
+ onMessageFeedback?: (messageId: string, thumbup: boolean) => void | Promise<void>;
10
+ editDisabled?: boolean;
11
+ feedbackDisabled?: boolean;
12
+ }
13
+ declare const MessageItem: React.FC<MessageItemProps>;
14
+ export default MessageItem;
@@ -0,0 +1,13 @@
1
+ import { Citation } from '../../../types';
2
+ import { default as React } from 'react';
3
+ export interface ThinkingSectionProps {
4
+ thinking: string;
5
+ isThinking?: boolean;
6
+ isTyping?: boolean;
7
+ citations?: Citation[];
8
+ citationSourceContent?: string;
9
+ onCitationClick?: (citations: Citation[], index?: number) => void;
10
+ deferMermaid?: boolean;
11
+ }
12
+ declare const ThinkingSection: React.FC<ThinkingSectionProps>;
13
+ export default ThinkingSection;
@@ -0,0 +1,12 @@
1
+ export { default as CitationMarkdownContent } from './CitationMarkdownContent';
2
+ export type { CitationMarkdownContentProps } from './CitationMarkdownContent';
3
+ export { default as ChatInput } from './ChatInput';
4
+ export type { ChatInputProps } from './ChatInput';
5
+ export { default as CitationPanel } from './CitationPanel';
6
+ export type { CitationPanelProps } from './CitationPanel';
7
+ export { default as MessageEditPopover } from './MessageEditPopover';
8
+ export type { MessageEditPopoverProps } from './MessageEditPopover';
9
+ export { default as MessageItem } from './MessageItem';
10
+ export type { MessageItemProps } from './MessageItem';
11
+ export { default as MessageActions } from './MessageActions';
12
+ export type { MessageActionsProps, MessageActionItem } from './MessageActions';
@@ -0,0 +1,16 @@
1
+ import { Dataset } from '../../types';
2
+ import { FormInstance } from 'antd';
3
+ import { default as React } from 'react';
4
+ export interface ChatAssistantFormProps {
5
+ form: FormInstance;
6
+ datasets: Dataset[];
7
+ initialValues?: {
8
+ name?: string;
9
+ description?: string;
10
+ dataset_ids?: string[];
11
+ prologue?: string;
12
+ empty_response?: string;
13
+ };
14
+ }
15
+ declare const ChatAssistantForm: React.FC<ChatAssistantFormProps>;
16
+ export default ChatAssistantForm;
@@ -0,0 +1,2 @@
1
+ export { default as ChatAssistantForm } from './Form';
2
+ export type { ChatAssistantFormProps } from './Form';
@@ -0,0 +1,11 @@
1
+ import { ChatAssistant, Dataset } from '../../../types';
2
+ import { default as React } from 'react';
3
+ export interface ChatCardProps {
4
+ chat: ChatAssistant;
5
+ datasets: Dataset[];
6
+ onStartChat: (chat: ChatAssistant) => void;
7
+ onEdit: (chat: ChatAssistant) => void;
8
+ onDelete: (chat: ChatAssistant) => void;
9
+ }
10
+ declare const ChatCard: React.FC<ChatCardProps>;
11
+ export default ChatCard;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export interface ChatFilterBarProps {
3
+ keyword: string;
4
+ onKeywordChange: (v: string) => void;
5
+ }
6
+ declare const ChatFilterBar: React.FC<ChatFilterBarProps>;
7
+ export default ChatFilterBar;
@@ -0,0 +1,15 @@
1
+ import { ChatSession } from '../../../types';
2
+ import { default as React } from 'react';
3
+ export interface SessionSidebarProps {
4
+ title: string;
5
+ sessions: ChatSession[];
6
+ activeSessionId?: string;
7
+ loading?: boolean;
8
+ disabled?: boolean;
9
+ onSelect: (sessionId: string) => void;
10
+ onCreateSession: () => void;
11
+ onClearSession: (sessionId: string) => void;
12
+ onDeleteSession: (sessionId: string) => void;
13
+ }
14
+ declare const SessionSidebar: React.FC<SessionSidebarProps>;
15
+ export default SessionSidebar;
@@ -0,0 +1,6 @@
1
+ export { default as ChatCard } from './ChatCard';
2
+ export type { ChatCardProps } from './ChatCard';
3
+ export { default as ChatFilterBar } from './FilterBar';
4
+ export type { ChatFilterBarProps } from './FilterBar';
5
+ export { default as SessionSidebar } from './SessionSidebar';
6
+ export type { SessionSidebarProps } from './SessionSidebar';
@@ -0,0 +1,12 @@
1
+ import { ChatAssistant, Dataset } from '../../types';
2
+ import { default as React } from 'react';
3
+ export interface ChatFormModalProps {
4
+ open: boolean;
5
+ record?: ChatAssistant | null;
6
+ datasets: Dataset[];
7
+ onSubmit: (values: Record<string, unknown>, record?: ChatAssistant | null) => Promise<void>;
8
+ onSuccess: () => void;
9
+ onCancel: () => void;
10
+ }
11
+ declare const ChatFormModal: React.FC<ChatFormModalProps>;
12
+ export default ChatFormModal;
@@ -0,0 +1,2 @@
1
+ export { default as ChatFormModal } from './FormModal';
2
+ export type { ChatFormModalProps } from './FormModal';
@@ -0,0 +1 @@
1
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ import { ChatAssistant, ChatMessage, ChatSession, Citation, SSEChunk } from '../../types';
2
+ export type { ChatAssistant, ChatMessage, ChatSession, Citation, SSEChunk };
@@ -0,0 +1,5 @@
1
+ export { useAutoScrollToBottom } from './useAutoScrollToBottom';
2
+ export { useChat } from './useChat';
3
+ export { useChatSessions } from './useChatSessions';
4
+ export { useSSECompletion } from './useSSECompletion';
5
+ export { useTypewriter } from './useTypewriter';
@@ -0,0 +1,21 @@
1
+ import { RefObject } from 'react';
2
+ interface UseAutoScrollToBottomOptions {
3
+ /** When true, always scroll regardless of current scroll position */
4
+ force?: boolean;
5
+ /** Pixel threshold to treat the viewport as "at bottom" */
6
+ threshold?: number;
7
+ /** Re-run scroll when this value changes (e.g. messages) */
8
+ trigger?: unknown;
9
+ /** Disable observers when there is nothing to scroll */
10
+ enabled?: boolean;
11
+ }
12
+ /**
13
+ * Keeps a scroll container pinned to the bottom while messages grow,
14
+ * including typewriter-driven height changes that do not update React state.
15
+ */
16
+ export declare function useAutoScrollToBottom(containerRef: RefObject<HTMLElement | null>, contentRef: RefObject<HTMLElement | null>, options?: UseAutoScrollToBottomOptions): {
17
+ scrollToBottom: (behavior?: ScrollBehavior) => void;
18
+ stickToBottom: () => void;
19
+ handleScroll: () => void;
20
+ };
21
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ChatAssistant, Dataset } from '../../types';
2
+ export type UseChatOptions = {
3
+ listUrl?: string;
4
+ datasetsUrl?: string;
5
+ transformList?: (raw: unknown) => ChatAssistant[];
6
+ transformDatasets?: (raw: unknown) => Dataset[];
7
+ /** 删除助手 fetch URL 模板,{id} 占位 */
8
+ deleteUrl?: string;
9
+ onDeleteSuccess?: () => void;
10
+ };
11
+ export declare const useChat: (options?: UseChatOptions) => {
12
+ data: ChatAssistant[];
13
+ loading: boolean;
14
+ datasets: Dataset[];
15
+ keyword: string;
16
+ setKeyword: import('react').Dispatch<import('react').SetStateAction<string>>;
17
+ fetchData: () => void;
18
+ deleteChat: (id: string) => Promise<void>;
19
+ };
@@ -0,0 +1,20 @@
1
+ import { ChatMessage, ChatSession } from '../../types';
2
+ export type UseChatSessionsOptions = {
3
+ chatId?: string;
4
+ userId?: string;
5
+ listUrl?: string;
6
+ detailUrl?: string;
7
+ transformList?: (raw: unknown) => ChatSession[];
8
+ transformDetail?: (raw: unknown) => ChatSession | null;
9
+ };
10
+ export declare const useChatSessions: (options?: UseChatSessionsOptions) => {
11
+ sessions: ChatSession[];
12
+ sessionId: string | undefined;
13
+ setSessionId: import('react').Dispatch<import('react').SetStateAction<string | undefined>>;
14
+ sessionsLoading: boolean;
15
+ sessionLoading: boolean;
16
+ messages: ChatMessage[];
17
+ setMessages: import('react').Dispatch<import('react').SetStateAction<ChatMessage[]>>;
18
+ loadSessions: () => Promise<void>;
19
+ userId: string | undefined;
20
+ };
@@ -0,0 +1,13 @@
1
+ import { Citation } from '../../types';
2
+ export type SSECompletionOptions = {
3
+ completionUrl: string;
4
+ getAuthHeaders?: () => Record<string, string>;
5
+ };
6
+ export declare const useSSECompletion: ({ completionUrl, getAuthHeaders }: SSECompletionOptions) => {
7
+ send: (messages: {
8
+ role: "user" | "assistant";
9
+ content: string;
10
+ }[], onChunk: (text: string) => void, onCitations: (citations: Citation[]) => void, onDone: () => void, onError: (err: string) => void, sessionId?: string) => Promise<void>;
11
+ streaming: boolean;
12
+ abort: () => void;
13
+ };
@@ -0,0 +1,16 @@
1
+ interface UseTypewriterOptions {
2
+ /** Fixed reveal rate in characters per second. Default: 60 */
3
+ charsPerSecond?: number;
4
+ }
5
+ /**
6
+ * Smoothly reveals streaming text character-by-character using requestAnimationFrame.
7
+ *
8
+ * Live streaming messages animate from empty; once the stream ends, any remaining
9
+ * characters continue at the same rate until fully revealed. Historical messages
10
+ * with `streaming: false` that were never streamed show in full immediately.
11
+ */
12
+ export declare function useTypewriter(content: string, streaming: boolean, options?: UseTypewriterOptions): {
13
+ displayed: string;
14
+ isTyping: boolean;
15
+ };
16
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './Action';
2
+ export * from './constants';
3
+ export * from './Detail';
4
+ export * from './Form';
5
+ export * from './hooks';
6
+ export * from './List';
7
+ export * from './Modal';
@@ -0,0 +1,37 @@
1
+ import { Citation } from '../../types';
2
+ export declare const CITATION_LINK_PREFIX = "#cite-";
3
+ /** 从正文中提取所有引用 ID(支持 [ID:n]、(ID:n)、ID:n 等格式) */
4
+ export declare function extractCitationIdsFromContent(content: string): number[];
5
+ /** 正文中实际引用到的来源数量(去重后的 citations 下标) */
6
+ export declare function countUniqueCitedSources(content: string, citationsLength: number): number;
7
+ /** 判断 [ID:n] 是 0-based 还是 1-based(RAGFlow 用 0-based,部分 mock/旧数据用 1-based) */
8
+ export declare function detectCitationIdBase(content: string, citationsLength: number): 'zero' | 'one';
9
+ /** 将正文中的引用标记转为可自定义渲染的 markdown 链接 */
10
+ export declare function injectCitationMarkdownLinks(content: string): string;
11
+ export declare function parseCitationLinkHref(href?: string): number | null;
12
+ /** [ID:n] 映射到 citations 数组下标 */
13
+ export declare function citationIdToIndex(id: number, citationsLength: number, content?: string): number;
14
+ /** 与侧栏 panel 一致的 1-based 展示序号 */
15
+ export declare function citationDisplayNumber(citationId: number, citationsLength: number, content?: string): number;
16
+ /** 去掉 RAG chunk 顶部的 YAML frontmatter */
17
+ export declare function stripCitationFrontmatter(content: string): string;
18
+ /** 文档路径取文件名(去扩展名) */
19
+ export declare function formatCitationDocBasename(docName?: string): string | undefined;
20
+ /** 将 RAGFlow chunk 字段归一化为 Citation */
21
+ export declare function normalizeCitation(raw: Record<string, unknown>): Citation;
22
+ /** 从 chunk 正文提取展示标题 */
23
+ export declare function extractCitationTitle(content: string, fallback: string): string;
24
+ /** 引用侧栏标题:展示 document_name */
25
+ export declare function resolveCitationTitle(citation: Citation, index: number): string;
26
+ /** 格式化 chunk positions(RAGFlow: [页码, left, right, top, bottom]) */
27
+ export declare function formatCitationPositions(positions?: unknown): string | undefined;
28
+ /** 引用侧栏元信息:positions · 匹配度 */
29
+ export declare function formatCitationMeta(citation: Citation): string;
30
+ export interface PreparedCitationContent {
31
+ body: string;
32
+ isHtml: boolean;
33
+ }
34
+ /** 预处理引用正文,供 Markdown / HTML 分支渲染 */
35
+ export declare function prepareCitationContent(content: string): PreparedCitationContent;
36
+ /** 引用 HTML 仅做基础清理(内容来自可信 RAG 知识库) */
37
+ export declare function sanitizeCitationHtml(html: string): string;
@@ -0,0 +1,5 @@
1
+ export { CITATION_LINK_PREFIX, citationDisplayNumber, citationIdToIndex, countUniqueCitedSources, detectCitationIdBase, extractCitationIdsFromContent, extractCitationTitle, formatCitationDocBasename, formatCitationMeta, formatCitationPositions, injectCitationMarkdownLinks, normalizeCitation, parseCitationLinkHref, prepareCitationContent, resolveCitationTitle, sanitizeCitationHtml, stripCitationFrontmatter, } from './citationContent';
2
+ export { hasCitationMarkers, normalizeAssistantMarkdown, normalizeDisplayText, parseAssistantContent, } from './messageContent';
3
+ export type { ParsedAssistantContent } from './messageContent';
4
+ export { sanitizeMermaidChart, stripProseFromMermaid } from './sanitizeMermaidChart';
5
+ export { extractCitations, formatSessionTime, getSessionDisplayName, isWelcomeOnlyMessages, parseSessionMessages, toDisplayMessages, } from './sessionMessages';
@@ -0,0 +1,18 @@
1
+ export interface ParsedAssistantContent {
2
+ /** Reasoning text extracted from think blocks */
3
+ thinking: string;
4
+ /** User-facing answer (outside think blocks) */
5
+ answer: string;
6
+ /** Stream still inside an unclosed think block */
7
+ isThinking: boolean;
8
+ }
9
+ /** Collapse excessive blank lines and trim trailing whitespace for display */
10
+ export declare function normalizeDisplayText(text: string): string;
11
+ /** Normalize assistant markdown from persisted sessions (fences, mermaid blocks). */
12
+ export declare function normalizeAssistantMarkdown(content: string): string;
13
+ export declare function hasCitationMarkers(content: string): boolean;
14
+ /**
15
+ * Split assistant output into hidden reasoning and visible answer.
16
+ * RAGFlow / reasoning models may wrap chain-of-thought in think tags.
17
+ */
18
+ export declare function parseAssistantContent(content: string, streaming?: boolean): ParsedAssistantContent;
@@ -0,0 +1,7 @@
1
+ /** Remove non-Mermaid prose lines (e.g. 风格说明) that LLMs append inside code blocks. */
2
+ export declare function stripProseFromMermaid(chart: string): string;
3
+ /**
4
+ * Fix common AI-generated Mermaid syntax issues before rendering.
5
+ * e.g. C[梳理(生條)] → C["梳理(生條)"]
6
+ */
7
+ export declare function sanitizeMermaidChart(chart: string): string;
@@ -0,0 +1,21 @@
1
+ import { ChatMessage, ChatSession, Citation, MessageRole } from '../../types';
2
+ interface RawSessionMessage {
3
+ id?: string;
4
+ role: MessageRole;
5
+ content?: unknown;
6
+ reference?: SessionReference;
7
+ created_at?: number;
8
+ create_time?: number;
9
+ thumbup?: boolean;
10
+ }
11
+ type SessionReference = {
12
+ chunks?: Citation[] | Record<string, Citation>;
13
+ } | Citation[] | Record<string, unknown> | null;
14
+ export declare const formatSessionTime: (value?: string | number) => string;
15
+ export declare const normalizeMessageContent: (content: unknown) => string;
16
+ export declare const getSessionDisplayName: (session: ChatSession) => string;
17
+ export declare const isWelcomeOnlyMessages: (messages: ChatMessage[], prologue?: string) => boolean;
18
+ export declare const extractCitations: (reference?: SessionReference) => Citation[] | undefined;
19
+ export declare const parseSessionMessages: (rawMessages?: RawSessionMessage[], references?: SessionReference[]) => ChatMessage[];
20
+ export declare const toDisplayMessages: (messages: ChatMessage[], prologue?: string) => ChatMessage[];
21
+ export {};
@@ -0,0 +1,14 @@
1
+ export interface AnimateScrollOptions {
2
+ minDuration?: number;
3
+ maxDuration?: number;
4
+ msPerPixel?: number;
5
+ }
6
+ /**
7
+ * Smoothly scroll an element with a custom ease-out curve (softer than native smooth).
8
+ */
9
+ export declare const animateScrollTo: (element: HTMLElement, targetTop: number, options?: AnimateScrollOptions) => (() => void);
10
+ export declare const getScrollBottom: (element: HTMLElement) => number;
11
+ /**
12
+ * Session switch: reset to top, then ease to bottom; optional soft correction after layout shifts.
13
+ */
14
+ export declare const animateScrollFromTopToBottom: (element: HTMLElement, options?: AnimateScrollOptions) => (() => void);
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface AgentHubSessionAccessGuardProps {
3
+ hasAccess?: boolean;
4
+ redirectTo?: string;
5
+ children: React.ReactNode;
6
+ }
7
+ declare const AgentHubSessionAccessGuard: React.FC<AgentHubSessionAccessGuardProps>;
8
+ export default AgentHubSessionAccessGuard;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface CreateButtonProps {
3
+ onClick?: () => void;
4
+ }
5
+ declare const CreateButton: React.FC<CreateButtonProps>;
6
+ export default CreateButton;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface ManageActionButtonsProps {
3
+ onCreateClick: () => void;
4
+ }
5
+ declare const ManageActionButtons: React.FC<ManageActionButtonsProps>;
6
+ export default ManageActionButtons;
@@ -0,0 +1,5 @@
1
+ export type KnowledgeBaseActionHandlers = {
2
+ onDelete?: (id: string) => Promise<void>;
3
+ onCreate?: () => void;
4
+ onUpload?: (datasetId: string) => void;
5
+ };
@@ -0,0 +1,5 @@
1
+ export { default as CreateButton } from './CreateButton';
2
+ export type { CreateButtonProps } from './CreateButton';
3
+ export { default as ManageActionButtons } from './ManageActionButtons';
4
+ export type { ManageActionButtonsProps } from './ManageActionButtons';
5
+ export * from './handlers';
@@ -0,0 +1,16 @@
1
+ import { KBDocument } from '../../../types';
2
+ import { default as React } from 'react';
3
+ export interface DocumentTableProps {
4
+ datasetId: string;
5
+ data: KBDocument[];
6
+ loading: boolean;
7
+ total: number;
8
+ page: number;
9
+ pageSize: number;
10
+ onPageChange: (page: number, pageSize: number) => void;
11
+ onParse: (doc: KBDocument) => void;
12
+ onStopParse: (doc: KBDocument) => void;
13
+ onDelete: (doc: KBDocument) => void;
14
+ }
15
+ declare const DocumentTable: React.FC<DocumentTableProps>;
16
+ export default DocumentTable;