balibabu
commited on
Commit
·
2b64e58
1
Parent(s):
15efcbe
Feat: add PromptManagement page #3221 (#3650)
Browse files### What problem does this PR solve?
Feat: add PromptManagement page #3221
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/package-lock.json +9 -0
- web/package.json +1 -0
- web/src/pages/profile-setting/components.tsx +5 -0
- web/src/pages/profile-setting/prompt/index.tsx +48 -0
- web/src/routes.ts +4 -0
- web/tailwind.config.js +1 -1
web/package-lock.json
CHANGED
@@ -27,6 +27,7 @@
|
|
27 |
"@radix-ui/react-switch": "^1.1.1",
|
28 |
"@radix-ui/react-tabs": "^1.1.1",
|
29 |
"@radix-ui/react-toast": "^1.2.2",
|
|
|
30 |
"@tanstack/react-query": "^5.40.0",
|
31 |
"@tanstack/react-query-devtools": "^5.51.5",
|
32 |
"@uiw/react-markdown-preview": "^5.1.3",
|
@@ -5532,6 +5533,14 @@
|
|
5532 |
"node": ">=6"
|
5533 |
}
|
5534 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5535 |
"node_modules/@tanstack/match-sorter-utils": {
|
5536 |
"version": "8.11.3",
|
5537 |
"resolved": "https://registry.npmmirror.com/@tanstack/match-sorter-utils/-/match-sorter-utils-8.11.3.tgz",
|
|
|
27 |
"@radix-ui/react-switch": "^1.1.1",
|
28 |
"@radix-ui/react-tabs": "^1.1.1",
|
29 |
"@radix-ui/react-toast": "^1.2.2",
|
30 |
+
"@tailwindcss/line-clamp": "^0.4.4",
|
31 |
"@tanstack/react-query": "^5.40.0",
|
32 |
"@tanstack/react-query-devtools": "^5.51.5",
|
33 |
"@uiw/react-markdown-preview": "^5.1.3",
|
|
|
5533 |
"node": ">=6"
|
5534 |
}
|
5535 |
},
|
5536 |
+
"node_modules/@tailwindcss/line-clamp": {
|
5537 |
+
"version": "0.4.4",
|
5538 |
+
"resolved": "https://registry.npmmirror.com/@tailwindcss/line-clamp/-/line-clamp-0.4.4.tgz",
|
5539 |
+
"integrity": "sha512-5U6SY5z8N42VtrCrKlsTAA35gy2VSyYtHWCsg1H87NU1SXnEfekTVlrga9fzUDrrHcGi2Lb5KenUWb4lRQT5/g==",
|
5540 |
+
"peerDependencies": {
|
5541 |
+
"tailwindcss": ">=2.0.0 || >=3.0.0 || >=3.0.0-alpha.1"
|
5542 |
+
}
|
5543 |
+
},
|
5544 |
"node_modules/@tanstack/match-sorter-utils": {
|
5545 |
"version": "8.11.3",
|
5546 |
"resolved": "https://registry.npmmirror.com/@tanstack/match-sorter-utils/-/match-sorter-utils-8.11.3.tgz",
|
web/package.json
CHANGED
@@ -38,6 +38,7 @@
|
|
38 |
"@radix-ui/react-switch": "^1.1.1",
|
39 |
"@radix-ui/react-tabs": "^1.1.1",
|
40 |
"@radix-ui/react-toast": "^1.2.2",
|
|
|
41 |
"@tanstack/react-query": "^5.40.0",
|
42 |
"@tanstack/react-query-devtools": "^5.51.5",
|
43 |
"@uiw/react-markdown-preview": "^5.1.3",
|
|
|
38 |
"@radix-ui/react-switch": "^1.1.1",
|
39 |
"@radix-ui/react-tabs": "^1.1.1",
|
40 |
"@radix-ui/react-toast": "^1.2.2",
|
41 |
+
"@tailwindcss/line-clamp": "^0.4.4",
|
42 |
"@tanstack/react-query": "^5.40.0",
|
43 |
"@tanstack/react-query-devtools": "^5.51.5",
|
44 |
"@uiw/react-markdown-preview": "^5.1.3",
|
web/src/pages/profile-setting/components.tsx
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { PropsWithChildren } from 'react';
|
2 |
+
|
3 |
+
export function Title({ children }: PropsWithChildren) {
|
4 |
+
return <span className="font-bold text-xl">{children}</span>;
|
5 |
+
}
|
web/src/pages/profile-setting/prompt/index.tsx
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Button } from '@/components/ui/button';
|
2 |
+
import { Card, CardContent } from '@/components/ui/card';
|
3 |
+
import { Plus, Trash2 } from 'lucide-react';
|
4 |
+
import { Title } from '../components';
|
5 |
+
|
6 |
+
const text = `You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, your answer must include the sentence "The answer you are looking for is not found in the knowledge base!" Answers need to consider chat history.
|
7 |
+
Here is the knowledge base:
|
8 |
+
{knowledge}
|
9 |
+
The above is the knowledge base.`;
|
10 |
+
|
11 |
+
const PromptManagement = () => {
|
12 |
+
const modelLibraryList = new Array(8).fill(1);
|
13 |
+
|
14 |
+
return (
|
15 |
+
<div className="p-8 ">
|
16 |
+
<div className="mx-auto">
|
17 |
+
<div className="flex justify-between items-center mb-8">
|
18 |
+
<h1 className="text-4xl font-bold">Prompt templates</h1>
|
19 |
+
<Button variant={'tertiary'} size={'sm'}>
|
20 |
+
<Plus className="mr-2 h-4 w-4" />
|
21 |
+
Create template
|
22 |
+
</Button>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
<div className="grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-4">
|
26 |
+
{modelLibraryList.map((x, idx) => (
|
27 |
+
<Card className="p-0" key={idx}>
|
28 |
+
<CardContent className="space-y-4 p-4">
|
29 |
+
<Title>Prompt name</Title>
|
30 |
+
<p className="line-clamp-3">{text}</p>
|
31 |
+
|
32 |
+
<div className="flex justify-end gap-2">
|
33 |
+
<Button size={'sm'} variant={'secondary'}>
|
34 |
+
<Trash2 />
|
35 |
+
</Button>
|
36 |
+
<Button variant={'outline'} size={'sm'}>
|
37 |
+
Edit
|
38 |
+
</Button>
|
39 |
+
</div>
|
40 |
+
</CardContent>
|
41 |
+
</Card>
|
42 |
+
))}
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
);
|
46 |
+
};
|
47 |
+
|
48 |
+
export default PromptManagement;
|
web/src/routes.ts
CHANGED
@@ -153,6 +153,10 @@ const routes = [
|
|
153 |
path: '/profile-setting/model',
|
154 |
component: '@/pages/profile-setting/model',
|
155 |
},
|
|
|
|
|
|
|
|
|
156 |
],
|
157 |
},
|
158 |
];
|
|
|
153 |
path: '/profile-setting/model',
|
154 |
component: '@/pages/profile-setting/model',
|
155 |
},
|
156 |
+
{
|
157 |
+
path: '/profile-setting/prompt',
|
158 |
+
component: '@/pages/profile-setting/prompt',
|
159 |
+
},
|
160 |
],
|
161 |
},
|
162 |
];
|
web/tailwind.config.js
CHANGED
@@ -177,5 +177,5 @@ module.exports = {
|
|
177 |
},
|
178 |
},
|
179 |
},
|
180 |
-
plugins: [require('tailwindcss-animate')],
|
181 |
};
|
|
|
177 |
},
|
178 |
},
|
179 |
},
|
180 |
+
plugins: [require('tailwindcss-animate'), require('@tailwindcss/line-clamp')],
|
181 |
};
|