Skip to content

Commit e14a7e7

Browse files
added chat option in bottom panel
1 parent 2bb9ae8 commit e14a7e7

File tree

3 files changed

+75
-4
lines changed

3 files changed

+75
-4
lines changed

client/packages/lowcoder-design/src/icons/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import React, { lazy, Suspense } from "react";
22

3+
export { ReactComponent as AIGenerate } from "./remix/ai-generate.svg";
4+
export { ReactComponent as AIGenerate2 } from "./remix/ai-generate-2.svg";
5+
export { ReactComponent as AIGenerateText } from "./remix/ai-generate-text.svg";
36
export { ReactComponent as AppSnapshotIcon } from "./v1/app-snapshot.svg";
47
export { ReactComponent as ArchiveIcon } from "./remix/archive-fill.svg";
58
export { ReactComponent as HookCompDropIcon } from "./v1/hook-comp-drop.svg";

client/packages/lowcoder/src/pages/editor/bottom/BottomPanel.tsx

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ import { AppState } from "../../../redux/reducers";
99
import { getUser } from "../../../redux/selectors/usersSelectors";
1010
import { connect } from "react-redux";
1111
import { Layers } from "constants/Layers";
12+
import Flex from "antd/es/flex";
13+
import type { MenuProps } from 'antd/es/menu';
14+
import { BuildOutlined, DatabaseOutlined } from "@ant-design/icons";
15+
import Menu from "antd/es/menu/menu";
16+
import { ChatView } from "@lowcoder-ee/comps/comps/chatComp/chatView";
17+
import { AIGenerate } from "lowcoder-design";
18+
19+
type MenuItem = Required<MenuProps>['items'][number];
1220

1321
const StyledResizableBox = styled(ResizableBox)`
1422
position: relative;
@@ -26,6 +34,32 @@ const StyledResizableBox = styled(ResizableBox)`
2634
}
2735
`;
2836

37+
const StyledMenu = styled(Menu)`
38+
width: 40px;
39+
padding: 6px 0;
40+
41+
.ant-menu-item {
42+
height: 30px;
43+
line-height: 30px;
44+
}
45+
`;
46+
47+
const ChatHeader = styled.div`
48+
flex: 0 0 35px;
49+
padding: 0 16px;
50+
display: flex;
51+
align-items: center;
52+
justify-content: space-between;
53+
border-bottom: 1px solid #e1e3eb;
54+
background: #fafafa;
55+
`;
56+
const ChatTitle = styled.h3`
57+
margin: 0;
58+
font-size: 14px;
59+
font-weight: 500;
60+
color: #222222;
61+
`;
62+
2963
const preventDefault = (e: any) => {
3064
e.preventDefault();
3165
};
@@ -49,6 +83,12 @@ function Bottom(props: any) {
4983
};
5084

5185
const [bottomHeight, setBottomHeight] = useState(panelStyle.bottom.h);
86+
const [currentOption, setCurrentOption] = useState("data");
87+
88+
const items: MenuItem[] = [
89+
{ key: 'data', icon: <DatabaseOutlined />, label: 'Data Queries' },
90+
{ key: 'ai', icon: <AIGenerate />, label: 'Lowcoder AI' },
91+
];
5292

5393
return (
5494
<>
@@ -62,7 +102,34 @@ function Bottom(props: any) {
62102
onResizeStart={addListener}
63103
onResizeStop={resizeStop}
64104
>
65-
<BottomContent />
105+
<Flex style={{height: '100%'}}>
106+
<StyledMenu
107+
defaultSelectedKeys={[currentOption]}
108+
mode="inline"
109+
inlineCollapsed={true}
110+
items={items}
111+
onSelect={({key}) => {
112+
setCurrentOption(key);
113+
}}
114+
/>
115+
{ currentOption === "data" && <BottomContent /> }
116+
{ currentOption === "ai" && (
117+
<Flex style={{height: '100%', flex: 1}} vertical>
118+
<ChatHeader>
119+
<ChatTitle>Lowcoder AI Assistant</ChatTitle>
120+
</ChatHeader>
121+
<ChatView
122+
tableName="LC_AI"
123+
modelType="n8n"
124+
// streaming={true}
125+
// systemPrompt="You are a helpful assistant."
126+
// agent={true}
127+
// maxInteractions={10}
128+
modelHost="http://localhost:5678/webhook-test/9a363e76-d3a5-46d1-98c3-4359f7106d33"
129+
/>
130+
</Flex>
131+
)}
132+
</Flex>
66133
</StyledResizableBox>
67134
</>
68135
);

client/packages/lowcoder/src/pages/editor/bottom/BottomSidebar.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Contain = styled.div`
3434
width: 100%;
3535
background-color: #ffffff;
3636
`;
37-
const Title = styled.div`
37+
export const Title = styled.div`
3838
flex-shrink: 0;
3939
height: 40px;
4040
width: 100%;
@@ -82,16 +82,17 @@ const AddIcon = styled(BluePlusIcon)`
8282
width: 12px;
8383
margin-right: 2px;
8484
`;
85-
const AddBtn = styled(TacoButton)`
85+
export const AddBtn = styled(TacoButton)`
8686
&&& {
8787
height: 24px;
8888
width: 64px;
89-
padding: 4px 12px;
89+
padding: 4px 10px;
9090
background-color: #fafbff;
9191
color: #4965f2;
9292
border-color: #c9d1fc;
9393
display: flex;
9494
align-items: center;
95+
gap: 0;
9596
box-shadow: none;
9697
9798
&:hover {

0 commit comments

Comments
 (0)