listpage-next 0.0.168 → 0.0.170

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 (65) hide show
  1. package/dist/demos/demo8.js +42 -21
  2. package/dist/features/ChatClient/components/ChatContent/BubbleList.d.ts +4 -8
  3. package/dist/features/ChatClient/components/ChatContent/BubbleList.js +8 -28
  4. package/dist/features/ChatClient/components/ChatContent/ClientContentBody.d.ts +4 -2
  5. package/dist/features/ChatClient/components/ChatContent/ClientContentBody.js +6 -6
  6. package/dist/features/ChatClient/components/ChatContent/index.d.ts +6 -4
  7. package/dist/features/ChatClient/components/ChatContent/index.js +4 -3
  8. package/dist/features/ChatClient/components/ChatSender/index.js +10 -8
  9. package/dist/features/ChatClient/components/HistoryConversation/index.d.ts +3 -9
  10. package/dist/features/ChatClient/components/HistoryConversation/index.js +20 -73
  11. package/dist/features/ChatClient/components/HistoryConversation/styles.d.ts +0 -5
  12. package/dist/features/ChatClient/components/HistoryConversation/styles.js +17 -45
  13. package/dist/features/ChatClient/components/Logo/index.d.ts +1 -1
  14. package/dist/features/ChatClient/components/Logo/index.js +9 -9
  15. package/dist/features/ChatClient/index.d.ts +1 -4
  16. package/dist/features/ChatClient/index.js +1 -4
  17. package/dist/features/ChatClient/ui/Bubble/BubbleList.d.ts +13 -0
  18. package/dist/features/ChatClient/ui/Bubble/BubbleList.js +41 -0
  19. package/dist/features/ChatClient/{components → ui}/Bubble/index.d.ts +2 -0
  20. package/dist/features/ChatClient/{components → ui}/Bubble/index.js +2 -0
  21. package/dist/features/ChatClient/ui/ConversationList/index.d.ts +21 -0
  22. package/dist/features/ChatClient/ui/ConversationList/index.js +85 -0
  23. package/dist/features/ChatClient/ui/ConversationList/styles.d.ts +5 -0
  24. package/dist/features/ChatClient/ui/ConversationList/styles.js +30 -0
  25. package/dist/features/ChatClient/ui/EditorContent/constants.d.ts +3 -0
  26. package/dist/features/ChatClient/ui/EditorContent/constants.js +4 -0
  27. package/dist/features/ChatClient/ui/EditorContent/editor.d.ts +13 -0
  28. package/dist/features/ChatClient/ui/EditorContent/editor.js +97 -0
  29. package/dist/features/ChatClient/ui/EditorContent/extensions/inputSlot/component.d.ts +2 -0
  30. package/dist/features/ChatClient/ui/EditorContent/extensions/inputSlot/component.js +44 -0
  31. package/dist/features/ChatClient/ui/EditorContent/extensions/inputSlot/index.d.ts +4 -0
  32. package/dist/features/ChatClient/ui/EditorContent/extensions/inputSlot/index.js +54 -0
  33. package/dist/features/ChatClient/ui/EditorContent/extensions/plugins.d.ts +24 -0
  34. package/dist/features/ChatClient/ui/EditorContent/extensions/plugins.js +331 -0
  35. package/dist/features/ChatClient/ui/EditorContent/extensions/skillSlot/index.d.ts +3 -0
  36. package/dist/features/ChatClient/ui/EditorContent/extensions/skillSlot/index.js +83 -0
  37. package/dist/features/ChatClient/ui/EditorContent/index.d.ts +2 -0
  38. package/dist/features/ChatClient/ui/EditorContent/index.js +2 -0
  39. package/dist/features/ChatClient/ui/EditorContent/utils.d.ts +7 -0
  40. package/dist/features/ChatClient/ui/EditorContent/utils.js +10 -0
  41. package/dist/features/ChatClient/ui/index.d.ts +5 -0
  42. package/dist/features/ChatClient/ui/index.js +5 -0
  43. package/dist/features/ChatClient/utils/parseSse.d.ts +1 -1
  44. package/dist/features/ChatClient/utils/parseSse.js +1 -1
  45. package/package.json +11 -2
  46. package/dist/features/ChatClient/{components → ui}/Bubble/Bubble.d.ts +0 -0
  47. package/dist/features/ChatClient/{components → ui}/Bubble/Bubble.js +0 -0
  48. package/dist/features/ChatClient/{components → ui}/Bubble/LinkCard.d.ts +0 -0
  49. package/dist/features/ChatClient/{components → ui}/Bubble/LinkCard.js +0 -0
  50. package/dist/features/ChatClient/{components → ui}/Bubble/Markdown.d.ts +0 -0
  51. package/dist/features/ChatClient/{components → ui}/Bubble/Markdown.js +0 -0
  52. package/dist/features/ChatClient/{components → ui}/Bubble/Reasoning.d.ts +0 -0
  53. package/dist/features/ChatClient/{components → ui}/Bubble/Reasoning.js +0 -0
  54. package/dist/features/ChatClient/{components → ui}/Bubble/ReferenceList.d.ts +0 -0
  55. package/dist/features/ChatClient/{components → ui}/Bubble/ReferenceList.js +0 -0
  56. package/dist/features/ChatClient/{components → ui}/Bubble/SuggestMessageList.d.ts +0 -0
  57. package/dist/features/ChatClient/{components → ui}/Bubble/SuggestMessageList.js +0 -0
  58. package/dist/features/ChatClient/{components → ui}/ChatDialog/index.d.ts +0 -0
  59. package/dist/features/ChatClient/{components → ui}/ChatDialog/index.js +1 -1
  60. /package/dist/features/ChatClient/{components → ui}/ChatDialog/styles.d.ts +0 -0
  61. /package/dist/features/ChatClient/{components → ui}/ChatDialog/styles.js +0 -0
  62. /package/dist/features/ChatClient/{components → ui}/ChatDialog/useExtra.d.ts +0 -0
  63. /package/dist/features/ChatClient/{components → ui}/ChatDialog/useExtra.js +0 -0
  64. /package/dist/features/ChatClient/{components → ui}/ChatSplitter/index.d.ts +0 -0
  65. /package/dist/features/ChatClient/{components → ui}/ChatSplitter/index.js +0 -0
