listpage-next 0.0.132 → 0.0.133

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.
@@ -6,7 +6,20 @@ function usePagination(props) {
6
6
  const store = useListPageStore();
7
7
  const ele = false === props ? null : /*#__PURE__*/ jsx(PaginationContainer, {
8
8
  children: /*#__PURE__*/ jsx(Pagination, {
9
+ locale: {
10
+ items_per_page: '/页',
11
+ jump_to: '跳至',
12
+ page: '页'
13
+ },
9
14
  align: "end",
15
+ pageSizeOptions: [
16
+ 10,
17
+ 20,
18
+ 50,
19
+ 100
20
+ ],
21
+ showTotal: (total, range)=>`${range[0]}-${range[1]} 共 ${total} 条`,
22
+ showQuickJumper: true,
10
23
  ...props,
11
24
  current: store.pagination.current,
12
25
  pageSize: store.pagination.pageSize,
@@ -3,6 +3,7 @@ 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
+ export { SimplifyChatPage, type SimplifyChatPageProps, } from './components/ChatPage/SimplifyChatPage';
7
7
  export { useChatContext } from './context/useChatContext';
8
8
  export * from './context/types';
9
+ export * from './utils/parseSse';
@@ -6,4 +6,5 @@ export * from "./components/ChatContent/index.js";
6
6
  export * from "./components/Bubble/index.js";
7
7
  export * from "./components/Reasoning/index.js";
8
8
  export * from "./context/types.js";
9
+ export * from "./utils/parseSse.js";
9
10
  export { SimplifyChatPage, useChatContext };
@@ -0,0 +1,6 @@
1
+ export type Callbacks<Event = string, Data = any> = {
2
+ onCompelet?: () => void;
3
+ onError?: (error: any) => void;
4
+ onMessage?: (type: Event, data: Data) => void;
5
+ };
6
+ export declare function parseSubjectStream<Event = string, Data = any>(stream: ReadableStream, callbacks: Callbacks<Event, Data>): Promise<void>;
@@ -0,0 +1,30 @@
1
+ async function parseSubjectStream(stream, callbacks) {
2
+ const reader = stream.getReader();
3
+ const decoder = new TextDecoder();
4
+ try {
5
+ while(true){
6
+ const { done, value } = await reader.read();
7
+ if (done) break;
8
+ const chunk = decoder.decode(value, {
9
+ stream: true
10
+ });
11
+ const lines = chunk.split('\n').filter((line)=>line.trim());
12
+ let type = '';
13
+ for (const line of lines){
14
+ if (line.startsWith('event:')) type = line.slice(6).trim();
15
+ if (line.startsWith('data:')) try {
16
+ const data = JSON.parse(line.slice(5).trim());
17
+ callbacks.onMessage?.(type, data);
18
+ } catch (parseError) {
19
+ console.warn('解析流式数据失败:', line, parseError);
20
+ }
21
+ }
22
+ }
23
+ callbacks.onCompelet?.();
24
+ } catch (error) {
25
+ callbacks.onError?.(error);
26
+ } finally{
27
+ reader.releaseLock();
28
+ }
29
+ }
30
+ export { parseSubjectStream };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.132",
3
+ "version": "0.0.133",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",