listpage-next 0.0.106 → 0.0.108
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/dist/components/DataTable/hooks/useData.js +1 -1
- package/dist/components/InfiniteList/index.d.ts +1 -1
- package/dist/components/InfiniteList/index.js +9 -1
- package/dist/demos/demo8.js +26 -6
- package/dist/features/ChatClient/components/ChatContent/ClientContentBody.d.ts +12 -0
- package/dist/features/ChatClient/components/ChatContent/ClientContentBody.js +53 -0
- package/dist/features/ChatClient/components/ChatContent/{Header.d.ts → ClientContentHeader.d.ts} +1 -1
- package/dist/features/ChatClient/components/ChatContent/{Header.js → ClientContentHeader.js} +2 -2
- package/dist/features/ChatClient/components/ChatContent/index.js +14 -17
- package/dist/features/ChatClient/components/ChatGuidance/index.js +2 -2
- package/dist/features/ChatClient/components/ChatPage/SimplifyChatPage.d.ts +8 -0
- package/dist/features/ChatClient/components/ChatPage/SimplifyChatPage.js +15 -0
- package/dist/features/ChatClient/components/ChatSender/index.d.ts +1 -0
- package/dist/features/ChatClient/components/ChatSender/index.js +26 -2
- package/dist/features/ChatClient/components/ChatSender/styles.d.ts +2 -0
- package/dist/features/ChatClient/components/ChatSender/styles.js +39 -1
- package/dist/features/ChatClient/components/HistoryConversation/index.js +1 -1
- package/dist/features/ChatClient/context/client.d.ts +4 -4
- package/dist/features/ChatClient/index.d.ts +1 -0
- package/dist/features/ChatClient/index.js +2 -1
- package/package.json +1 -1
- package/dist/features/ChatClient/components/ChatContent/styles.d.ts +0 -3
- package/dist/features/ChatClient/components/ChatContent/styles.js +0 -25
|
@@ -2,7 +2,7 @@ import { useState } from "react";
|
|
|
2
2
|
import { useRequest, useUpdateEffect } from "ahooks";
|
|
3
3
|
function useData(props) {
|
|
4
4
|
const { dataSource = [], request, refreshDeps = [] } = props;
|
|
5
|
-
const pagination = props.pagination;
|
|
5
|
+
const pagination = props.pagination ?? {};
|
|
6
6
|
const [params, setParams] = useState({
|
|
7
7
|
current: pagination.current || pagination.defaultCurrent || 1,
|
|
8
8
|
pageSize: pagination.pageSize || pagination.defaultPageSize || 10
|
|
@@ -13,7 +13,15 @@ const InfiniteList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
13
13
|
const containerRef = useRef(null);
|
|
14
14
|
const [list, setList] = useState([]);
|
|
15
15
|
const [hasMore, setHasMore] = useState(true);
|
|
16
|
-
const { loading, run: loadMoreData } = useRequest(()=>
|
|
16
|
+
const { loading, run: loadMoreData } = useRequest(()=>{
|
|
17
|
+
if (!request) return Promise.resolve({
|
|
18
|
+
total: 0,
|
|
19
|
+
list: [],
|
|
20
|
+
current: 1,
|
|
21
|
+
pageSize: 10
|
|
22
|
+
});
|
|
23
|
+
return request?.(pagination);
|
|
24
|
+
}, {
|
|
17
25
|
manual: true,
|
|
18
26
|
ready: hasMore,
|
|
19
27
|
onSuccess: (res)=>{
|
package/dist/demos/demo8.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import "../features/ChatClient/index.js";
|
|
3
|
+
import { SimplifyChatPage } from "../features/ChatClient/components/ChatPage/SimplifyChatPage.js";
|
|
4
|
+
const Demo8 = ()=>/*#__PURE__*/ jsx(SimplifyChatPage, {
|
|
5
5
|
style: {
|
|
6
|
-
|
|
7
|
-
height: '100vh'
|
|
6
|
+
height: '100%'
|
|
8
7
|
},
|
|
9
|
-
|
|
8
|
+
initialMessages: [
|
|
9
|
+
{
|
|
10
|
+
role: 'user',
|
|
11
|
+
content: '你是谁?'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
role: 'assistant',
|
|
15
|
+
content: '我是一个AI'
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
request: {
|
|
19
|
+
chat: function(info, callbacks) {
|
|
20
|
+
throw new Error('Function not implemented.');
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
render: {
|
|
24
|
+
renderMessage: function(message) {
|
|
25
|
+
return /*#__PURE__*/ jsx("div", {
|
|
26
|
+
children: message.info.content
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
10
30
|
});
|
|
11
31
|
export { Demo8 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 极简版对话内容
|
|
3
|
+
*/
|
|
4
|
+
import { BubbleListProps } from "./BubbleList";
|
|
5
|
+
import { ChatSenderProps } from "../ChatSender";
|
|
6
|
+
export interface ClientContentBodyProps {
|
|
7
|
+
senderProps?: ChatSenderProps;
|
|
8
|
+
bubbleProps?: BubbleListProps;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export declare const ClientContentBody: (props: ClientContentBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const SimplifyClientContentBody: (props: ClientContentBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BubbleList } from "./BubbleList.js";
|
|
3
|
+
import { ChatSender } from "../ChatSender/index.js";
|
|
4
|
+
import { styled } from "styled-components";
|
|
5
|
+
const ClientContentBody = (props)=>{
|
|
6
|
+
const { senderProps, bubbleProps, style } = props;
|
|
7
|
+
return /*#__PURE__*/ jsxs(Content, {
|
|
8
|
+
style: style,
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ jsx(BubbleList, {
|
|
11
|
+
...bubbleProps
|
|
12
|
+
}),
|
|
13
|
+
/*#__PURE__*/ jsx(SenderContainer, {
|
|
14
|
+
children: /*#__PURE__*/ jsx(ChatSender, {
|
|
15
|
+
...senderProps
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const SimplifyClientContentBody = (props)=>{
|
|
22
|
+
const { senderProps, bubbleProps, style } = props;
|
|
23
|
+
return /*#__PURE__*/ jsxs(Content, {
|
|
24
|
+
style: style,
|
|
25
|
+
children: [
|
|
26
|
+
/*#__PURE__*/ jsx(BubbleList, {
|
|
27
|
+
...bubbleProps
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsx(ChatSender, {
|
|
30
|
+
mode: "input",
|
|
31
|
+
...senderProps
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const Content = styled.div`
|
|
37
|
+
flex: 1;
|
|
38
|
+
min-height: 0;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
width: 100%;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
`;
|
|
44
|
+
const SenderContainer = styled.div`
|
|
45
|
+
height: 140px;
|
|
46
|
+
padding: 0 calc((100% - 800px) / 2);
|
|
47
|
+
padding-bottom: 20px;
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
display: flex;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
width: 100%;
|
|
52
|
+
`;
|
|
53
|
+
export { ClientContentBody, SimplifyClientContentBody };
|
package/dist/features/ChatClient/components/ChatContent/{Header.d.ts → ClientContentHeader.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface HeaderProps extends HeaderLeftProps {
|
|
2
2
|
extra?: React.ReactNode;
|
|
3
3
|
}
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const ClientContentHeader: (props: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
interface HeaderLeftProps {
|
|
6
6
|
onClickNewConversation?: () => void;
|
|
7
7
|
defaultTitle?: string;
|
package/dist/features/ChatClient/components/ChatContent/{Header.js → ClientContentHeader.js}
RENAMED
|
@@ -4,7 +4,7 @@ import { EditOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
|
|
|
4
4
|
import { Button, Divider } from "antd";
|
|
5
5
|
import { styled } from "styled-components";
|
|
6
6
|
import { useChatClientContext } from "../../context/index.js";
|
|
7
|
-
const
|
|
7
|
+
const ClientContentHeader = (props)=>{
|
|
8
8
|
const { extra, ...headerLeftProps } = props;
|
|
9
9
|
return /*#__PURE__*/ jsxs(HeaderContainer, {
|
|
10
10
|
children: [
|
|
@@ -115,4 +115,4 @@ const HeaderContainer = styled.div`
|
|
|
115
115
|
padding: 12.5px 0px;
|
|
116
116
|
box-sizing: border-box;
|
|
117
117
|
`;
|
|
118
|
-
export {
|
|
118
|
+
export { ClientContentHeader };
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { useRequest } from "ahooks";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { styled } from "styled-components";
|
|
5
|
+
import { ClientContentHeader } from "./ClientContentHeader.js";
|
|
6
6
|
import { MessageProvider, useChatClientContext } from "../../context/index.js";
|
|
7
7
|
import { PageLoading } from "../../../../components/Page/components/Loading/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import { ChatSender } from "../ChatSender/index.js";
|
|
8
|
+
import { ClientContentBody } from "./ClientContentBody.js";
|
|
10
9
|
const ClientContentComponent = (props)=>{
|
|
11
10
|
const { style, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
|
|
12
11
|
return /*#__PURE__*/ jsxs(Container, {
|
|
13
12
|
style: style,
|
|
14
13
|
className: className,
|
|
15
14
|
children: [
|
|
16
|
-
/*#__PURE__*/ jsx(
|
|
15
|
+
/*#__PURE__*/ jsx(ClientContentHeader, {
|
|
17
16
|
defaultTitle: title,
|
|
18
17
|
onTitleChange: onTitleChange,
|
|
19
18
|
onClickNewConversation: onClickNewConversation
|
|
20
19
|
}),
|
|
21
|
-
/*#__PURE__*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...bubbleProps
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ jsx(SenderContainer, {
|
|
27
|
-
children: /*#__PURE__*/ jsx(ChatSender, {
|
|
28
|
-
...senderProps
|
|
29
|
-
})
|
|
30
|
-
})
|
|
31
|
-
]
|
|
20
|
+
/*#__PURE__*/ jsx(ClientContentBody, {
|
|
21
|
+
senderProps: senderProps,
|
|
22
|
+
bubbleProps: bubbleProps
|
|
32
23
|
})
|
|
33
24
|
]
|
|
34
25
|
});
|
|
@@ -36,7 +27,7 @@ const ClientContentComponent = (props)=>{
|
|
|
36
27
|
const ClientContent = ({ loading, ...props })=>{
|
|
37
28
|
const { request, bubbleListRef } = useChatClientContext();
|
|
38
29
|
const { loading: loadingMessage, data } = useRequest(request.getMessages, {
|
|
39
|
-
ready: loading
|
|
30
|
+
ready: !loading && Boolean(request.getMessages)
|
|
40
31
|
});
|
|
41
32
|
useEffect(()=>{
|
|
42
33
|
if (!loadingMessage) setTimeout(()=>{
|
|
@@ -54,4 +45,10 @@ const ClientContent = ({ loading, ...props })=>{
|
|
|
54
45
|
})
|
|
55
46
|
});
|
|
56
47
|
};
|
|
48
|
+
const Container = styled.div`
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
|
|
52
|
+
height: 100%;
|
|
53
|
+
`;
|
|
57
54
|
export { ClientContent };
|
|
@@ -2,13 +2,13 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import { PureChatSender } from "../ChatSender/index.js";
|
|
4
4
|
import { ChatGuidanceContainer, ChatGuidanceContent, GreetingText, SenderContainer } from "./styles.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ClientContentHeader } from "../ChatContent/ClientContentHeader.js";
|
|
6
6
|
const ChatGuidance = (props)=>{
|
|
7
7
|
const { greetingText, extra, style, placeholder, offset, onSubmit } = props;
|
|
8
8
|
return /*#__PURE__*/ jsxs(ChatGuidanceContainer, {
|
|
9
9
|
style: style,
|
|
10
10
|
children: [
|
|
11
|
-
/*#__PURE__*/ jsx(
|
|
11
|
+
/*#__PURE__*/ jsx(ClientContentHeader, {}),
|
|
12
12
|
/*#__PURE__*/ jsx(ChatGuidanceContent, {
|
|
13
13
|
children: /*#__PURE__*/ jsxs(SenderContainer, {
|
|
14
14
|
offset: offset,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseMessageInfo, ChatRender, ChatRequest } from "../../context";
|
|
2
|
+
export interface SimplifyChatPageProps<SessionData = any, MessageInfo extends BaseMessageInfo = any> {
|
|
3
|
+
request: ChatRequest<SessionData, MessageInfo>;
|
|
4
|
+
render: ChatRender<MessageInfo>;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
initialMessages?: MessageInfo[];
|
|
7
|
+
}
|
|
8
|
+
export declare const SimplifyChatPage: <T = any>(props: SimplifyChatPageProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ChatClientProvider, MessageProvider } from "../../context/index.js";
|
|
3
|
+
import { SimplifyClientContentBody } from "../ChatContent/ClientContentBody.js";
|
|
4
|
+
const SimplifyChatPage = (props)=>/*#__PURE__*/ jsx(ChatClientProvider, {
|
|
5
|
+
request: props.request,
|
|
6
|
+
render: props.render,
|
|
7
|
+
children: /*#__PURE__*/ jsx(MessageProvider, {
|
|
8
|
+
request: props.request.chat,
|
|
9
|
+
initialMessages: props.initialMessages ?? [],
|
|
10
|
+
children: /*#__PURE__*/ jsx(SimplifyClientContentBody, {
|
|
11
|
+
style: props.style
|
|
12
|
+
})
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
export { SimplifyChatPage };
|
|
@@ -3,6 +3,7 @@ export interface ChatSenderProps {
|
|
|
3
3
|
placeholder?: string;
|
|
4
4
|
style?: React.CSSProperties;
|
|
5
5
|
className?: string;
|
|
6
|
+
mode?: 'input' | 'textarea';
|
|
6
7
|
}
|
|
7
8
|
export declare const ChatSender: (props: ChatSenderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export interface PureChatSenderProps extends ChatSenderProps {
|
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { Button, Divider, Input } from "antd";
|
|
4
4
|
import { ArrowUpOutlined, PauseCircleTwoTone } from "@ant-design/icons";
|
|
5
5
|
import { useChatClientContext, useMessageContext } from "../../context/index.js";
|
|
6
|
-
import { ChatInputBottom, ChatInputContent, ChatInputPanel } from "./styles.js";
|
|
6
|
+
import { ChatInputBottom, ChatInputContent, ChatInputPanel, MiniChatInputContent, MiniChatInputPanel } from "./styles.js";
|
|
7
7
|
const ChatSender = (props)=>{
|
|
8
8
|
const { isRequesting, sendMessage } = useMessageContext();
|
|
9
9
|
const { bubbleListRef } = useChatClientContext();
|
|
@@ -24,7 +24,7 @@ const ChatSender = (props)=>{
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
const PureChatSender = (props)=>{
|
|
27
|
-
const { style, className, placeholder, extra, loading, onSubmit } = props;
|
|
27
|
+
const { style, className, placeholder, extra, loading, onSubmit, mode = 'textarea' } = props;
|
|
28
28
|
const [inputValue, setInputValue] = useState("");
|
|
29
29
|
const handleClick = async ()=>{
|
|
30
30
|
onSubmit?.(inputValue);
|
|
@@ -36,6 +36,30 @@ const PureChatSender = (props)=>{
|
|
|
36
36
|
if (!loading && inputValue) handleClick();
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
+
if ('input' === mode) return /*#__PURE__*/ jsxs(MiniChatInputPanel, {
|
|
40
|
+
style: style,
|
|
41
|
+
className: className,
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx(MiniChatInputContent, {
|
|
44
|
+
children: /*#__PURE__*/ jsx(Input.TextArea, {
|
|
45
|
+
placeholder: placeholder,
|
|
46
|
+
value: inputValue,
|
|
47
|
+
onChange: (e)=>setInputValue?.(e.target.value),
|
|
48
|
+
onKeyDown: handleKeyDown
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
/*#__PURE__*/ jsx(Button, {
|
|
52
|
+
disabled: !inputValue && !loading,
|
|
53
|
+
loading: loading,
|
|
54
|
+
shape: "circle",
|
|
55
|
+
icon: loading ? /*#__PURE__*/ jsx(PauseCircleTwoTone, {}) : /*#__PURE__*/ jsx(ArrowUpOutlined, {}),
|
|
56
|
+
type: "primary",
|
|
57
|
+
variant: "filled",
|
|
58
|
+
onKeyDown: handleKeyDown,
|
|
59
|
+
onClick: handleClick
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
39
63
|
return /*#__PURE__*/ jsxs(ChatInputPanel, {
|
|
40
64
|
style: style,
|
|
41
65
|
className: className,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const ChatInputPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export declare const MiniChatInputPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const MiniChatInputContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
4
|
export declare const ChatInputContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
5
|
export declare const ChatInputBottom: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -12,6 +12,44 @@ const ChatInputPanel = styled.div`
|
|
|
12
12
|
|
|
13
13
|
width: 800px;
|
|
14
14
|
`;
|
|
15
|
+
const MiniChatInputPanel = styled.div`
|
|
16
|
+
background-color: #eee;
|
|
17
|
+
display: flex;
|
|
18
|
+
border-radius: 20px;
|
|
19
|
+
height: 48px;
|
|
20
|
+
padding: 8px 16px;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
width: 100%;
|
|
23
|
+
`;
|
|
24
|
+
const MiniChatInputContent = styled.div`
|
|
25
|
+
outline: none;
|
|
26
|
+
border: none;
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
max-height: 220px;
|
|
29
|
+
flex-shrink: 1;
|
|
30
|
+
overflow: auto;
|
|
31
|
+
&:focus-visible {
|
|
32
|
+
outline: none;
|
|
33
|
+
}
|
|
34
|
+
.ant-input {
|
|
35
|
+
border: none;
|
|
36
|
+
outline: none;
|
|
37
|
+
&:hover {
|
|
38
|
+
border: none;
|
|
39
|
+
outline: none;
|
|
40
|
+
box-shadow: none;
|
|
41
|
+
}
|
|
42
|
+
min-height: 32px;
|
|
43
|
+
max-height: 32px;
|
|
44
|
+
line-height: 32px;
|
|
45
|
+
resize: none;
|
|
46
|
+
font-size: 16px;
|
|
47
|
+
padding: 0;
|
|
48
|
+
|
|
49
|
+
background-color: transparent;
|
|
50
|
+
box-shadow: none;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
15
53
|
const ChatInputContent = styled.div`
|
|
16
54
|
outline: none;
|
|
17
55
|
border: none;
|
|
@@ -47,4 +85,4 @@ const ChatInputBottom = styled.div`
|
|
|
47
85
|
|
|
48
86
|
flex-shrink: 0;
|
|
49
87
|
`;
|
|
50
|
-
export { ChatInputBottom, ChatInputContent, ChatInputPanel };
|
|
88
|
+
export { ChatInputBottom, ChatInputContent, ChatInputPanel, MiniChatInputContent, MiniChatInputPanel };
|
|
@@ -9,7 +9,7 @@ import { HeaderContainer, HeaderTitle, HistoryConversationContainer, ListContain
|
|
|
9
9
|
const HistoryConversation = (props)=>{
|
|
10
10
|
const { rowKey = "id", activeKey } = props;
|
|
11
11
|
const { showUpdateTitleModal, conversationListRef, action, request } = useChatClientContext();
|
|
12
|
-
const { onClickConversation, onRenameConversation, onDeleteConversation } = action;
|
|
12
|
+
const { onClickConversation, onRenameConversation, onDeleteConversation } = action ?? {};
|
|
13
13
|
return /*#__PURE__*/ jsxs(HistoryConversationContainer, {
|
|
14
14
|
children: [
|
|
15
15
|
/*#__PURE__*/ jsx(Header, {}),
|
|
@@ -3,8 +3,8 @@ import { InfiniteListProps, InfiniteListRef, RenderActions } from "../../../comp
|
|
|
3
3
|
import { BaseMessageInfo, Message, SendMessageRequest } from "./types";
|
|
4
4
|
import { BubbleListRef } from "./useBubbleListRef";
|
|
5
5
|
export type ChatRequest<SessionData = any, MessageInfo extends BaseMessageInfo = any> = {
|
|
6
|
-
getConversations
|
|
7
|
-
getMessages
|
|
6
|
+
getConversations?: InfiniteListProps<SessionData>['request'];
|
|
7
|
+
getMessages?: () => Promise<MessageInfo[]>;
|
|
8
8
|
chat: SendMessageRequest<MessageInfo>;
|
|
9
9
|
};
|
|
10
10
|
export type ChatRender<MessageInfo extends BaseMessageInfo = any> = {
|
|
@@ -19,7 +19,7 @@ export type ChatActionEvent<SessionData = any> = {
|
|
|
19
19
|
export interface ChatClientContextProps<SessionData = any, MessageInfo extends BaseMessageInfo = any> {
|
|
20
20
|
request: ChatRequest<SessionData, MessageInfo>;
|
|
21
21
|
render: ChatRender<MessageInfo>;
|
|
22
|
-
action
|
|
22
|
+
action?: ChatActionEvent<SessionData>;
|
|
23
23
|
collapsed: boolean;
|
|
24
24
|
setCollapsed: (collapsed: boolean) => void;
|
|
25
25
|
showUpdateTitleModal: (title: string, onSubmit?: (title: string) => any) => void;
|
|
@@ -31,7 +31,7 @@ export interface ChatClientProviderProps<SessionData = any, MessageInfo extends
|
|
|
31
31
|
children: ReactNode;
|
|
32
32
|
request: ChatRequest<SessionData, MessageInfo>;
|
|
33
33
|
render: ChatRender<MessageInfo>;
|
|
34
|
-
action
|
|
34
|
+
action?: ChatActionEvent<SessionData>;
|
|
35
35
|
}
|
|
36
36
|
export declare const ChatClientContext: import("react").Context<ChatClientContextProps<any, any>>;
|
|
37
37
|
export declare const ChatClientProvider: (props: ChatClientProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,5 +3,6 @@ export * from './components/ChatGuidance';
|
|
|
3
3
|
export * from './components/ChatContent';
|
|
4
4
|
export * from './components/Bubble';
|
|
5
5
|
export * from './components/Reasoning';
|
|
6
|
+
export { SimplifyChatPage, type SimplifyChatPageProps } from './components/ChatPage/SimplifyChatPage';
|
|
6
7
|
export { useChatContext } from './context/useChatContext';
|
|
7
8
|
export * from './context/types';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SimplifyChatPage } from "./components/ChatPage/SimplifyChatPage.js";
|
|
1
2
|
import { useChatContext } from "./context/useChatContext.js";
|
|
2
3
|
export * from "./components/ChatPage/index.js";
|
|
3
4
|
export * from "./components/ChatGuidance/index.js";
|
|
@@ -5,4 +6,4 @@ export * from "./components/ChatContent/index.js";
|
|
|
5
6
|
export * from "./components/Bubble/index.js";
|
|
6
7
|
export * from "./components/Reasoning/index.js";
|
|
7
8
|
export * from "./context/types.js";
|
|
8
|
-
export { useChatContext };
|
|
9
|
+
export { SimplifyChatPage, useChatContext };
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
-
export declare const Content: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
-
export declare const SenderContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import styled_components from "styled-components";
|
|
2
|
-
const Container = styled_components.div`
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
|
|
6
|
-
height: 100%;
|
|
7
|
-
`;
|
|
8
|
-
const Content = styled_components.div`
|
|
9
|
-
flex: 1;
|
|
10
|
-
min-height: 0;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
width: 100%;
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
`;
|
|
16
|
-
const SenderContainer = styled_components.div`
|
|
17
|
-
height: 140px;
|
|
18
|
-
padding: 0 calc((100% - 800px) / 2);
|
|
19
|
-
padding-bottom: 20px;
|
|
20
|
-
flex-shrink: 0;
|
|
21
|
-
display: flex;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
width: 100%;
|
|
24
|
-
`;
|
|
25
|
-
export { Container, Content, SenderContainer };
|