balibabu commited on
Commit
6cc09f7
·
1 Parent(s): f28ed6a

Feat: Add ModelManagement page #3221 (#3638)

Browse files

### What problem does this PR solve?

Feat: Add ModelManagement page #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

web/src/components/ui/button.tsx CHANGED
@@ -13,7 +13,7 @@ const buttonVariants = cva(
13
  destructive:
14
  'bg-destructive text-destructive-foreground hover:bg-destructive/90',
15
  outline:
16
- 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
17
  secondary:
18
  'bg-secondary text-secondary-foreground hover:bg-secondary/80',
19
  ghost: 'hover:bg-accent hover:text-accent-foreground',
 
13
  destructive:
14
  'bg-destructive text-destructive-foreground hover:bg-destructive/90',
15
  outline:
16
+ 'border border-colors-outline-sentiment-primary bg-background hover:bg-accent hover:text-accent-foreground',
17
  secondary:
18
  'bg-secondary text-secondary-foreground hover:bg-secondary/80',
19
  ghost: 'hover:bg-accent hover:text-accent-foreground',
web/src/pages/profile-setting/model/index.tsx ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Button } from '@/components/ui/button';
2
+ import { Input } from '@/components/ui/input';
3
+ import {
4
+ AddModelCard,
5
+ ModelLibraryCard,
6
+ SystemModelSetting,
7
+ } from './model-card';
8
+
9
+ const addedModelList = new Array(4).fill(1);
10
+
11
+ const modelLibraryList = new Array(4).fill(1);
12
+
13
+ export default function ModelManagement() {
14
+ return (
15
+ <section className="p-8 space-y-8">
16
+ <div className="flex justify-between items-center ">
17
+ <h1 className="text-4xl font-bold">Team management</h1>
18
+ <Button className="hover:bg-[#6B4FD8] text-white bg-colors-background-core-standard">
19
+ Unfinished
20
+ </Button>
21
+ </div>
22
+ <SystemModelSetting></SystemModelSetting>
23
+ <section>
24
+ <h2 className="text-2xl font-semibold mb-3">Added model</h2>
25
+ <div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-4 2xl:grid-cols-4 gap-4">
26
+ {addedModelList.map((x, idx) => (
27
+ <AddModelCard key={idx}></AddModelCard>
28
+ ))}
29
+ </div>
30
+ </section>
31
+ <section>
32
+ <div className="flex justify-between items-center mb-3">
33
+ <h2 className="text-2xl font-semibold ">Model library</h2>
34
+ <Input
35
+ placeholder="search"
36
+ className="bg-colors-background-inverse-weak w-1/5"
37
+ ></Input>
38
+ </div>
39
+ <div className="grid grid-cols-2 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-8 gap-4">
40
+ {modelLibraryList.map((x, idx) => (
41
+ <ModelLibraryCard key={idx}></ModelLibraryCard>
42
+ ))}
43
+ </div>
44
+ </section>
45
+ </section>
46
+ );
47
+ }
web/src/pages/profile-setting/model/model-card.tsx ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
2
+ import { Button } from '@/components/ui/button';
3
+ import { Card, CardContent } from '@/components/ui/card';
4
+ import {
5
+ Select,
6
+ SelectContent,
7
+ SelectItem,
8
+ SelectTrigger,
9
+ SelectValue,
10
+ } from '@/components/ui/select';
11
+ import { Key, MoreVertical, Plus, Trash2 } from 'lucide-react';
12
+ import { PropsWithChildren } from 'react';
13
+
14
+ const settings = [
15
+ {
16
+ title: 'GPT Model',
17
+ description:
18
+ 'The default chat LLM all the newly created knowledgebase will use.',
19
+ model: 'DeepseekChat',
20
+ },
21
+ {
22
+ title: 'Embedding Model',
23
+ description:
24
+ 'The default embedding model all the newly created knowledgebase will use.',
25
+ model: 'DeepseekChat',
26
+ },
27
+ {
28
+ title: 'Image Model',
29
+ description:
30
+ 'The default multi-capable model all the newly created knowledgebase will use. It can generate a picture or video.',
31
+ model: 'DeepseekChat',
32
+ },
33
+ {
34
+ title: 'Speech2TXT Model',
35
+ description:
36
+ 'The default ASR model all the newly created knowledgebase will use. Use this model to translate voices to text something text.',
37
+ model: 'DeepseekChat',
38
+ },
39
+ {
40
+ title: 'TTS Model',
41
+ description:
42
+ 'The default text to speech model all the newly created knowledgebase will use.',
43
+ model: 'DeepseekChat',
44
+ },
45
+ ];
46
+
47
+ function Title({ children }: PropsWithChildren) {
48
+ return <span className="font-bold text-xl">{children}</span>;
49
+ }
50
+
51
+ export function SystemModelSetting() {
52
+ return (
53
+ <Card>
54
+ <CardContent className="p-4 space-y-6">
55
+ {settings.map((x, idx) => (
56
+ <div key={idx} className="flex items-center">
57
+ <div className="flex-1 flex flex-col">
58
+ <span className="font-semibold text-base">{x.title}</span>
59
+ <span className="text-colors-text-neutral-standard">
60
+ {x.description}
61
+ </span>
62
+ </div>
63
+ <div className="flex-1">
64
+ <Select defaultValue="english">
65
+ <SelectTrigger className="bg-colors-background-inverse-weak">
66
+ <SelectValue />
67
+ </SelectTrigger>
68
+ <SelectContent>
69
+ <SelectItem value="english">English</SelectItem>
70
+ </SelectContent>
71
+ </Select>
72
+ </div>
73
+ </div>
74
+ ))}
75
+ </CardContent>
76
+ </Card>
77
+ );
78
+ }
79
+
80
+ export function AddModelCard() {
81
+ return (
82
+ <Card className="pt-4">
83
+ <CardContent className="space-y-4">
84
+ <div className="flex justify-between space-y-4">
85
+ <Avatar>
86
+ <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
87
+ <AvatarFallback>CN</AvatarFallback>
88
+ </Avatar>
89
+ <Button variant={'outline'}>Sub models</Button>
90
+ </div>
91
+ <Title>Deep seek</Title>
92
+ <p>LLM,TEXT EMBEDDING, SPEECH2TEXT, MODERATION</p>
93
+ <Card>
94
+ <CardContent className="p-3 flex gap-2">
95
+ <Button variant={'secondary'}>
96
+ deepseek-chat <Trash2 />
97
+ </Button>
98
+ <Button variant={'secondary'}>
99
+ deepseek-code <Trash2 />
100
+ </Button>
101
+ </CardContent>
102
+ </Card>
103
+ <div className="flex justify-end gap-2">
104
+ <Button variant="secondary" size="icon">
105
+ <MoreVertical className="h-4 w-4" />
106
+ </Button>
107
+ <Button variant={'tertiary'}>
108
+ <Key /> API
109
+ </Button>
110
+ </div>
111
+ </CardContent>
112
+ </Card>
113
+ );
114
+ }
115
+
116
+ export function ModelLibraryCard() {
117
+ return (
118
+ <Card className="pt-4">
119
+ <CardContent className="space-y-4">
120
+ <Avatar className="mb-4">
121
+ <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
122
+ <AvatarFallback>CN</AvatarFallback>
123
+ </Avatar>
124
+
125
+ <Title>Deep seek</Title>
126
+ <p>LLM,TEXT EMBEDDING, SPEECH2TEXT, MODERATION</p>
127
+
128
+ <div className="text-right">
129
+ <Button variant={'tertiary'}>
130
+ <Plus /> Add
131
+ </Button>
132
+ </div>
133
+ </CardContent>
134
+ </Card>
135
+ );
136
+ }
web/src/pages/profile-setting/team/index.tsx CHANGED
@@ -28,11 +28,11 @@ const TeamManagement = () => {
28
  };