@@ -1,31 +1,52 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import "../features/ChatClient/index.js";
3
- import { SimplifyChatPage } from "../features/ChatClient/components/ChatPage/SimplifyChatPage.js";
4
- const Demo8 = ()=>/*#__PURE__*/ jsx(SimplifyChatPage, {
5
- style: {
6
- height: '100%'
7
- },
8
- initialMessages: [
2
+ import { ChatPage, ClientContent } from "../features/ChatClient/index.js";
3
+ import "../features/ChatClient/components/ChatPage/SimplifyChatPage.js";
4
+ const request = {
5
+ chat: async ()=>{},
6
+ getConversations: async ()=>({
7
+ list: [
8
+ {
9
+ id: '11',
10
+ title: 'xxxxxxx'
11
+ }
12
+ ]
13
+ }),
14
+ getMessages: ()=>[
9
15
  {
10
16
  role: 'user',
11
- content: '你是谁?'
17
+ content: 'xxxx'
12
18
  },
13
19
  {
14
20
  role: 'assistant',
15
- content: '我是一个AI'
16
- }
17
- ],
18
- request: {
19
- chat: function(info, callbacks) {
20
- throw new Error('Function not implemented.');
21
+ content: 'xxxx'
21
22
  }
23
+ ]
24
+ };
25
+ const Demo8 = ()=>/*#__PURE__*/ jsx("div", {
26
+ style: {
27
+ width: 1000
22
28
  },
23
- render: {
24
- renderMessage: function(message) {
25
- return /*#__PURE__*/ jsx("div", {
26
- children: message.info.content
27
- });
28
- }
29
- }
29
+ children: /*#__PURE__*/ jsx(ChatPage, {
30
+ request: request,
31
+ render: {
32
+ renderMessage (message) {
33
+ return /*#__PURE__*/ jsx("div", {
34
+ children: message.info.content
35
+ });
36
+ }
37
+ },
38
+ action: {
39
+ onClickConversation: void 0,
40
+ onClickNewConversation: void 0,
41
+ onRenameConversation: void 0,
42
+ onDeleteConversation: void 0
43
+ },
44
+ children: /*#__PURE__*/ jsx(ClientContent, {
45
+ style: {
46
+ height: '100%'
47
+ },
48
+ title: "搜索海量信息,生成研究报告"
49
+ })
50
+ })
30
51
  });
31
52
  export { Demo8 };
@@ -1,8 +1,4 @@
1
- import { CSSProperties } from 'react';
2
- export interface BubbleListProps {
3
- styles?: {
4
- bottomPlaceholder?: CSSProperties;
5
- content?: CSSProperties;
6
- };
7
- }
8
- export declare const BubbleList: (props: BubbleListProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { BaseMessageInfo } from '../../context';
2
+ import { BubbleListProps } from '../../ui';
3
+ export type ChatBubbleListProps<MessageInfo extends BaseMessageInfo = any> = Pick<BubbleListProps<MessageInfo>, 'styles'>;
4
+ export declare const ChatBubbleList: (props: ChatBubbleListProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { useImperativeHandle, useRef } from "react";
3
- import { styled } from "styled-components";
4
3
  import { useChatClientContext, useMessageContext } from "../../context/index.js";
5
- const BubbleList = (props)=>{
4
+ import { BubbleList } from "../../ui/index.js";
5
+ const ChatBubbleList = (props)=>{
6
6
  const { styles } = props;
7
7
  const bottomRef = useRef(null);
8
8
  const containerRef = useRef(null);
@@ -25,30 +25,10 @@ const BubbleList = (props)=>{
25
25
  }), [
26
26
  scrollToBottom
27
27
  ]);
28
- return /*#__PURE__*/ jsxs(ContentContainer, {
29
- ref: containerRef,
30
- children: [
31
- /*#__PURE__*/ jsx("div", {
32
- style: styles?.content,
33
- children: (ctx.messages ?? []).map((msg)=>render.renderMessage(msg, ctx))
34
- }),
35
- /*#__PURE__*/ jsx("div", {
36
- ref: bottomRef,
37
- style: styles?.bottomPlaceholder ?? {
38
- height: 60
39
- }
40
- })
41
- ]
28
+ return /*#__PURE__*/ jsx(BubbleList, {
29
+ styles: styles,
30
+ messages: ctx.messages,
31
+ messageRender: (message)=>render.renderMessage(message, ctx)
42
32
  });
43
33
  };
44
- const ContentContainer = styled.div`
45
- min-height: 100px;
46
- flex-grow: 1;
47
- flex-shrink: 1;
48
- overflow: auto;
49
- position: relative;
50
- width: 100%;
51
- box-sizing: border-box;
52
- padding: 0 calc((100% - 800px) / 2);
53
- `;
54
- export { BubbleList };
34
+ export { ChatBubbleList };
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * 极简版对话内容
3
3
  */
4
- import { BubbleListProps } from './BubbleList';
4
+ import { ChatBubbleListProps } from './BubbleList';
5
5
  import { ChatSenderProps } from '../ChatSender';
6
+ import { ReactNode } from 'react';
6
7
  export interface ClientContentBodyProps {
7
8
  senderProps?: ChatSenderProps;
8
- bubbleProps?: BubbleListProps;
9
+ bubbleProps?: ChatBubbleListProps;
9
10
  style?: React.CSSProperties;
11
+ sender?: ReactNode;
10
12
  }
11
13
  export declare const ClientContentBody: (props: ClientContentBodyProps) => import("react/jsx-runtime").JSX.Element;
12
14
  export declare const SimplifyClientContentBody: (props: ClientContentBodyProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,20 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { BubbleList } from "./BubbleList.js";
2
+ import { ChatBubbleList } from "./BubbleList.js";
3
3
  import { ChatSender } from "../ChatSender/index.js";
4
4
  import { styled } from "styled-components";
5
5
  const ClientContentBody = (props)=>{
6
- const { senderProps, bubbleProps, style } = props;
6
+ const { senderProps, bubbleProps, style, sender } = props;
7
7
  return /*#__PURE__*/ jsxs(Content, {
8
8
  style: style,
9
9
  children: [
10
- /*#__PURE__*/ jsx(BubbleList, {
10
+ /*#__PURE__*/ jsx(ChatBubbleList, {
11
11
  ...bubbleProps
12
12
  }),
13
- /*#__PURE__*/ jsx(SenderContainer, {
13
+ void 0 === sender ? /*#__PURE__*/ jsx(SenderContainer, {
14
14
  children: /*#__PURE__*/ jsx(ChatSender, {
15
15
  ...senderProps
16
16
  })
17
- })
17
+ }) : sender
18
18
  ]
19
19
  });
20
20
  };
@@ -23,7 +23,7 @@ const SimplifyClientContentBody = (props)=>{
23
23
  return /*#__PURE__*/ jsxs(Content, {
24
24
  style: style,
25
25
  children: [
26
- /*#__PURE__*/ jsx(BubbleList, {
26
+ /*#__PURE__*/ jsx(ChatBubbleList, {
27
27
  ...bubbleProps
28
28
  }),
29
29
  /*#__PURE__*/ jsx(ChatSender, {
@@ -1,15 +1,17 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
- import { BubbleListProps } from './BubbleList';
3
- import { ChatSenderProps } from '../ChatSender';
2
+ import { ChatBubbleListProps } from './BubbleList';
3
+ import { ClientContentBodyProps } from './ClientContentBody';
4
4
  export interface ClientContentProps {
5
5
  style?: CSSProperties;
6
6
  className?: string;
7
7
  extra?: ReactNode;
8
8
  title?: string;
9
+ header?: ReactNode;
10
+ sender?: ReactNode;
9
11
  onTitleChange?: (title: string) => void;
10
12
  onClickNewConversation?: () => void;
11
13
  loading?: boolean;
12
- senderProps?: ChatSenderProps;
13
- bubbleProps?: BubbleListProps;
14
+ senderProps?: ClientContentBodyProps['senderProps'];
15
+ bubbleProps?: ChatBubbleListProps;
14
16
  }
15
17
  export declare const ClientContent: ({ loading, ...props }: ClientContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,18 +7,19 @@ import { ClientContentHeader } from "./ClientContentHeader.js";
7
7
  import { MessageProvider, useChatClientContext } from "../../context/index.js";
8
8
  import { PageLoading } from "../../../../components/Page/components/Loading/index.js";
9
9
  const ClientContentComponent = (props)=>{
10
- const { extra, style, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
10
+ const { extra, style, header, sender, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
11
11
  return /*#__PURE__*/ jsxs(Container, {
12
12
  style: style,
13
13
  className: className,
14
14
  children: [
15
- /*#__PURE__*/ jsx(ClientContentHeader, {
15
+ void 0 === header ? /*#__PURE__*/ jsx(ClientContentHeader, {
16
16
  defaultTitle: title,
17
17
  onTitleChange: onTitleChange,
18
18
  onClickNewConversation: onClickNewConversation,
19
19
  extra: extra
20
- }),
20
+ }) : header,
21
21
  /*#__PURE__*/ jsx(ClientContentBody, {
22
+ sender: sender,
22
23
  senderProps: senderProps,
23
24
  bubbleProps: bubbleProps
24
25
  })
@@ -1,7 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
2
+ import { useRef, useState } from "react";
3
3
  import { Button, Divider, Input } from "antd";
4
4
  import { ArrowUpOutlined, PauseCircleTwoTone } from "@ant-design/icons";
5
+ import { EditorContent } from "../../ui/index.js";
5
6
  import { useChatClientContext, useMessageContext } from "../../context/index.js";
6
7
  import { ChatInputBottom, ChatInputContent, ChatInputPanel, MiniChatInputContent, MiniChatInputPanel } from "./styles.js";
7
8
  const ChatSender = (props)=>{
@@ -25,10 +26,12 @@ const ChatSender = (props)=>{
25
26
  };
26
27
  const PureChatSender = (props)=>{
27
28
  const { style, className, placeholder, extra, loading, onSubmit, mode = 'textarea' } = props;
28
- const [inputValue, setInputValue] = useState("");
29
+ const ref = useRef(null);
30
+ const [inputValue, setInputValue] = useState('');
29
31
  const handleClick = async ()=>{
30
32
  onSubmit?.(inputValue);
31
- setInputValue("");
33
+ setInputValue('');
34
+ ref.current?.commands.clearContent();
32
35
  };
33
36
  const handleKeyDown = (e)=>{
34
37
  if ('Enter' === e.key && !e.shiftKey) {
@@ -65,12 +68,11 @@ const PureChatSender = (props)=>{
65
68
  className: className,
66
69
  children: [
67
70
  /*#__PURE__*/ jsx(ChatInputContent, {
68
- children: /*#__PURE__*/ jsx(Input.TextArea, {
71
+ children: /*#__PURE__*/ jsx(EditorContent, {
69
72
  placeholder: placeholder,
70
- value: inputValue,
71
- autoSize: false,
72
- onChange: (e)=>setInputValue?.(e.target.value),
73
- onKeyDown: handleKeyDown
73
+ editorRef: ref,
74
+ onChange: (content)=>setInputValue(content),
75
+ onKeyDown: (e)=>handleKeyDown(e)
74
76
  })
75
77
  }),
76
78
  /*#__PURE__*/ jsxs(ChatInputBottom, {
@@ -1,11 +1,5 @@
1
- export interface HistoryConversationProps<T = any> {
1
+ export interface HistoryConversationProps {
2
2
  rowKey?: string;
3
- activeKey?: string;
3
+ defaultActiveKey?: string;
4
4
  }
5
- export declare const HistoryConversation: <T extends ItemData = any>(props: HistoryConversationProps<T>) => import("react/jsx-runtime").JSX.Element;
6
- type ItemData = {
7
- icon?: React.ReactNode;
8
- title: string;
9
- key: string;
10
- };
11
- export {};
5
+ export declare const HistoryConversation: (props: HistoryConversationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,87 +1,34 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
- import { Avatar, Button, Dropdown, Tooltip, Typography } from "antd";
3
+ import { Button, Tooltip } from "antd";
4
4
  import { useHover } from "ahooks";
5
- import { ClockCircleOutlined, MessageOutlined, MoreOutlined } from "@ant-design/icons";
6
- import { InfiniteList } from "../../../../components/InfiniteList/index.js";
5
+ import { ClockCircleOutlined } from "@ant-design/icons";
7
6
  import { useChatClientContext } from "../../context/index.js";
8
- import { HeaderContainer, HeaderTitle, HistoryConversationContainer, ListContainer, ListItemContainer, ListText } from "./styles.js";
7
+ import { ConversationList } from "../../ui/ConversationList/index.js";
8
+ import { HeaderContainer, HeaderTitle, HistoryConversationContainer } from "./styles.js";
9
9
  const HistoryConversation = (props)=>{
10
- const { rowKey = "id", activeKey } = props;
10
+ const { rowKey = 'id', defaultActiveKey } = props;
11
11
  const { showUpdateTitleModal, conversationListRef, action, request } = useChatClientContext();
12
12
  const { onClickConversation, onRenameConversation, onDeleteConversation } = action ?? {};
13
13
  return /*#__PURE__*/ jsxs(HistoryConversationContainer, {
14
14
  children: [
15
15
  /*#__PURE__*/ jsx(Header, {}),
16
- /*#__PURE__*/ jsx(ListContainer, {
17
- children: /*#__PURE__*/ jsx(InfiniteList, {
18
- ref: conversationListRef,
19
- request: request.getConversations,
20
- rowKey: rowKey,
21
- pageSize: 10,
22
- renderItem: (item, index, actions)=>{
23
- const key = item[rowKey];
24
- const items = [
25
- {
26
- key: 'rename',
27
- label: '重命名',
28
- onClick: ()=>{
29
- showUpdateTitleModal(item.title, async (newTitle)=>{
30
- const newItem = {
31
- ...item,
32
- title: newTitle
33
- };
34
- await onRenameConversation?.(key, newItem);
35
- actions.updateItem(key, newItem);
36
- });
37
- }
38
- },
39
- {
40
- key: 'delete',
41
- danger: true,
42
- label: '删除',
43
- onClick: async ()=>{
44
- await onDeleteConversation?.(key, item);
45
- actions.deleteItem(key);
46
- }
47
- }
48
- ];
49
- return /*#__PURE__*/ jsxs(ListItemContainer, {
50
- isHover: activeKey === key ? true : void 0,
51
- onClick: ()=>onClickConversation?.(key, item),
52
- children: [
53
- /*#__PURE__*/ jsx(Avatar, {
54
- size: 20,
55
- icon: item.icon || /*#__PURE__*/ jsx(MessageOutlined, {})
56
- }),
57
- /*#__PURE__*/ jsx(ListText, {
58
- children: /*#__PURE__*/ jsx(Typography.Text, {
59
- ellipsis: {
60
- tooltip: {
61
- title: item.title,
62
- placement: 'right'
63
- }
64
- },
65
- children: item.title
66
- })
67
- }),
68
- /*#__PURE__*/ jsx("div", {
69
- onClick: (e)=>e.stopPropagation(),
70
- children: /*#__PURE__*/ jsx(Dropdown, {
71
- menu: {
72
- items
73
- },
74
- children: /*#__PURE__*/ jsx(Button, {
75
- type: "text",
76
- size: "small",
77
- icon: /*#__PURE__*/ jsx(MoreOutlined, {})
78
- })
79
- })
80
- })
81
- ]
16
+ /*#__PURE__*/ jsx(ConversationList, {
17
+ rowKey: rowKey,
18
+ defaultActiveKey: defaultActiveKey,
19
+ request: request.getConversations,
20
+ ref: conversationListRef,
21
+ onSelectConversation: (data)=>onClickConversation?.(data[rowKey], data),
22
+ onDeleteConversation: (data)=>{
23
+ onDeleteConversation?.(data[rowKey], data);
24
+ },
25
+ onRenameConversation: (data)=>new Promise((resolve)=>{
26
+ showUpdateTitleModal(data.title, async (newTitle)=>{
27
+ data.title = newTitle;
28
+ await onRenameConversation?.(data[rowKey], data);
29
+ resolve(data);
82
30
  });
83
- }
84
- })
31
+ })
85
32
  })
86
33
  ]
87
34
  });
@@ -1,8 +1,3 @@
1
1
  export declare const HistoryConversationContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
2
  export declare const HeaderContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
3
  export declare const HeaderTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
- export declare const ListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
- export declare const ListItemContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
6
- isHover?: boolean;
7
- }>> & string;
8
- export declare const ListText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,52 +1,24 @@
1
1
  import styled_components from "styled-components";
2
2
  const HistoryConversationContainer = styled_components.div`
3
- flex: 1;
4
- display: flex;
5
- flex-direction: column;
3
+ flex: 1;
4
+ display: flex;
5
+ flex-direction: column;
6
6
  `;
7
7
  const HeaderContainer = styled_components.div`
8
- display: flex;
9
- justify-content: space-between;
10
- align-items: center;
11
- padding: 8px 6px;
8
+ display: flex;
9
+ justify-content: space-between;
10
+ align-items: center;
11
+ padding: 8px 6px;
12
12
  `;
13
13
  const HeaderTitle = styled_components.div`
14
- align-items: center;
15
- display: flex;
16
- flex: 1 1;
17
- font-size: 12px;
18
- font-weight: 600;
19
- min-width: 0;
20
- color: #0000004d;
21
- line-height: 20px;
22
- height: 20px;
14
+ align-items: center;
15
+ display: flex;
16
+ flex: 1 1;
17
+ font-size: 12px;
18
+ font-weight: 600;
19
+ min-width: 0;
20
+ color: #0000004d;
21
+ line-height: 20px;
22
+ height: 20px;
23
23
  `;
24
- const ListContainer = styled_components.div`
25
- flex: 1;
26
- overflow: hidden;
27
- padding: 0 2px;
28
- `;
29
- const ListItemContainer = styled_components.div`
30
- display: flex;
31
- align-items: center;
32
- padding: 8px 4px;
33
- border-radius: 8px;
34
- cursor: pointer;
35
- gap: 4px;
36
-
37
- background-color: ${(props)=>props.isHover ? "#0000000a" : "transparent"};
38
-
39
- &:hover {
40
- background-color: #0000000a;
41
- }
42
- `;
43
- const ListText = styled_components.div`
44
- flex: 1;
45
-
46
- overflow: hidden;
47
- text-overflow: ellipsis;
48
- white-space: nowrap;
49
- word-break: break-all;
50
- word-wrap: break-word;
51
- `;
52
- export { HeaderContainer, HeaderTitle, HistoryConversationContainer, ListContainer, ListItemContainer, ListText };
24
+ export { HeaderContainer, HeaderTitle, HistoryConversationContainer };
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { ReactNode } from 'react';
2
2
  export interface LogoProps {
3
3
  icon: ReactNode;
4
4
  title: string;
@@ -9,7 +9,7 @@ const Logo = (props)=>{
9
9
  size: 36,
10
10
  shape: "circle",
11
11
  src: icon,
12
- icon: "AI"
12
+ icon: 'AI'
13
13
  }),
14
14
  /*#__PURE__*/ jsx(LogoTitle, {
15
15
  children: title
@@ -18,15 +18,15 @@ const Logo = (props)=>{
18
18
  });
19
19
  };
20
20
  const LogoContainer = styled.div`
21
- height: 36px;
22
- margin: 12px 0px 0px 0px;
23
- display: flex;
24
- gap: 8px;
25
- align-items: center;
21
+ height: 36px;
22
+ margin: 12px 0px 0px 0px;
23
+ display: flex;
24
+ gap: 8px;
25
+ align-items: center;
26
26
  `;
27
27
  const LogoTitle = styled.div`
28
- color: #000000d9;
29
- font-weight: 600;
30
- font-size: 16px;
28
+ color: #000000d9;
29
+ font-weight: 600;
30
+ font-size: 16px;
31
31
  `;
32
32
  export { Logo };
@@ -1,11 +1,8 @@
1
1
  export * from './components/ChatPage';
2
2
  export * from './components/ChatGuidance';
3
3
  export * from './components/ChatContent';
4
- export * from './components/Bubble';
5
4
  export { SimplifyChatPage, type SimplifyChatPageProps, } from './components/ChatPage/SimplifyChatPage';
6
- export * from './components/ChatDialog';
7
- export * from './components/ChatSplitter';
8
- export * from './components/Bubble/Markdown';
9
5
  export { useChatContext } from './context/useChatContext';
10
6
  export * from './context/types';
11
7
  export * from './utils/parseSse';
8
+ export * from './ui';
@@ -3,10 +3,7 @@ import { useChatContext } from "./context/useChatContext.js";
3
3
  export * from "./components/ChatPage/index.js";
4
4
  export * from "./components/ChatGuidance/index.js";
5
5
  export * from "./components/ChatContent/index.js";
6
- export * from "./components/Bubble/index.js";
7
- export * from "./components/ChatDialog/index.js";
8
- export * from "./components/ChatSplitter/index.js";
9
- export * from "./components/Bubble/Markdown.js";
10
6
  export * from "./context/types.js";
11
7
  export * from "./utils/parseSse.js";
8
+ export * from "./ui/index.js";
12
9
  export { SimplifyChatPage, useChatContext };
@@ -0,0 +1,13 @@
1
+ import { CSSProperties } from 'react';
2
+ import { BaseMessageInfo, Message } from '../../context';
3
+ export interface BubbleListProps<MessageInfo extends BaseMessageInfo> {
4
+ styles?: {
5
+ headerPlaceholder?: CSSProperties;
6
+ bottomPlaceholder?: CSSProperties;
7
+ content?: CSSProperties;
8
+ };
9
+ loading?: boolean;
10
+ messages: Message<MessageInfo>[];
11
+ messageRender: (message: Message<MessageInfo>) => React.ReactNode;
12
+ }
13
+ export declare const BubbleList: <MessageInfo extends BaseMessageInfo = any>(props: BubbleListProps<MessageInfo>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { styled } from "styled-components";
4
+ import { PageLoading } from "../../../../components/Page/index.js";
5
+ const BubbleList = (props)=>{
6
+ const { loading, styles, messages, messageRender } = props;
7
+ const bottomRef = useRef(null);
8
+ const containerRef = useRef(null);
9
+ const content = [
10
+ /*#__PURE__*/ jsx("div", {
11
+ style: styles?.headerPlaceholder ?? {
12
+ height: 4
13
+ }
14
+ }, "header"),
15
+ /*#__PURE__*/ jsx("div", {
16
+ style: styles?.content,
17
+ children: (messages ?? []).map(messageRender)
18
+ }, "content"),
19
+ /*#__PURE__*/ jsx("div", {
20
+ ref: bottomRef,
21
+ style: styles?.bottomPlaceholder ?? {
22
+ height: 60
23
+ }
24
+ }, "footer")
25
+ ];
26
+ return /*#__PURE__*/ jsx(ContentContainer, {
27
+ ref: containerRef,
28
+ children: loading ? /*#__PURE__*/ jsx(PageLoading, {}) : content
29
+ });
30
+ };
31
+ const ContentContainer = styled.div`
32
+ min-height: 100px;
33
+ flex-grow: 1;
34
+ flex-shrink: 1;
35
+ overflow: auto;
36
+ position: relative;
37
+ width: 100%;
38
+ box-sizing: border-box;
39
+ padding: 0 calc((100% - 800px) / 2);
40
+ `;
41
+ export { BubbleList };
@@ -3,3 +3,5 @@ export * from './Reasoning';
3
3
  export * from './ReferenceList';
4
4
  export * from './SuggestMessageList';
5
5
  export * from './LinkCard';
6
+ export * from './BubbleList';
7
+ export * from './Markdown';
@@ -3,3 +3,5 @@ export * from "./Reasoning.js";
3
3
  export * from "./ReferenceList.js";
4
4
  export * from "./SuggestMessageList.js";
5
5
  export * from "./LinkCard.js";
6
+ export * from "./BubbleList.js";
7
+ export * from "./Markdown.js";
@@ -0,0 +1,21 @@
1
+ import { ItemType } from 'antd/es/menu/interface';
2
+ import { InfiniteListProps, InfiniteListRef, RenderActions } from '../../../../components/InfiniteList';
3
+ export interface ConverstionListProps<T = any> {
4
+ rowKey: string;
5
+ ref?: InfiniteListRef<T>;
6
+ defaultActiveKey?: string;
7
+ request: InfiniteListProps<T>['request'];
8
+ menus?: (Omit<ItemType, 'onClick'> & {
9
+ onClick?: (item: T, index: number, actions: RenderActions<Record<string, any>>) => void;
10
+ })[];
11
+ onSelectConversation?: (data: T) => void;
12
+ onDeleteConversation?: (data: T) => void;
13
+ onRenameConversation?: (data: T) => T;
14
+ }
15
+ type ItemData = {
16
+ icon?: React.ReactNode;
17
+ title: string;
18
+ key: string;
19
+ };
20
+ export declare const ConversationList: <T extends ItemData = any>(props: ConverstionListProps<T>) => import("react/jsx-runtime").JSX.Element;
21
+ export {};