@next-bricks/ai-portal 0.63.0 → 0.63.1
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/bricks.json +42 -42
- package/dist/chunks/4820.15145a03.js.map +1 -1
- package/dist/chunks/7059.3f1ffc70.js +3 -0
- package/dist/chunks/7059.3f1ffc70.js.map +1 -0
- package/dist/chunks/chat-panel.a64e0e43.js.map +1 -1
- package/dist/chunks/elevo-sidebar.78a35f1d.js.map +1 -1
- package/dist/chunks/{main.3021b8e8.js → main.dd3b9485.js} +2 -2
- package/dist/chunks/{main.3021b8e8.js.map → main.dd3b9485.js.map} +1 -1
- package/dist/examples.json +17 -17
- package/dist/{index.eb7fcf13.js → index.8690de83.js} +2 -2
- package/dist/{index.eb7fcf13.js.map → index.8690de83.js.map} +1 -1
- package/dist/manifest.json +251 -251
- package/dist/types.json +420 -408
- package/dist-types/chat-panel/index.d.ts +1 -2
- package/dist-types/elevo-sidebar/SpaceNav.d.ts +2 -1
- package/dist-types/elevo-sidebar/constants.d.ts +1 -0
- package/dist-types/elevo-sidebar/i18n.d.ts +2 -1
- package/dist-types/elevo-sidebar/index.d.ts +1 -0
- package/dist-types/jsx.d.ts +1 -0
- package/docs/chat-panel.md +19 -3
- package/package.json +2 -2
- package/dist/chunks/7059.ee6fc15b.js +0 -3
- package/dist/chunks/7059.ee6fc15b.js.map +0 -1
- /package/dist/chunks/{7059.ee6fc15b.js.LICENSE.txt → 7059.3f1ffc70.js.LICENSE.txt} +0 -0
|
@@ -4,14 +4,13 @@ import "@next-core/theme";
|
|
|
4
4
|
import type { UploadOptions } from "../shared/interfaces";
|
|
5
5
|
export interface ChatPanelProps {
|
|
6
6
|
panelTitle?: string;
|
|
7
|
-
mode?: "drawer" | "modal" | "fullscreen";
|
|
8
7
|
width?: string | number;
|
|
9
8
|
height?: string | number;
|
|
10
9
|
placeholder?: string;
|
|
11
10
|
uploadOptions?: UploadOptions;
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
13
|
+
* 弹出式对话面板。
|
|
15
14
|
*/
|
|
16
15
|
export declare class ChatPanel extends ReactNextElement implements ChatPanelProps {
|
|
17
16
|
#private;
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import type { SidebarLink } from "./interfaces.js";
|
|
3
3
|
export interface SpaceNavProps {
|
|
4
4
|
returnUrl: string;
|
|
5
|
+
introUrl: string;
|
|
5
6
|
spaceDetail: {
|
|
6
7
|
instanceId: string;
|
|
7
8
|
name: string;
|
|
@@ -13,4 +14,4 @@ export interface SpaceNavProps {
|
|
|
13
14
|
export interface SpaceNavComponentProps extends SpaceNavProps {
|
|
14
15
|
onAddServiceflow?: () => void;
|
|
15
16
|
}
|
|
16
|
-
export declare function SpaceNav({ returnUrl, spaceDetail, spaceObjects, spaceServiceflows, spaceLinks, onAddServiceflow, }: SpaceNavComponentProps): React.JSX.Element;
|
|
17
|
+
export declare function SpaceNav({ returnUrl, introUrl, spaceDetail, spaceObjects, spaceServiceflows, spaceLinks, onAddServiceflow, }: SpaceNavComponentProps): React.JSX.Element;
|
|
@@ -16,7 +16,8 @@ export declare enum K {
|
|
|
16
16
|
BUSINESS_OBJECTS = "BUSINESS_OBJECTS",
|
|
17
17
|
SERVICEFLOWS = "SERVICEFLOWS",
|
|
18
18
|
COLLABORATION_SPACES = "COLLABORATION_SPACES",
|
|
19
|
-
CREATE_SERVICEFLOW = "CREATE_SERVICEFLOW"
|
|
19
|
+
CREATE_SERVICEFLOW = "CREATE_SERVICEFLOW",
|
|
20
|
+
BUSINESS_OBJECTS_SETTINGS = "BUSINESS_OBJECTS_SETTINGS"
|
|
20
21
|
}
|
|
21
22
|
export declare const NS = "bricks/ai-portal/elevo-sidebar";
|
|
22
23
|
export declare const locales: {
|
|
@@ -5,6 +5,7 @@ import type { ActionType } from "@next-bricks/basic/mini-actions";
|
|
|
5
5
|
import { type ActionClickDetail, type Project, type ProjectActionClickDetail } from "./ChatHistory.js";
|
|
6
6
|
import type { SidebarLink } from "./interfaces.js";
|
|
7
7
|
import { type SpaceNavProps } from "./SpaceNav.js";
|
|
8
|
+
export type { SidebarLink, SpaceNavProps };
|
|
8
9
|
export interface ElevoSidebarProps {
|
|
9
10
|
userInstanceId?: string;
|
|
10
11
|
behavior?: "default" | "drawer";
|
package/dist-types/jsx.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ declare global {
|
|
|
80
80
|
onAddProject?: () => void;
|
|
81
81
|
onActionClick?: (event: CustomEvent<ActionClickDetail>) => void;
|
|
82
82
|
onProjectActionClick?: (event: CustomEvent<ProjectActionClickDetail>) => void;
|
|
83
|
+
onAddServiceflow?: (event: CustomEvent<void>) => void;
|
|
83
84
|
onPersonalActionClick?: (event: CustomEvent<PersonalActionClickDetail>) => void;
|
|
84
85
|
};
|
|
85
86
|
"ai-portal--flow-tabs": DetailedHTMLProps<HTMLAttributes<FlowTabs>, FlowTabs> & FlowTabsProps & {
|
package/docs/chat-panel.md
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
构件 `ai-portal.chat-panel`
|
|
2
2
|
|
|
3
|
+
## 介绍
|
|
4
|
+
|
|
5
|
+
弹出式 AI 对话面板,提供一个模态框样式的聊天界面,支持与 AI 助手进行对话交互。
|
|
6
|
+
|
|
3
7
|
## Examples
|
|
4
8
|
|
|
5
9
|
### Basic
|
|
6
10
|
|
|
7
11
|
```yaml preview
|
|
8
|
-
brick:
|
|
9
|
-
properties:
|
|
10
|
-
|
|
12
|
+
- brick: eo-button
|
|
13
|
+
properties:
|
|
14
|
+
themeVariant: elevo
|
|
15
|
+
textContent: 打开对话面板
|
|
16
|
+
events:
|
|
17
|
+
click:
|
|
18
|
+
target: "#chatPanel"
|
|
19
|
+
method: open
|
|
20
|
+
- brick: ai-portal.chat-panel
|
|
21
|
+
properties:
|
|
22
|
+
id: chatPanel
|
|
23
|
+
width: 600
|
|
24
|
+
height: 800
|
|
25
|
+
panelTitle: AI 助手
|
|
26
|
+
placeholder: 请输入您的问题...
|
|
11
27
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-bricks/ai-portal",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.1",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/ai-portal",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@next-bricks/presentational": "*",
|
|
50
50
|
"@next-bricks/vs": "*"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "607d3b3380f81d1c0e834418cf7645035e73c042"
|
|
53
53
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 7059.ee6fc15b.js.LICENSE.txt */
|
|
2
|
-
"use strict";(globalThis.webpackChunk_next_bricks_ai_portal=globalThis.webpackChunk_next_bricks_ai_portal||[]).push([[7059],{5813:(e,t,i)=>{i.d(t,{I:()=>c,K:()=>a,NS:()=>o,t:()=>s});var n=i(67177);let a=function(e){return e.NEW_CHAT="NEW_CHAT",e.LOGOUT="LOGOUT",e.TODAY="TODAY",e.YESTERDAY="YESTERDAY",e.PREVIOUS_7_DAYS="PREVIOUS_7_DAYS",e.PREVIOUS_30_DAYS="PREVIOUS_30_DAYS",e.SWITCH_LANGUAGE="SWITCH_LANGUAGE",e.MY="MY",e.PROJECTS="PROJECTS",e.HISTORY="HISTORY",e.CREATE_PROJECT="CREATE_PROJECT",e.MOVE_TO_PROJECT="MOVE_TO_PROJECT",e.UNTITLED="UNTITLED",e.UNNAMED="UNNAMED",e.BUSINESS_OBJECTS="BUSINESS_OBJECTS",e.SERVICEFLOWS="SERVICEFLOWS",e.COLLABORATION_SPACES="COLLABORATION_SPACES",e.CREATE_SERVICEFLOW="CREATE_SERVICEFLOW",e}({});const r={[a.NEW_CHAT]:"New chat",[a.LOGOUT]:"Logout",[a.TODAY]:"Today",[a.YESTERDAY]:"Yesterday",[a.PREVIOUS_7_DAYS]:"Previous 7 days",[a.PREVIOUS_30_DAYS]:"Previous 30 days",[a.SWITCH_LANGUAGE]:"中文",[a.MY]:"My",[a.PROJECTS]:"Projects",[a.HISTORY]:"Chats",[a.CREATE_PROJECT]:"Create project",[a.MOVE_TO_PROJECT]:"Move to project",[a.UNTITLED]:"Untitled",[a.UNNAMED]:"Unnamed",[a.BUSINESS_OBJECTS]:"Business objects",[a.SERVICEFLOWS]:"Serviceflows",[a.COLLABORATION_SPACES]:"Collaboration spaces",[a.CREATE_SERVICEFLOW]:"Create serviceflow"},l={[a.NEW_CHAT]:"新对话",[a.LOGOUT]:"登出",[a.TODAY]:"今天",[a.YESTERDAY]:"昨天",[a.PREVIOUS_7_DAYS]:"过去7天",[a.PREVIOUS_30_DAYS]:"过去30天",[a.SWITCH_LANGUAGE]:"English",[a.MY]:"我的",[a.PROJECTS]:"项目",[a.HISTORY]:"对话",[a.CREATE_PROJECT]:"创建项目",[a.MOVE_TO_PROJECT]:"移动到项目",[a.UNTITLED]:"无标题",[a.UNNAMED]:"未命名",[a.BUSINESS_OBJECTS]:"业务对象",[a.SERVICEFLOWS]:"业务流",[a.COLLABORATION_SPACES]:"协作空间",[a.CREATE_SERVICEFLOW]:"创建业务流"},o="bricks/ai-portal/elevo-sidebar",c={en:r,zh:l},s=n.i18n.getFixedT(null,o)},17452:(e,t,i)=>{i.d(t,{c:()=>n});const n={lib:"fa",icon:"plus"}},41938:(e,t,i)=>{i.d(t,{c:()=>m});var n=i(89575),a=i(18769),r=i.n(a),l=i(53373),o=i.n(l),c=i(51578),s=i(5813),d=i(70579),p=i(94504),u=i(17452);function m(e){let{returnUrl:t,spaceDetail:i,spaceObjects:l,spaceServiceflows:m,spaceLinks:E,onAddServiceflow:g}=e;const h=(0,a.useRef)(null),[v,f]=(0,a.useState)(!1),[x,k]=(0,a.useState)(!1);return r().createElement(r().Fragment,null,r().createElement(d.EM,{url:t,className:"return-link"},r().createElement("div",{className:"heading"},r().createElement("div",{className:"title"},null==i?void 0:i.name),r().createElement("div",{className:"sub-title"},(0,s.t)(s.K.COLLABORATION_SPACES))),r().createElement(d.Bj,{className:"icon",lib:"lucide",icon:"arrow-left"})),r().createElement("div",{className:"divider"}),r().createElement("div",{className:"history",ref:h},null!=l&&l.length?r().createElement("div",{className:o()("section",{collapsed:v})},r().createElement(c._,{rootRef:h,title:(0,s.t)(s.K.BUSINESS_OBJECTS),collapsed:v,onToggle:()=>f((e=>!e))}),r().createElement("ul",{className:"items"},l.map(((e,t)=>r().createElement("li",{key:t},r().createElement(p.k,{url:e.url,activeIncludes:e.activeIncludes,render:t=>{let{active:i}=t;return r().createElement(d.EM,{className:o()("item",{active:i}),url:e.url},r().createElement("div",{className:"item-title"},e.title))}})))))):null,null!=m&&m.length?r().createElement("div",{className:o()("section",{collapsed:x})},r().createElement(c._,{rootRef:h,title:(0,s.t)(s.K.SERVICEFLOWS),collapsed:x,onToggle:()=>k((e=>!e))},r().createElement(d.Py,{icon:u.c,variant:"mini-light",tooltip:(0,s.t)(s.K.CREATE_SERVICEFLOW),tooltipHoist:!0,className:"button",onClick:g})),r().createElement("ul",{className:"items"},m.map(((e,t)=>r().createElement("li",{key:t},r().createElement(p.k,{url:e.url,activeIncludes:e.activeIncludes,render:t=>{let{active:i}=t;return r().createElement(d.EM,{className:o()("item",{active:i}),url:e.url},r().createElement("div",{className:"item-title"},e.title))}})))))):null,null!=E&&E.length?r().createElement("div",{className:"space-links"},E.map(((e,t)=>r().createElement(p.k,{key:t,url:e.url,activeIncludes:e.activeIncludes,render:i=>{let{active:a}=i;return r().createElement(d.EM,{key:t,className:o()("link",{active:a}),url:e.url},r().createElement(d.Bj,(0,n.A)({className:"icon"},e.icon)),r().createElement("span",{className:"title"},e.title))}})))):null))}},51578:(e,t,i)=>{i.d(t,{_:()=>s});var n=i(18769),a=i.n(n),r=i(41030),l=i(53373),o=i.n(l),c=i(70579);function s(e){let{rootRef:t,title:i,collapsed:l,children:s,onToggle:d}=e;const p=(0,n.useRef)(null),[u,m]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{if(l)return void m(!1);const e=t.current,i=p.current,n=null==i?void 0:i.nextElementSibling;if(!e||!i||!n)return;const a=(0,r.throttle)((()=>{const e=i.getBoundingClientRect(),t=n.getBoundingClientRect().top-e.top-e.height;m(t<1)}),100);return e.addEventListener("scroll",a),()=>{e.removeEventListener("scroll",a)}}),[l,t]),a().createElement("div",{className:o()("section-title",{sticky:u}),ref:p},a().createElement("div",{className:"section-label",onClick:d},i,a().createElement(c.Bj,{lib:"fa",icon:"angle-down"})),s)}},61408:(e,t,i)=>{i.d(t,{A:()=>o});var n=i(36758),a=i.n(n),r=i(40935),l=i.n(r)()(a());l.push([e.id,':host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.sidebar{position:relative;z-index:2;width:260px;height:100%;background:rgba(246,247,249,0.5);border:1px solid rgba(255,255,255,0.3);border-radius:12px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);padding:23px 11px 0;display:flex;flex-direction:column;transition:transform 0.3s ease-in-out}.logo-bar{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px;margin-left:4px}.main{flex:1;min-height:0;display:flex;flex-direction:column}.divider{border-top:1px solid rgba(0,0,0,0.06);margin:16px 0}.logo-link::part(link){display:block}.logo{vertical-align:middle}.new-chat::part(link){display:flex;gap:0;align-items:center;color:var(--elevo-color-brand);font-size:14px;text-align:left;cursor:pointer}.sidebar .new-chat::part(link){background:#f0f4ff;border-radius:8px;border:1px solid #c9d7ff;padding:9px 13px;font-weight:500;margin-bottom:16px}.sidebar .new-chat::part(link):hover{background:rgba(201,215,255,0.5)}.new-chat-icon{font-size:16px;margin-right:5px}.footer{border-top:1px solid rgba(0,0,0,0.04);padding:9px 12px;margin:0 -12px}.dropdown{display:block}.account{background:none;border:none;border-radius:8px;padding:6px 10px;display:block;width:100%;text-align:left;cursor:pointer}.account:hover{background:rgba(0,0,0,0.04)}.alternative{position:fixed;top:8px;left:8px;padding:6px 10px 6px 8px;display:flex;align-items:center;opacity:0;z-index:2;transition:opacity 0.2s ease-in-out;background:rgba(255,255,255,0);border-radius:8px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.alternative .new-chat::part(link){padding:4px;margin-left:16px;font-size:12px}.alternative .new-chat::part(link):hover{color:#7891ff}.alternative .new-chat::part(link):active{color:#0911b3}.container{width:270px;padding:10px 0 10px 10px;height:100%;transition:width 0.3s ease-in-out,padding 0.3s ease-in-out}.container.collapsed{width:0;padding:10px 0;overflow:visible}.container.collapsed .sidebar{transform:translateX(-100%)}.container.collapsed .alternative{opacity:1}:host([behavior="drawer"]){z-index:2;width:0}:host(:not([behavior="drawer"])) .alternative .new-chat{display:none}.mask{position:fixed;top:0;right:0;bottom:0;left:0}.link{display:block}.link + .link{margin-top:4px}.link::part(link){display:flex;gap:0;align-items:center;padding:7px 10px;border-radius:8px;color:#000}.link.active::part(link),.link::part(link):hover{background:rgba(0,0,0,0.04)}.link .icon{font-size:16px;margin-right:10px}.link .title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.history{flex:1;min-height:0;overflow-y:auto;margin:0 -12px;padding:0 12px}.history ul{list-style:none;margin:0;padding:0}.history .section + .section{margin-top:14px}.history .section-title{display:flex;align-items:center;justify-content:space-between;height:30px;margin-bottom:6px;padding:0 8px;position:sticky;top:0}.history .section-title.sticky::before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgb(229,228,234);border-radius:8px;z-index:-1}.history .section-label{display:flex;align-items:center;height:24px;padding:0 8px;margin-left:-8px;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;font-size:12px;color:#8c8c8c;border-radius:8px}.history .section-label eo-icon{vertical-align:middle;margin-left:6px;transition:transform 0.2s ease-in-out}.history .section-label:hover{background:rgba(0,0,0,0.04)}.history .collapsed > ul{display:none}.history .collapsed .section-label eo-icon{transform:rotate(-90deg)}.history .error,.history .loading{display:flex;align-items:center;height:36px;padding:0 8px}.history .loading{justify-content:center}.history .error{color:var(--color-error)}.history .group + .group{margin-top:15px}.history .group-title{font-weight:500;font-size:12px;color:#000;padding:8px;height:36px;line-height:20px}.history .item{display:block}.history .item::part(link){display:flex;align-items:center;padding:0 8px;height:36px;border-radius:8px;color:#000}.history .item.active::part(link){background:rgba(0,0,0,0.06)}.history .item.actions-active::part(link),.history .item::part(link):hover{background:rgba(0,0,0,0.04)}.history .item-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.history .actions{cursor:auto}.history .item:not(:hover):not(.actions-active) .actions{display:none}.history .working{width:8px;height:8px;border-radius:8px;background:var(--elevo-color-brand);margin:0 7px}.history .item.actions-active .working,.history .item:hover .working,.history .item.active .working{display:none}.history .load-more{display:flex;justify-content:center;align-items:center;height:36px}.button{display:flex}.space-links{margin-top:16px}.return-link{display:block}.return-link .heading{display:flex;flex-direction:column;align-items:flex-start;gap:4px;flex:1;min-width:0}.return-link .title,.return-link .sub-title{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.return-link .title{font-weight:500;font-size:18px}.return-link .sub-title{font-size:12px;color:#8c8c8c}.return-link .icon{font-size:16px;color:#8c8c8c}.return-link:not(:hover) .icon{display:none}.return-link::part(link){display:flex;align-items:center;justify-content:center;padding:6px 8px;border-radius:8px;color:#000}.return-link::part(link):hover{background:rgba(0,0,0,0.04)}',""]);const o=l.toString()},70579:(e,t,i)=>{i.d(t,{Bj:()=>a,EM:()=>r,JQ:()=>o,Py:()=>s,qb:()=>l,qu:()=>c});var n=i(30981);const a=(0,n.wrapBrick)("eo-icon"),r=(0,n.wrapBrick)("eo-link"),l=(0,n.wrapBrick)("eo-dropdown-actions",{onActionClick:"action.click",onVisibleChange:"visible.change"}),o=(0,n.wrapBrick)("eo-easyops-avatar"),c=(0,n.wrapBrick)("eo-mini-actions",{onActionClick:"action.click",onVisibleChange:"visible.change"}),s=(0,n.wrapBrick)("ai-portal.icon-button")},75197:(e,t,i)=>{i.d(t,{D:()=>f});var n=i(89575),a=i(18769),r=i.n(a),l=i(53373),o=i.n(l),c=i(22919);const s=async(e,t)=>(await c.http.get("api/gateway/logic.llm.aiops_service/api/v1/elevo/conversations",{...t,params:e})).data;var d=i(41030),p=i(5813),u=i(70579),m=i(40177),E=i(65549),g=i(94504),h=i(51578),v=i(17452);const f=(0,a.forwardRef)(x);function x(e,t){let{showProjects:i,historyActions:l,historyUrlTemplate:f,projectUrlTemplate:x,projectActions:k,canAddProject:b,myLinks:y,onActionClick:S,onHistoryClick:T,onProjectActionClick:C,onAddProject:O}=e;const w=(0,a.useRef)(null),[N,A]=(0,a.useState)(!1),[R,_]=(0,a.useState)(null),[I,P]=(0,a.useState)(!1),[L,U]=(0,a.useState)(!1),[j,B]=(0,a.useState)(null),[Y,D]=(0,a.useState)(!1),[M,V]=(0,a.useState)(),[J,H]=(0,a.useState)(),[W,z]=(0,a.useState)(!1),F=(0,a.useRef)(!0),[G,K]=(0,a.useState)([]),q=(0,a.useMemo)((()=>[...null!=l?l:[],{isDropdown:!0,text:(0,p.t)(p.K.MOVE_TO_PROJECT),disabled:!(null!=R&&R.length),items:null==R?void 0:R.map((e=>({event:"move",key:e.instanceId,text:e.name,project:e})))}]),[l,R]);(0,a.useEffect)((()=>{(async()=>{try{const e=await(async()=>(await c.http.get("api/gateway/logic.llm.aiops_service/api/v1/elevo/projects",{params:{page:1,page_size:3e3}})).data)();_(e.list)}catch(e){console.error("Error loading projects:",e),U(!0),_([])}})()}),[]),(0,a.useEffect)((()=>{Promise.all([s({token:J,limit:30,onlyOwner:!0,onlyUnrelatedProject:!0},{interceptorParams:{ignoreLoadingBar:!0}}),...F.current?[]:[new Promise((e=>setTimeout(e,500)))]]).then((e=>{let[t]=e;F.current=!1,B((e=>[...null!=e?e:[],...t.conversations])),V(t.nextToken)})).catch((e=>{console.error("Error loading chat history:",e),B([]),z(!0)}))}),[J]);const[Q,X]=(0,a.useState)(null),Z=(0,a.useRef)(null);(0,a.useEffect)((()=>{const e=Z.current,t=w.current;if(!e||!M||!t||Y)return;const i=new IntersectionObserver((e=>{for(const t of e)t.isIntersecting&&H(M)}),{root:t});return i.observe(e),()=>{i.disconnect()}}),[M,Y]);const $=(0,a.useRef)(0),ee=(0,a.useCallback)((async()=>{try{const e=++$.current,t=await s({limit:30,onlyOwner:!0,onlyUnrelatedProject:!0},{interceptorParams:{ignoreLoadingBar:!0}});if(e!==$.current)return;B((e=>{const i=null!=e?e:[],n=t.conversations,a=new Set(n.map((e=>e.conversationId))),r=new Map(n.map((e=>[e.conversationId,e])));let l=!1,o=!1,c=!0;for(const e of i){const t=r.get(e.conversationId);if(!t)break;if(l=!0,o=c&&t!==n[0]||!(0,d.isEqual)(t,e),o)break;c=!1}return l?o?[...n,...i.filter((e=>!a.has(e.conversationId)))]:e:(V(t.nextToken),n)}))}catch(e){console.error("Error pulling chat history:",e)}}),[]);(0,a.useImperativeHandle)(t,(()=>({pull:ee,removeProject:e=>{_((t=>t?t.filter((t=>t.instanceId!==e)):t))},addProject:e=>{_((t=>t?[...t,e]:[e]))},moveConversation:e=>{K((t=>[...t,e]))}})),[ee]);const te=(0,a.useMemo)((()=>j&&j.length?j.filter((e=>!G.includes(e.conversationId))):j),[j,G]);return r().createElement("div",{className:"history",ref:w},null!=y&&y.length?r().createElement("div",{className:o()("section",{collapsed:N})},r().createElement(h._,{rootRef:w,title:(0,p.t)(p.K.MY),collapsed:N,onToggle:()=>A((e=>!e))}),r().createElement("ul",{className:"items"},y.map(((e,t)=>r().createElement("li",{key:t},r().createElement(g.k,{url:e.url,activeIncludes:e.activeIncludes,render:t=>{let{active:i}=t;return r().createElement(u.EM,{className:o()("item",{active:i}),url:e.url},r().createElement("div",{className:"item-title"},e.title))}})))))):null,i&&r().createElement("div",{className:o()("section",{collapsed:I})},r().createElement(h._,{rootRef:w,title:(0,p.t)(p.K.PROJECTS),collapsed:I,onToggle:()=>P((e=>!e))},b&&r().createElement(u.Py,{icon:v.c,variant:"mini-light",tooltip:(0,p.t)(p.K.CREATE_PROJECT),tooltipHoist:!0,className:"button",onClick:O})),r().createElement("ul",{className:"items"},L?r().createElement("li",{className:"error"},"Failed to load project"):R?R.map((e=>{const t=x?(0,E.Q)(x,e):void 0;return r().createElement("li",{key:e.instanceId},r().createElement(g.k,{url:t,render:i=>{let{active:a}=i;return r().createElement(u.EM,(0,n.A)({className:o()("item",{"actions-active":e.instanceId===Q,active:a}),onClick:T},t?{url:t}:null),r().createElement("div",{className:"item-title",title:e.name},e.name||(0,p.t)(p.K.UNNAMED)),r().createElement(u.qu,{className:"actions",actions:k,themeVariant:"elevo",onActionClick:t=>{C({action:t.detail,project:e})},onVisibleChange:t=>{X(t.detail?e.instanceId:null)}}))}}))})):r().createElement("li",{className:"loading"},r().createElement(u.Bj,{lib:"antd",theme:"outlined",icon:"loading-3-quarters",spinning:!0})))),r().createElement("div",{className:o()("section",{collapsed:Y})},r().createElement(h._,{rootRef:w,title:(0,p.t)(p.K.HISTORY),collapsed:Y,onToggle:()=>D((e=>!e))}),r().createElement("ul",{className:"items"},te?te.map((e=>{const t=f?(0,E.Q)(f,e):void 0;return r().createElement("li",{key:e.conversationId},r().createElement(g.k,{url:t,render:t=>{let{active:i}=t;return r().createElement(u.EM,(0,n.A)({className:o()("item",{"actions-active":e.conversationId===Q,active:i}),onClick:T},f?{url:(0,E.Q)(f,e)}:null),r().createElement("div",{className:"item-title",title:e.title},e.title||(0,p.t)(p.K.UNTITLED)),r().createElement(u.qu,{className:"actions",actions:q,onActionClick:t=>{S({action:t.detail,item:e,project:t.detail.project})},onVisibleChange:t=>{X(t.detail?e.conversationId:null)}}),!m.QB.includes(e.state)&&r().createElement("div",{className:"working"}))}}))})):r().createElement("li",{className:"loading"},r().createElement(u.Bj,{lib:"antd",theme:"outlined",icon:"loading-3-quarters",spinning:!0})),W?r().createElement("li",{className:"error"},"Failed to load chat history"):null),!Y&&M&&r().createElement("div",{className:"load-more",ref:Z},r().createElement(u.Bj,{lib:"antd",icon:"loading-3-quarters",spinning:!0}))))}},94504:(e,t,i)=>{i.d(t,{k:()=>r});var n=i(18769),a=i(60128);function r(e){let{url:t,activeIncludes:i,render:r}=e;const[l,o]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{function e(e){if(t){for(const n of[t,...null!=i?i:[]])if((0,a.matchPath)(e.pathname,{path:n,exact:!1}))return void o(!0);o(!1)}else o(!1)}const n=(0,a.getHistory)();return e(n.location),n.listen(e)}),[t,i]),r({active:l})}}}]);
|
|
3
|
-
//# sourceMappingURL=7059.ee6fc15b.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/7059.ee6fc15b.js","mappings":";qMAEO,IAAKA,EAAC,SAADA,GAAC,OAADA,EAAC,oBAADA,EAAC,gBAADA,EAAC,cAADA,EAAC,sBAADA,EAAC,kCAADA,EAAC,oCAADA,EAAC,kCAADA,EAAC,QAADA,EAAC,oBAADA,EAAC,kBAADA,EAAC,gCAADA,EAAC,kCAADA,EAAC,oBAADA,EAAC,kBAADA,EAAC,oCAADA,EAAC,4BAADA,EAAC,4CAADA,EAAC,wCAADA,CAAC,MAqBb,MAAMC,EAAa,CACjB,CAACD,EAAEE,UAAW,WACd,CAACF,EAAEG,QAAS,SACZ,CAACH,EAAEI,OAAQ,QACX,CAACJ,EAAEK,WAAY,YACf,CAACL,EAAEM,iBAAkB,kBACrB,CAACN,EAAEO,kBAAmB,mBACtB,CAACP,EAAEQ,iBAAkB,KACrB,CAACR,EAAES,IAAK,KACR,CAACT,EAAEU,UAAW,WACd,CAACV,EAAEW,SAAU,QACb,CAACX,EAAEY,gBAAiB,iBACpB,CAACZ,EAAEa,iBAAkB,kBACrB,CAACb,EAAEc,UAAW,WACd,CAACd,EAAEe,SAAU,UACb,CAACf,EAAEgB,kBAAmB,mBACtB,CAAChB,EAAEiB,cAAe,eAClB,CAACjB,EAAEkB,sBAAuB,uBAC1B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,EAAQG,OAAOT,EAAgB,GACrC,CAACtL,EAAKiB,IAEFC,EAAO,CAAEE,UAClB","sources":["webpack:///./src/elevo-sidebar/i18n.ts","webpack:///./src/elevo-sidebar/constants.ts","webpack:///./src/elevo-sidebar/SpaceNav.tsx","webpack:///./src/elevo-sidebar/SectionTitle.tsx","webpack:///./src/elevo-sidebar/styles.shadow.css","webpack:///./src/elevo-sidebar/bricks.ts","webpack:///../../node_modules/@next-api-sdk/llm-sdk/dist/esm/api/llm/elevo/getElevoProjects.js","webpack:///../../node_modules/@next-api-sdk/llm-sdk/dist/esm/api/llm/elevo/listElevoConversations.js","webpack:///./src/elevo-sidebar/ChatHistory.tsx","webpack:///./src/elevo-sidebar/NavLink.tsx"],"sourcesContent":["import { i18n } from \"@next-core/i18n\";\n\nexport enum K {\n NEW_CHAT = \"NEW_CHAT\",\n LOGOUT = \"LOGOUT\",\n TODAY = \"TODAY\",\n YESTERDAY = \"YESTERDAY\",\n PREVIOUS_7_DAYS = \"PREVIOUS_7_DAYS\",\n PREVIOUS_30_DAYS = \"PREVIOUS_30_DAYS\",\n SWITCH_LANGUAGE = \"SWITCH_LANGUAGE\",\n MY = \"MY\",\n PROJECTS = \"PROJECTS\",\n HISTORY = \"HISTORY\",\n CREATE_PROJECT = \"CREATE_PROJECT\",\n MOVE_TO_PROJECT = \"MOVE_TO_PROJECT\",\n UNTITLED = \"UNTITLED\",\n UNNAMED = \"UNNAMED\",\n BUSINESS_OBJECTS = \"BUSINESS_OBJECTS\",\n SERVICEFLOWS = \"SERVICEFLOWS\",\n COLLABORATION_SPACES = \"COLLABORATION_SPACES\",\n CREATE_SERVICEFLOW = \"CREATE_SERVICEFLOW\",\n}\n\nconst en: Locale = {\n [K.NEW_CHAT]: \"New chat\",\n [K.LOGOUT]: \"Logout\",\n [K.TODAY]: \"Today\",\n [K.YESTERDAY]: \"Yesterday\",\n [K.PREVIOUS_7_DAYS]: \"Previous 7 days\",\n [K.PREVIOUS_30_DAYS]: \"Previous 30 days\",\n [K.SWITCH_LANGUAGE]: \"中文\",\n [K.MY]: \"My\",\n [K.PROJECTS]: \"Projects\",\n [K.HISTORY]: \"Chats\",\n [K.CREATE_PROJECT]: \"Create project\",\n [K.MOVE_TO_PROJECT]: \"Move to project\",\n [K.UNTITLED]: \"Untitled\",\n [K.UNNAMED]: \"Unnamed\",\n [K.BUSINESS_OBJECTS]: \"Business objects\",\n [K.SERVICEFLOWS]: \"Serviceflows\",\n [K.COLLABORATION_SPACES]: \"Collaboration spaces\",\n [K.CREATE_SERVICEFLOW]: \"Create serviceflow\",\n};\n\nconst zh: Locale = {\n [K.NEW_CHAT]: \"新对话\",\n [K.LOGOUT]: \"登出\",\n [K.TODAY]: \"今天\",\n [K.YESTERDAY]: \"昨天\",\n [K.PREVIOUS_7_DAYS]: \"过去7天\",\n [K.PREVIOUS_30_DAYS]: \"过去30天\",\n [K.SWITCH_LANGUAGE]: \"English\",\n [K.MY]: \"我的\",\n [K.PROJECTS]: \"项目\",\n [K.HISTORY]: \"对话\",\n [K.CREATE_PROJECT]: \"创建项目\",\n [K.MOVE_TO_PROJECT]: \"移动到项目\",\n [K.UNTITLED]: \"无标题\",\n [K.UNNAMED]: \"未命名\",\n [K.BUSINESS_OBJECTS]: \"业务对象\",\n [K.SERVICEFLOWS]: \"业务流\",\n [K.COLLABORATION_SPACES]: \"协作空间\",\n [K.CREATE_SERVICEFLOW]: \"创建业务流\",\n};\n\nexport const NS = \"bricks/ai-portal/elevo-sidebar\";\n\nexport const locales = { en, zh };\n\nexport const t = i18n.getFixedT(null, NS);\n\ntype Locale = { [k in K]: string } & {\n [k in K as `${k}_plural`]?: string;\n};\n","import type { GeneralIconProps } from \"@next-bricks/icons/general-icon\";\n\nexport const ADD_ICON: GeneralIconProps = {\n lib: \"fa\",\n icon: \"plus\",\n};\n","import React, { useRef, useState } from \"react\";\nimport classNames from \"classnames\";\nimport { SectionTitle } from \"./SectionTitle.js\";\nimport { K, t } from \"./i18n.js\";\nimport { WrappedIcon, WrappedIconButton, WrappedLink } from \"./bricks.js\";\nimport { NavLink } from \"./NavLink.js\";\nimport type { SidebarLink } from \"./interfaces.js\";\nimport { ADD_ICON } from \"./constants.js\";\n\nexport interface SpaceNavProps {\n returnUrl: string;\n spaceDetail: {\n instanceId: string;\n name: string;\n };\n spaceObjects?: SidebarLink[];\n spaceServiceflows?: SidebarLink[];\n spaceLinks?: SidebarLink[];\n}\n\nexport interface SpaceNavComponentProps extends SpaceNavProps {\n onAddServiceflow?: () => void;\n}\n\nexport function SpaceNav({\n returnUrl,\n spaceDetail,\n spaceObjects,\n spaceServiceflows,\n spaceLinks,\n onAddServiceflow,\n}: SpaceNavComponentProps) {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [objectsCollapsed, setObjectsCollapsed] = useState(false);\n const [serviceflowsCollapsed, setServiceflowsCollapsed] = useState(false);\n\n return (\n <>\n <WrappedLink url={returnUrl} className=\"return-link\">\n <div className=\"heading\">\n <div className=\"title\">{spaceDetail?.name}</div>\n <div className=\"sub-title\">{t(K.COLLABORATION_SPACES)}</div>\n </div>\n <WrappedIcon className=\"icon\" lib=\"lucide\" icon=\"arrow-left\" />\n </WrappedLink>\n <div className=\"divider\" />\n <div className=\"history\" ref={rootRef}>\n {spaceObjects?.length ? (\n <div\n className={classNames(\"section\", { collapsed: objectsCollapsed })}\n >\n <SectionTitle\n rootRef={rootRef}\n title={t(K.BUSINESS_OBJECTS)}\n collapsed={objectsCollapsed}\n onToggle={() => setObjectsCollapsed((prev) => !prev)}\n />\n <ul className=\"items\">\n {spaceObjects.map((obj, index) => (\n <li key={index}>\n <NavLink\n url={obj.url}\n activeIncludes={obj.activeIncludes}\n render={({ active }) => (\n <WrappedLink\n className={classNames(\"item\", { active })}\n url={obj.url}\n >\n <div className=\"item-title\">{obj.title}</div>\n </WrappedLink>\n )}\n />\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n {spaceServiceflows?.length ? (\n <div\n className={classNames(\"section\", {\n collapsed: serviceflowsCollapsed,\n })}\n >\n <SectionTitle\n rootRef={rootRef}\n title={t(K.SERVICEFLOWS)}\n collapsed={serviceflowsCollapsed}\n onToggle={() => setServiceflowsCollapsed((prev) => !prev)}\n >\n <WrappedIconButton\n icon={ADD_ICON}\n variant=\"mini-light\"\n tooltip={t(K.CREATE_SERVICEFLOW)}\n tooltipHoist={true}\n className=\"button\"\n onClick={onAddServiceflow}\n />\n </SectionTitle>\n <ul className=\"items\">\n {spaceServiceflows.map((obj, index) => (\n <li key={index}>\n <NavLink\n url={obj.url}\n activeIncludes={obj.activeIncludes}\n render={({ active }) => (\n <WrappedLink\n className={classNames(\"item\", { active })}\n url={obj.url}\n >\n <div className=\"item-title\">{obj.title}</div>\n </WrappedLink>\n )}\n />\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n {spaceLinks?.length ? (\n <div className=\"space-links\">\n {spaceLinks.map((link, index) => (\n <NavLink\n key={index}\n url={link.url}\n activeIncludes={link.activeIncludes}\n render={({ active }) => (\n <WrappedLink\n key={index}\n className={classNames(\"link\", { active })}\n url={link.url}\n >\n <WrappedIcon className=\"icon\" {...link.icon} />\n <span className=\"title\">{link.title}</span>\n </WrappedLink>\n )}\n />\n ))}\n </div>\n ) : null}\n </div>\n </>\n );\n}\n","import React, {\n useEffect,\n useRef,\n useState,\n type MutableRefObject,\n type PropsWithChildren,\n} from \"react\";\nimport { throttle } from \"lodash\";\nimport classNames from \"classnames\";\nimport { WrappedIcon } from \"./bricks.js\";\n\nexport interface SectionTitleProps {\n rootRef: MutableRefObject<HTMLDivElement | null>;\n title: string;\n collapsed: boolean;\n onToggle: () => void;\n}\n\nexport function SectionTitle({\n rootRef,\n title,\n collapsed,\n children,\n onToggle,\n}: PropsWithChildren<SectionTitleProps>) {\n const ref = useRef<HTMLDivElement | null>(null);\n const [stickyActive, setStickyActive] = useState(false);\n\n useEffect(() => {\n if (collapsed) {\n setStickyActive(false);\n return;\n }\n const parent = rootRef.current;\n const element = ref.current;\n const sibling = element?.nextElementSibling as HTMLElement | null;\n if (!parent || !element || !sibling) {\n return;\n }\n const onScroll = throttle(() => {\n const rect = element.getBoundingClientRect();\n const siblingRect = sibling.getBoundingClientRect();\n const diff = siblingRect.top - rect.top - rect.height;\n setStickyActive(diff < 1);\n }, 100);\n parent.addEventListener(\"scroll\", onScroll);\n return () => {\n parent.removeEventListener(\"scroll\", onScroll);\n };\n }, [collapsed, rootRef]);\n\n return (\n <div\n className={classNames(\"section-title\", { sticky: stickyActive })}\n ref={ref}\n >\n <div className=\"section-label\" onClick={onToggle}>\n {title}\n <WrappedIcon lib=\"fa\" icon=\"angle-down\" />\n </div>\n {children}\n </div>\n );\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.sidebar{position:relative;z-index:2;width:260px;height:100%;background:rgba(246,247,249,0.5);border:1px solid rgba(255,255,255,0.3);border-radius:12px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);padding:23px 11px 0;display:flex;flex-direction:column;transition:transform 0.3s ease-in-out}.logo-bar{display:flex;align-items:center;justify-content:space-between;margin-bottom:30px;margin-left:4px}.main{flex:1;min-height:0;display:flex;flex-direction:column}.divider{border-top:1px solid rgba(0,0,0,0.06);margin:16px 0}.logo-link::part(link){display:block}.logo{vertical-align:middle}.new-chat::part(link){display:flex;gap:0;align-items:center;color:var(--elevo-color-brand);font-size:14px;text-align:left;cursor:pointer}.sidebar .new-chat::part(link){background:#f0f4ff;border-radius:8px;border:1px solid #c9d7ff;padding:9px 13px;font-weight:500;margin-bottom:16px}.sidebar .new-chat::part(link):hover{background:rgba(201,215,255,0.5)}.new-chat-icon{font-size:16px;margin-right:5px}.footer{border-top:1px solid rgba(0,0,0,0.04);padding:9px 12px;margin:0 -12px}.dropdown{display:block}.account{background:none;border:none;border-radius:8px;padding:6px 10px;display:block;width:100%;text-align:left;cursor:pointer}.account:hover{background:rgba(0,0,0,0.04)}.alternative{position:fixed;top:8px;left:8px;padding:6px 10px 6px 8px;display:flex;align-items:center;opacity:0;z-index:2;transition:opacity 0.2s ease-in-out;background:rgba(255,255,255,0);border-radius:8px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.alternative .new-chat::part(link){padding:4px;margin-left:16px;font-size:12px}.alternative .new-chat::part(link):hover{color:#7891ff}.alternative .new-chat::part(link):active{color:#0911b3}.container{width:270px;padding:10px 0 10px 10px;height:100%;transition:width 0.3s ease-in-out,padding 0.3s ease-in-out}.container.collapsed{width:0;padding:10px 0;overflow:visible}.container.collapsed .sidebar{transform:translateX(-100%)}.container.collapsed .alternative{opacity:1}:host([behavior=\"drawer\"]){z-index:2;width:0}:host(:not([behavior=\"drawer\"])) .alternative .new-chat{display:none}.mask{position:fixed;top:0;right:0;bottom:0;left:0}.link{display:block}.link + .link{margin-top:4px}.link::part(link){display:flex;gap:0;align-items:center;padding:7px 10px;border-radius:8px;color:#000}.link.active::part(link),.link::part(link):hover{background:rgba(0,0,0,0.04)}.link .icon{font-size:16px;margin-right:10px}.link .title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.history{flex:1;min-height:0;overflow-y:auto;margin:0 -12px;padding:0 12px}.history ul{list-style:none;margin:0;padding:0}.history .section + .section{margin-top:14px}.history .section-title{display:flex;align-items:center;justify-content:space-between;height:30px;margin-bottom:6px;padding:0 8px;position:sticky;top:0}.history .section-title.sticky::before{content:\"\";position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgb(229,228,234);border-radius:8px;z-index:-1}.history .section-label{display:flex;align-items:center;height:24px;padding:0 8px;margin-left:-8px;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;font-size:12px;color:#8c8c8c;border-radius:8px}.history .section-label eo-icon{vertical-align:middle;margin-left:6px;transition:transform 0.2s ease-in-out}.history .section-label:hover{background:rgba(0,0,0,0.04)}.history .collapsed > ul{display:none}.history .collapsed .section-label eo-icon{transform:rotate(-90deg)}.history .error,.history .loading{display:flex;align-items:center;height:36px;padding:0 8px}.history .loading{justify-content:center}.history .error{color:var(--color-error)}.history .group + .group{margin-top:15px}.history .group-title{font-weight:500;font-size:12px;color:#000;padding:8px;height:36px;line-height:20px}.history .item{display:block}.history .item::part(link){display:flex;align-items:center;padding:0 8px;height:36px;border-radius:8px;color:#000}.history .item.active::part(link){background:rgba(0,0,0,0.06)}.history .item.actions-active::part(link),.history .item::part(link):hover{background:rgba(0,0,0,0.04)}.history .item-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.history .actions{cursor:auto}.history .item:not(:hover):not(.actions-active) .actions{display:none}.history .working{width:8px;height:8px;border-radius:8px;background:var(--elevo-color-brand);margin:0 7px}.history .item.actions-active .working,.history .item:hover .working,.history .item.active .working{display:none}.history .load-more{display:flex;justify-content:center;align-items:center;height:36px}.button{display:flex}.space-links{margin-top:16px}.return-link{display:block}.return-link .heading{display:flex;flex-direction:column;align-items:flex-start;gap:4px;flex:1;min-width:0}.return-link .title,.return-link .sub-title{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.return-link .title{font-weight:500;font-size:18px}.return-link .sub-title{font-size:12px;color:#8c8c8c}.return-link .icon{font-size:16px;color:#8c8c8c}.return-link:not(:hover) .icon{display:none}.return-link::part(link){display:flex;align-items:center;justify-content:center;padding:6px 8px;border-radius:8px;color:#000}.return-link::part(link):hover{background:rgba(0,0,0,0.04)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","import { wrapBrick } from \"@next-core/react-element\";\nimport type {\n GeneralIcon,\n GeneralIconProps,\n} from \"@next-bricks/icons/general-icon\";\nimport type { Link, LinkProps } from \"@next-bricks/basic/link\";\nimport type {\n EoDropdownActions,\n DropdownActionsProps,\n DropdownActionsEvents,\n DropdownActionsEventsMapping,\n} from \"@next-bricks/basic/dropdown-actions\";\nimport type {\n EoEasyopsAvatar,\n EoEasyopsAvatarProps,\n} from \"@next-bricks/basic/easyops-avatar\";\nimport type {\n EoMiniActions,\n EoMiniActionsEvents,\n EoMiniActionsEventsMapping,\n EoMiniActionsProps,\n} from \"@next-bricks/basic/mini-actions\";\nimport type { IconButton, IconButtonProps } from \"../icon-button\";\n\nexport const WrappedIcon = wrapBrick<GeneralIcon, GeneralIconProps>(\"eo-icon\");\nexport const WrappedLink = wrapBrick<Link, LinkProps>(\"eo-link\");\nexport const WrappedDropdownActions = wrapBrick<\n EoDropdownActions,\n DropdownActionsProps & { themeVariant?: \"default\" | \"elevo\" },\n DropdownActionsEvents,\n DropdownActionsEventsMapping\n>(\"eo-dropdown-actions\", {\n onActionClick: \"action.click\",\n onVisibleChange: \"visible.change\",\n});\nexport const WrappedEasyopsAvatar = wrapBrick<\n EoEasyopsAvatar,\n EoEasyopsAvatarProps\n>(\"eo-easyops-avatar\");\nexport const WrappedMiniActions = wrapBrick<\n EoMiniActions,\n EoMiniActionsProps & { themeVariant?: \"default\" | \"elevo\" },\n EoMiniActionsEvents,\n EoMiniActionsEventsMapping\n>(\"eo-mini-actions\", {\n onActionClick: \"action.click\",\n onVisibleChange: \"visible.change\",\n});\nexport const WrappedIconButton = wrapBrick<IconButton, IconButtonProps>(\n \"ai-portal.icon-button\"\n);\n","import { http } from \"@next-core/http\";\n/**\n * @description 获取elevo项目列表\n * @endpoint list /api/v1/elevo/projects\n */\nexport const ElevoApi_getElevoProjects = async (params, options) => /**! @contract easyops.api.llm.elevo.GetElevoProjects@1.0.0 */(await http.get(\"api/gateway/logic.llm.aiops_service/api/v1/elevo/projects\", {\n ...options,\n params\n})).data;\n//# sourceMappingURL=getElevoProjects.js.map","import { http } from \"@next-core/http\";\n/**\n * @description 获取elevo会话列表\n * @endpoint GET /api/v1/elevo/conversations\n */\nexport const ElevoApi_listElevoConversations = async (params, options) => /**! @contract easyops.api.llm.elevo.ListElevoConversations@1.0.0 */(await http.get(\"api/gateway/logic.llm.aiops_service/api/v1/elevo/conversations\", {\n ...options,\n params\n})).data;\n//# sourceMappingURL=listElevoConversations.js.map","import React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport {\n ElevoApi_listElevoConversations,\n ElevoApi_getElevoProjects,\n type ElevoApi_ListElevoConversationsRequestParams,\n} from \"@next-api-sdk/llm-sdk\";\nimport type {\n ActionType,\n SimpleActionType,\n} from \"@next-bricks/basic/mini-actions\";\nimport { isEqual } from \"lodash\";\nimport { K, t } from \"./i18n.js\";\nimport {\n WrappedIcon,\n WrappedLink,\n WrappedMiniActions,\n WrappedIconButton,\n} from \"./bricks.js\";\nimport { DONE_STATES } from \"../shared/constants.js\";\nimport { parseTemplate } from \"../shared/parseTemplate.js\";\nimport type { ConversationState } from \"../shared/interfaces.js\";\nimport type { SidebarLink } from \"./interfaces.js\";\nimport { NavLink } from \"./NavLink.js\";\nimport { SectionTitle } from \"./SectionTitle.js\";\nimport { ADD_ICON } from \"./constants.js\";\n\nexport interface HistoryItem {\n conversationId: string;\n title: string;\n startTime: number;\n state?: ConversationState;\n}\n\nexport interface GroupedHistory {\n title: string;\n items: HistoryItem[];\n}\n\nexport interface ActionClickDetail {\n action: SimpleActionType & {\n project?: Project;\n };\n item: HistoryItem;\n project?: Project;\n}\n\nexport interface ProjectActionClickDetail {\n action: SimpleActionType;\n project: Project;\n}\n\nexport interface PersonalActionClickDetail {\n action: SimpleActionType;\n}\n\nexport interface Project {\n /** 实例ID */\n instanceId: string;\n /** 项目名称 */\n name: string;\n /** 项目描述 */\n description: string;\n /** 状态 */\n state: \"active\" | \"inactive\";\n /** 默认数字人ID */\n defaultAiEmployeeId: string;\n /** 创建者 */\n creator: string;\n /** 创建时间 */\n ctime: string;\n /** 修改时间 */\n mtime: string;\n /** 修改者 */\n modifier: string;\n}\n\nexport interface ChatHistoryProps {\n showProjects?: boolean;\n historyUrlTemplate?: string;\n historyActions?: ActionType[];\n projectUrlTemplate?: string;\n projectActions?: ActionType[];\n canAddProject?: boolean;\n myLinks?: SidebarLink[];\n onActionClick: (detail: ActionClickDetail) => void;\n onHistoryClick: () => void;\n onProjectActionClick: (detail: ProjectActionClickDetail) => void;\n onAddProject: () => void;\n}\n\nexport interface ChatHistoryRef {\n pull: () => void;\n removeProject?: (projectId: string) => void;\n addProject?: (project: Project) => void;\n moveConversation?: (conversationId: string) => void;\n}\n\nexport const ChatHistory = forwardRef(LowLevelChatHistory);\n\nexport function LowLevelChatHistory(\n {\n showProjects,\n historyActions,\n historyUrlTemplate,\n projectUrlTemplate,\n projectActions,\n canAddProject,\n myLinks,\n onActionClick,\n onHistoryClick,\n onProjectActionClick,\n onAddProject,\n }: ChatHistoryProps,\n ref: React.Ref<ChatHistoryRef>\n) {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [myCollapsed, setMyCollapsed] = useState(false);\n const [projects, setProjects] = useState<Project[] | null>(null);\n const [projectsCollapsed, setProjectsCollapsed] = useState(false);\n const [projectsError, setProjectsError] = useState(false);\n const [historyList, setHistoryList] = useState<HistoryItem[] | null>(null);\n const [historyCollapsed, setHistoryCollapsed] = useState(false);\n const [nextToken, setNextToken] = useState<string | undefined>();\n const [loadNextToken, setLoadNextToken] = useState<string | undefined>();\n const [historyError, setHistoryError] = useState(false);\n const initialRef = useRef(true);\n const [movedConversations, setMovedConversations] = useState<string[]>([]);\n\n const mergedHistoryActions = useMemo(\n () =>\n [\n ...(historyActions ?? []),\n {\n isDropdown: true,\n text: t(K.MOVE_TO_PROJECT),\n disabled: !projects?.length,\n items: projects?.map((project) => ({\n event: \"move\",\n key: project.instanceId,\n text: project.name,\n project,\n })),\n },\n ] as ActionType[],\n [historyActions, projects]\n );\n\n useEffect(() => {\n (async () => {\n try {\n const projects = await ElevoApi_getElevoProjects({\n page: 1,\n page_size: 3000,\n });\n setProjects(projects.list as Project[]);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Error loading projects:\", error);\n setProjectsError(true);\n setProjects([]);\n }\n })();\n }, []);\n\n useEffect(() => {\n Promise.all([\n ElevoApi_listElevoConversations(\n {\n token: loadNextToken,\n limit: 30,\n onlyOwner: true,\n onlyUnrelatedProject: true,\n } as ElevoApi_ListElevoConversationsRequestParams,\n {\n interceptorParams: {\n ignoreLoadingBar: true,\n },\n }\n ),\n ...(initialRef.current\n ? []\n : [\n new Promise((resolve) => setTimeout(resolve, 500)), // Force a minimum delay\n ]),\n ])\n .then(([data]) => {\n initialRef.current = false;\n setHistoryList((prev) => [\n ...(prev ?? []),\n ...(data.conversations as HistoryItem[]),\n ]);\n setNextToken(data.nextToken);\n })\n .catch((error) => {\n // eslint-disable-next-line no-console\n console.error(\"Error loading chat history:\", error);\n setHistoryList([]);\n setHistoryError(true);\n });\n }, [loadNextToken]);\n\n const [actionsVisible, setActionsVisible] = useState<string | null>(null);\n\n const nextRef = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n const next = nextRef.current;\n const root = rootRef.current;\n if (!next || !nextToken || !root || historyCollapsed) {\n return;\n }\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n setLoadNextToken(nextToken);\n }\n }\n },\n { root }\n );\n observer.observe(next);\n return () => {\n observer.disconnect();\n };\n }, [nextToken, historyCollapsed]);\n\n const pullIdRef = useRef(0);\n\n const pull = useCallback(async () => {\n try {\n const pullId = ++pullIdRef.current;\n const tempList = await ElevoApi_listElevoConversations(\n {\n limit: 30,\n onlyOwner: true,\n onlyUnrelatedProject: true,\n } as ElevoApi_ListElevoConversationsRequestParams,\n {\n interceptorParams: {\n ignoreLoadingBar: true,\n },\n }\n );\n if (pullId !== pullIdRef.current) {\n // Ignore this pull if a newer one has been triggered\n return;\n }\n setHistoryList((prev) => {\n const prevList = prev ?? [];\n const newList = tempList.conversations as HistoryItem[];\n const newIds = new Set(newList.map((item) => item.conversationId));\n const newItemsMap = new Map(\n newList.map((item) => [item.conversationId, item])\n );\n\n let foundIntersection = false;\n let foundChanged = false;\n let isFirst = true;\n for (const item of prevList) {\n const newItem = newItemsMap.get(item.conversationId);\n if (newItem) {\n foundIntersection = true;\n foundChanged =\n (isFirst && newItem !== newList[0]) || !isEqual(newItem, item);\n if (foundChanged) {\n break;\n }\n } else {\n break;\n }\n isFirst = false;\n }\n\n if (!foundIntersection) {\n setNextToken(tempList.nextToken);\n return newList;\n }\n\n if (foundChanged) {\n return [\n ...newList,\n ...prevList.filter((item) => !newIds.has(item.conversationId)),\n ];\n }\n\n return prev;\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Error pulling chat history:\", error);\n }\n }, []);\n\n useImperativeHandle(\n ref,\n () => ({\n pull,\n removeProject: (projectId: string) => {\n setProjects((prev) =>\n prev ? prev.filter((p) => p.instanceId !== projectId) : prev\n );\n },\n addProject: (project: Project) => {\n setProjects((prev) => (prev ? [...prev, project] : [project]));\n },\n moveConversation: (conversationId: string) => {\n setMovedConversations((prev) => [...prev, conversationId]);\n },\n }),\n [pull]\n );\n\n const filteredHistoryList = useMemo(() => {\n if (!historyList || !historyList.length) {\n return historyList;\n }\n return historyList.filter(\n (item) => !movedConversations.includes(item.conversationId)\n );\n }, [historyList, movedConversations]);\n\n return (\n <div className=\"history\" ref={rootRef}>\n {myLinks?.length ? (\n <div className={classNames(\"section\", { collapsed: myCollapsed })}>\n <SectionTitle\n rootRef={rootRef}\n title={t(K.MY)}\n collapsed={myCollapsed}\n onToggle={() => setMyCollapsed((prev) => !prev)}\n />\n <ul className=\"items\">\n {myLinks.map((link, index) => (\n <li key={index}>\n <NavLink\n url={link.url}\n activeIncludes={link.activeIncludes}\n render={({ active }) => (\n <WrappedLink\n className={classNames(\"item\", { active })}\n url={link.url}\n >\n <div className=\"item-title\">{link.title}</div>\n </WrappedLink>\n )}\n />\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n {showProjects && (\n <div\n className={classNames(\"section\", { collapsed: projectsCollapsed })}\n >\n <SectionTitle\n rootRef={rootRef}\n title={t(K.PROJECTS)}\n collapsed={projectsCollapsed}\n onToggle={() => setProjectsCollapsed((prev) => !prev)}\n >\n {canAddProject && (\n <WrappedIconButton\n icon={ADD_ICON}\n variant=\"mini-light\"\n tooltip={t(K.CREATE_PROJECT)}\n tooltipHoist={true}\n className=\"button\"\n onClick={onAddProject}\n />\n )}\n </SectionTitle>\n <ul className=\"items\">\n {projectsError ? (\n <li className=\"error\">Failed to load project</li>\n ) : projects ? (\n projects.map((project) => {\n const url = projectUrlTemplate\n ? parseTemplate(projectUrlTemplate, project)\n : undefined;\n return (\n <li key={project.instanceId}>\n <NavLink\n url={url}\n render={({ active }) => (\n <WrappedLink\n className={classNames(\"item\", {\n \"actions-active\":\n project.instanceId === actionsVisible,\n active,\n })}\n onClick={onHistoryClick}\n {...(url ? { url } : null)}\n >\n <div className=\"item-title\" title={project.name}>\n {project.name || t(K.UNNAMED)}\n </div>\n <WrappedMiniActions\n className=\"actions\"\n actions={projectActions}\n themeVariant=\"elevo\"\n onActionClick={(e) => {\n onProjectActionClick({\n action: e.detail,\n project,\n });\n }}\n onVisibleChange={(e) => {\n setActionsVisible(\n e.detail ? project.instanceId : null\n );\n }}\n />\n </WrappedLink>\n )}\n />\n </li>\n );\n })\n ) : (\n <li className=\"loading\">\n <WrappedIcon\n lib=\"antd\"\n theme=\"outlined\"\n icon=\"loading-3-quarters\"\n spinning\n />\n </li>\n )}\n </ul>\n </div>\n )}\n <div className={classNames(\"section\", { collapsed: historyCollapsed })}>\n <SectionTitle\n rootRef={rootRef}\n title={t(K.HISTORY)}\n collapsed={historyCollapsed}\n onToggle={() => setHistoryCollapsed((prev) => !prev)}\n />\n <ul className=\"items\">\n {filteredHistoryList ? (\n filteredHistoryList.map((item) => {\n const url = historyUrlTemplate\n ? parseTemplate(historyUrlTemplate, item)\n : undefined;\n return (\n <li key={item.conversationId}>\n <NavLink\n url={url}\n render={({ active }) => (\n <WrappedLink\n className={classNames(\"item\", {\n \"actions-active\":\n item.conversationId === actionsVisible,\n active,\n })}\n onClick={onHistoryClick}\n {...(historyUrlTemplate\n ? { url: parseTemplate(historyUrlTemplate, item) }\n : null)}\n >\n <div className=\"item-title\" title={item.title}>\n {item.title || t(K.UNTITLED)}\n </div>\n <WrappedMiniActions\n className=\"actions\"\n actions={mergedHistoryActions}\n onActionClick={(e) => {\n onActionClick({\n action: e.detail,\n item,\n project: (e.detail as { project?: Project })\n .project,\n });\n }}\n onVisibleChange={(e) => {\n setActionsVisible(\n e.detail ? item.conversationId : null\n );\n }}\n />\n {!DONE_STATES.includes(item.state!) && (\n <div className=\"working\"></div>\n )}\n </WrappedLink>\n )}\n />\n </li>\n );\n })\n ) : (\n <li className=\"loading\">\n <WrappedIcon\n lib=\"antd\"\n theme=\"outlined\"\n icon=\"loading-3-quarters\"\n spinning\n />\n </li>\n )}\n {historyError ? (\n <li className=\"error\">Failed to load chat history</li>\n ) : null}\n </ul>\n {!historyCollapsed && nextToken && (\n <div className=\"load-more\" ref={nextRef}>\n <WrappedIcon lib=\"antd\" icon=\"loading-3-quarters\" spinning />\n </div>\n )}\n </div>\n </div>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport { getHistory, matchPath } from \"@next-core/runtime\";\nimport type { Location } from \"history\";\n\nexport interface NavLinkProps {\n url?: string;\n activeIncludes?: string[];\n render: (props: { active: boolean }) => React.ReactElement;\n}\n\nexport function NavLink({ url, activeIncludes, render }: NavLinkProps) {\n const [active, setActive] = useState(false);\n\n useEffect(() => {\n function checkLinkActive(loc: Location) {\n if (!url) {\n setActive(false);\n return;\n }\n for (const path of [url, ...(activeIncludes ?? [])]) {\n const matched = matchPath(loc.pathname, { path, exact: false });\n if (matched) {\n setActive(true);\n return;\n }\n }\n setActive(false);\n }\n const history = getHistory();\n checkLinkActive(history.location);\n return history.listen(checkLinkActive);\n }, [url, activeIncludes]);\n\n return render({ active });\n}\n"],"names":["K","en","NEW_CHAT","LOGOUT","TODAY","YESTERDAY","PREVIOUS_7_DAYS","PREVIOUS_30_DAYS","SWITCH_LANGUAGE","MY","PROJECTS","HISTORY","CREATE_PROJECT","MOVE_TO_PROJECT","UNTITLED","UNNAMED","BUSINESS_OBJECTS","SERVICEFLOWS","COLLABORATION_SPACES","CREATE_SERVICEFLOW","zh","NS","locales","t","i18n","getFixedT","ADD_ICON","lib","icon","SpaceNav","_ref","returnUrl","spaceDetail","spaceObjects","spaceServiceflows","spaceLinks","onAddServiceflow","rootRef","useRef","objectsCollapsed","setObjectsCollapsed","useState","serviceflowsCollapsed","setServiceflowsCollapsed","React","WrappedLink","url","className","name","WrappedIcon","ref","length","classNames","collapsed","SectionTitle","title","onToggle","prev","map","obj","index","key","NavLink","activeIncludes","render","_ref2","active","WrappedIconButton","variant","tooltip","tooltipHoist","onClick","_ref3","link","_ref4","_extends","children","stickyActive","setStickyActive","useEffect","parent","current","element","sibling","nextElementSibling","onScroll","throttle","rect","getBoundingClientRect","diff","top","height","addEventListener","removeEventListener","sticky","___CSS_LOADER_EXPORT___","push","module","id","toString","wrapBrick","WrappedDropdownActions","onActionClick","onVisibleChange","WrappedEasyopsAvatar","WrappedMiniActions","ElevoApi_listElevoConversations","async","params","options","http","get","data","ChatHistory","forwardRef","LowLevelChatHistory","showProjects","historyActions","historyUrlTemplate","projectUrlTemplate","projectActions","canAddProject","myLinks","onHistoryClick","onProjectActionClick","onAddProject","myCollapsed","setMyCollapsed","projects","setProjects","projectsCollapsed","setProjectsCollapsed","projectsError","setProjectsError","historyList","setHistoryList","historyCollapsed","setHistoryCollapsed","nextToken","setNextToken","loadNextToken","setLoadNextToken","historyError","setHistoryError","initialRef","movedConversations","setMovedConversations","mergedHistoryActions","useMemo","isDropdown","text","disabled","items","project","event","instanceId","page","page_size","ElevoApi_getElevoProjects","list","error","console","Promise","all","token","limit","onlyOwner","onlyUnrelatedProject","interceptorParams","ignoreLoadingBar","resolve","setTimeout","then","conversations","catch","actionsVisible","setActionsVisible","nextRef","next","root","observer","IntersectionObserver","entries","entry","isIntersecting","observe","disconnect","pullIdRef","pull","useCallback","pullId","tempList","prevList","newList","newIds","Set","item","conversationId","newItemsMap","Map","foundIntersection","foundChanged","isFirst","newItem","isEqual","filter","has","useImperativeHandle","removeProject","projectId","p","addProject","moveConversation","filteredHistoryList","includes","parseTemplate","undefined","actions","themeVariant","e","action","detail","theme","spinning","_ref5","DONE_STATES","state","setActive","checkLinkActive","loc","path","matchPath","pathname","exact","history","getHistory","location","listen"],"sourceRoot":""}
|
|
File without changes
|