@nextclaw/ui 0.2.4 → 0.2.5
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/CHANGELOG.md +6 -0
- package/dist/assets/index-BV3Gyu8h.js +225 -0
- package/dist/assets/index-iSLahgqA.css +1 -0
- package/dist/index.html +2 -2
- package/dist/logos/aihubmix.png +0 -0
- package/dist/logos/anthropic.svg +1 -0
- package/dist/logos/dashscope.png +0 -0
- package/dist/logos/deepseek.png +0 -0
- package/dist/logos/dingtalk.svg +1 -0
- package/dist/logos/discord.svg +1 -0
- package/dist/logos/email.svg +1 -0
- package/dist/logos/feishu.svg +12 -0
- package/dist/logos/gemini.svg +1 -0
- package/dist/logos/groq.svg +1 -0
- package/dist/logos/minimax.svg +1 -0
- package/dist/logos/mochat.svg +6 -0
- package/dist/logos/moonshot.png +0 -0
- package/dist/logos/openai.svg +1 -0
- package/dist/logos/openrouter.svg +1 -0
- package/dist/logos/qq.svg +1 -0
- package/dist/logos/slack.svg +1 -0
- package/dist/logos/telegram.svg +1 -0
- package/dist/logos/vllm.svg +1 -0
- package/dist/logos/whatsapp.svg +1 -0
- package/dist/logos/zhipu.svg +15 -0
- package/package.json +1 -1
- package/public/logos/aihubmix.png +0 -0
- package/public/logos/anthropic.svg +1 -0
- package/public/logos/dashscope.png +0 -0
- package/public/logos/deepseek.png +0 -0
- package/public/logos/dingtalk.svg +1 -0
- package/public/logos/discord.svg +1 -0
- package/public/logos/email.svg +1 -0
- package/public/logos/feishu.svg +12 -0
- package/public/logos/gemini.svg +1 -0
- package/public/logos/groq.svg +1 -0
- package/public/logos/minimax.svg +1 -0
- package/public/logos/mochat.svg +6 -0
- package/public/logos/moonshot.png +0 -0
- package/public/logos/openai.svg +1 -0
- package/public/logos/openrouter.svg +1 -0
- package/public/logos/qq.svg +1 -0
- package/public/logos/slack.svg +1 -0
- package/public/logos/telegram.svg +1 -0
- package/public/logos/vllm.svg +1 -0
- package/public/logos/whatsapp.svg +1 -0
- package/public/logos/zhipu.svg +15 -0
- package/src/App.tsx +0 -3
- package/src/api/config.ts +0 -19
- package/src/api/types.ts +0 -8
- package/src/components/common/LogoBadge.tsx +35 -0
- package/src/components/common/StatusBadge.tsx +4 -4
- package/src/components/config/ChannelForm.tsx +16 -18
- package/src/components/config/ChannelsList.tsx +87 -37
- package/src/components/config/ModelConfig.tsx +25 -25
- package/src/components/config/ProviderForm.tsx +9 -11
- package/src/components/config/ProvidersList.tsx +90 -38
- package/src/components/layout/Header.tsx +7 -7
- package/src/components/layout/Sidebar.tsx +10 -23
- package/src/components/ui/HighlightCard.tsx +29 -29
- package/src/components/ui/button.tsx +13 -8
- package/src/components/ui/card.tsx +8 -7
- package/src/components/ui/dialog.tsx +8 -8
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/switch.tsx +3 -3
- package/src/components/ui/tabs-custom.tsx +6 -6
- package/src/components/ui/tabs.tsx +7 -6
- package/src/hooks/useConfig.ts +2 -29
- package/src/index.css +103 -56
- package/src/lib/i18n.ts +3 -6
- package/src/lib/logos.ts +42 -0
- package/src/stores/ui.store.ts +1 -1
- package/src/styles/design-system.css +248 -0
- package/tailwind.config.js +118 -10
- package/dist/assets/index-C4OKhpdC.css +0 -1
- package/dist/assets/index-C8nOCIVG.js +0 -240
- package/src/components/config/UiConfig.tsx +0 -189
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import { useConfig, useUpdateUiConfig, useReloadConfig } from '@/hooks/useConfig';
|
|
3
|
-
import { Button } from '@/components/ui/button';
|
|
4
|
-
import { Input } from '@/components/ui/input';
|
|
5
|
-
import { Label } from '@/components/ui/label';
|
|
6
|
-
import { Switch } from '@/components/ui/switch';
|
|
7
|
-
import { Card, CardContent, CardTitle, CardDescription } from '@/components/ui/card';
|
|
8
|
-
import { Skeleton } from '@/components/ui/skeleton';
|
|
9
|
-
import { RefreshCw, Save, Monitor, Power } from 'lucide-react';
|
|
10
|
-
import { cn } from '@/lib/utils';
|
|
11
|
-
import { t } from '@/lib/i18n';
|
|
12
|
-
|
|
13
|
-
export function UiConfig() {
|
|
14
|
-
const { data: config, isLoading } = useConfig();
|
|
15
|
-
const updateUiConfig = useUpdateUiConfig();
|
|
16
|
-
const reloadConfig = useReloadConfig();
|
|
17
|
-
|
|
18
|
-
const [enabled, setEnabled] = useState(false);
|
|
19
|
-
const [host, setHost] = useState('127.0.0.1');
|
|
20
|
-
const [port, setPort] = useState(18791);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (config?.ui) {
|
|
24
|
-
setEnabled(config.ui.enabled);
|
|
25
|
-
setHost(config.ui.host);
|
|
26
|
-
setPort(config.ui.port);
|
|
27
|
-
}
|
|
28
|
-
}, [config]);
|
|
29
|
-
|
|
30
|
-
const handleSubmit = (e: React.FormEvent) => {
|
|
31
|
-
e.preventDefault();
|
|
32
|
-
updateUiConfig.mutate({ enabled, host, port, open: true });
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleReload = () => {
|
|
36
|
-
reloadConfig.mutate();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
if (isLoading) {
|
|
40
|
-
return (
|
|
41
|
-
<div className="max-w-2xl space-y-6">
|
|
42
|
-
<div className="space-y-2">
|
|
43
|
-
<Skeleton className="h-8 w-32" />
|
|
44
|
-
<Skeleton className="h-4 w-48" />
|
|
45
|
-
</div>
|
|
46
|
-
<Card className="rounded-2xl border-[hsl(40,20%,90%)] p-6">
|
|
47
|
-
<div className="flex items-center gap-4 mb-6">
|
|
48
|
-
<Skeleton className="h-12 w-12 rounded-xl" />
|
|
49
|
-
<div className="space-y-2">
|
|
50
|
-
<Skeleton className="h-5 w-28" />
|
|
51
|
-
<Skeleton className="h-3 w-36" />
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
<Skeleton className="h-16 w-full rounded-xl mb-4" />
|
|
55
|
-
<div className="grid grid-cols-2 gap-4">
|
|
56
|
-
<div>
|
|
57
|
-
<Skeleton className="h-4 w-16 mb-2" />
|
|
58
|
-
<Skeleton className="h-10 w-full rounded-xl" />
|
|
59
|
-
</div>
|
|
60
|
-
<div>
|
|
61
|
-
<Skeleton className="h-4 w-12 mb-2" />
|
|
62
|
-
<Skeleton className="h-10 w-full rounded-xl" />
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</Card>
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<div className="max-w-2xl space-y-6">
|
|
72
|
-
{/* Header */}
|
|
73
|
-
<div>
|
|
74
|
-
<h2 className="text-xl font-semibold text-[hsl(30,20%,12%)]">{t('uiConfig')}</h2>
|
|
75
|
-
<p className="text-sm text-[hsl(30,8%,45%)] mt-1">Configure Web UI server and access options</p>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<Card className="rounded-2xl border-[hsl(40,20%,90%)] bg-white">
|
|
79
|
-
<CardContent className="p-6">
|
|
80
|
-
<div className="flex items-center gap-4 mb-6">
|
|
81
|
-
<div className="h-12 w-12 rounded-xl bg-gradient-to-br from-purple-400 to-indigo-500 flex items-center justify-center">
|
|
82
|
-
<Monitor className="h-5 w-5 text-white" />
|
|
83
|
-
</div>
|
|
84
|
-
<div>
|
|
85
|
-
<CardTitle className="text-base font-semibold text-[hsl(30,20%,12%)]">Web UI Server</CardTitle>
|
|
86
|
-
<CardDescription className="text-xs text-[hsl(30,8%,45%)]">Configure server runtime parameters</CardDescription>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
<form onSubmit={handleSubmit} className="space-y-6">
|
|
91
|
-
<div className={cn(
|
|
92
|
-
"flex items-center justify-between p-4 rounded-xl transition-colors",
|
|
93
|
-
enabled ? "bg-emerald-50" : "bg-[hsl(40,20%,96%)]"
|
|
94
|
-
)}>
|
|
95
|
-
<div className="flex items-center gap-3">
|
|
96
|
-
<div className={cn(
|
|
97
|
-
"h-10 w-10 rounded-lg flex items-center justify-center",
|
|
98
|
-
enabled ? "bg-emerald-100 text-emerald-600" : "bg-[hsl(40,20%,94%)] text-[hsl(30,8%,45%)]"
|
|
99
|
-
)}>
|
|
100
|
-
<Power className="h-5 w-5" />
|
|
101
|
-
</div>
|
|
102
|
-
<div>
|
|
103
|
-
<h3 className="font-medium text-[hsl(30,20%,12%)]">Enable Web UI</h3>
|
|
104
|
-
<p className={cn(
|
|
105
|
-
"text-xs",
|
|
106
|
-
enabled ? "text-emerald-600" : "text-[hsl(30,8%,45%)]"
|
|
107
|
-
)}>
|
|
108
|
-
{enabled ? t('connected') : t('disconnected')}
|
|
109
|
-
</p>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
<Switch
|
|
113
|
-
id="enabled"
|
|
114
|
-
checked={enabled}
|
|
115
|
-
onCheckedChange={setEnabled}
|
|
116
|
-
className="data-[state=checked]:bg-emerald-500"
|
|
117
|
-
/>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div className="grid grid-cols-2 gap-4">
|
|
121
|
-
<div className="space-y-2">
|
|
122
|
-
<Label htmlFor="host" className="text-sm font-medium text-[hsl(30,20%,12%)]">{t('host')}</Label>
|
|
123
|
-
<Input
|
|
124
|
-
id="host"
|
|
125
|
-
type="text"
|
|
126
|
-
value={host}
|
|
127
|
-
onChange={(e) => setHost(e.target.value)}
|
|
128
|
-
placeholder="127.0.0.1"
|
|
129
|
-
className="rounded-xl border-[hsl(40,20%,90%)] bg-[hsl(40,20%,98%)] focus:bg-white"
|
|
130
|
-
/>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
<div className="space-y-2">
|
|
134
|
-
<Label htmlFor="port" className="text-sm font-medium text-[hsl(30,20%,12%)]">{t('port')}</Label>
|
|
135
|
-
<Input
|
|
136
|
-
id="port"
|
|
137
|
-
type="number"
|
|
138
|
-
value={port}
|
|
139
|
-
onChange={(e) => setPort(parseInt(e.target.value) || 18791)}
|
|
140
|
-
placeholder="18791"
|
|
141
|
-
min="1"
|
|
142
|
-
max="65535"
|
|
143
|
-
className="rounded-xl border-[hsl(40,20%,90%)] bg-[hsl(40,20%,98%)] focus:bg-white"
|
|
144
|
-
/>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<div className="flex justify-end">
|
|
149
|
-
<Button
|
|
150
|
-
type="submit"
|
|
151
|
-
disabled={updateUiConfig.isPending}
|
|
152
|
-
className="gap-2 rounded-xl bg-gradient-to-r from-orange-400 to-amber-500 hover:from-orange-500 hover:to-amber-600 text-white border-0"
|
|
153
|
-
>
|
|
154
|
-
<Save className="h-4 w-4" />
|
|
155
|
-
{t('save')}
|
|
156
|
-
</Button>
|
|
157
|
-
</div>
|
|
158
|
-
</form>
|
|
159
|
-
</CardContent>
|
|
160
|
-
</Card>
|
|
161
|
-
|
|
162
|
-
<Card className="rounded-2xl border-[hsl(40,20%,90%)] bg-white">
|
|
163
|
-
<CardContent className="p-6">
|
|
164
|
-
<div className="flex items-center gap-4 mb-6">
|
|
165
|
-
<div className="h-12 w-12 rounded-xl bg-gradient-to-br from-slate-400 to-gray-500 flex items-center justify-center">
|
|
166
|
-
<RefreshCw className="h-5 w-5 text-white" />
|
|
167
|
-
</div>
|
|
168
|
-
<div>
|
|
169
|
-
<CardTitle className="text-base font-semibold text-[hsl(30,20%,12%)]">{t('reloadConfig')}</CardTitle>
|
|
170
|
-
<CardDescription className="text-xs text-[hsl(30,8%,45%)]">Apply changes and restart services</CardDescription>
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
<p className="text-sm text-[hsl(30,8%,45%)] mb-4">
|
|
174
|
-
Click the button below to reload the configuration file and apply all changes.
|
|
175
|
-
</p>
|
|
176
|
-
<Button
|
|
177
|
-
variant="outline"
|
|
178
|
-
onClick={handleReload}
|
|
179
|
-
disabled={reloadConfig.isPending}
|
|
180
|
-
className="w-full gap-2 rounded-xl border-[hsl(40,20%,90%)] bg-[hsl(40,20%,98%)] hover:bg-[hsl(40,20%,94%)] text-[hsl(30,10%,35%)]"
|
|
181
|
-
>
|
|
182
|
-
<RefreshCw className="h-4 w-4" />
|
|
183
|
-
{t('reloadConfig')}
|
|
184
|
-
</Button>
|
|
185
|
-
</CardContent>
|
|
186
|
-
</Card>
|
|
187
|
-
</div>
|
|
188
|
-
);
|
|
189
|
-
}
|