29
 
30
  return (
31
- <div className="min-h-screen text-white p-8 ">
32
- <div className="max-w-6xl mx-auto">
33
  <div className="flex justify-between items-center mb-8">
34
  <h1 className="text-4xl font-bold">Team management</h1>
35
- <Button className="hover:bg-[#6B4FD8] text-white bg-colors-background-core-standard">
36
  <Plus className="mr-2 h-4 w-4" />
37
  Create team
38
  </Button>
 
28
  };
29
 
30
  return (
31
+ <div className="p-8 ">
32
+ <div className=" mx-auto">
33
  <div className="flex justify-between items-center mb-8">
34
  <h1 className="text-4xl font-bold">Team management</h1>
35
+ <Button variant={'tertiary'} size={'sm'}>
36
  <Plus className="mr-2 h-4 w-4" />
37
  Create team
38
  </Button>
web/src/routes.ts CHANGED
@@ -149,6 +149,10 @@ const routes = [
149
  path: '/profile-setting/plan',
150
  component: '@/pages/profile-setting/plan',
151
  },
 
 
 
 
152
  ],
153
  },
154
  ];
 
149
  path: '/profile-setting/plan',
150
  component: '@/pages/profile-setting/plan',
151
  },
152
+ {
153
+ path: '/profile-setting/model',
154
+ component: '@/pages/profile-setting/model',
155
+ },
156
  ],
157
  },
158
  ];