Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/sdcb/chats into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Dec 5, 2024
2 parents 0aed864 + d1f82f7 commit 4b1a522
Show file tree
Hide file tree
Showing 26 changed files with 317 additions and 292 deletions.
12 changes: 6 additions & 6 deletions src/FE/components/Admin/Messages/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ export const ChatMessage: FC<Props> = memo(
}
}}
>
<IconChevronLeft stroke="#7d7d7d" />
<IconChevronLeft />
</Button>
<span className="font-bold text-[#7d7d7d]">
<span className="font-bold">
{`${currentSelectIndex + 1}/${parentChildrenIds.length
}`}
</span>
Expand All @@ -155,7 +155,7 @@ export const ChatMessage: FC<Props> = memo(
}
}}
>
<IconChevronRight stroke="#7d7d7d" />
<IconChevronRight />
</Button>
</div>
)}
Expand Down Expand Up @@ -243,9 +243,9 @@ export const ChatMessage: FC<Props> = memo(
}
}}
>
<IconChevronLeft stroke="#7d7d7d" />
<IconChevronLeft />
</Button>
<span className="font-bold text-[#7d7d7d]">
<span className="font-bold">
{`${assistantCurrentSelectIndex + 1}/${assistantChildrenIds.length
}`}
</span>
Expand All @@ -263,7 +263,7 @@ export const ChatMessage: FC<Props> = memo(
}
}}
>
<IconChevronRight stroke="#7d7d7d" />
<IconChevronRight />
</Button>
</div>
)}
Expand Down
314 changes: 149 additions & 165 deletions src/FE/components/Admin/Models/EditModelModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,190 +157,174 @@ export const EditModelModal = (props: IProps) => {
<DialogHeader>
<DialogTitle>{t('Edit Model')}</DialogTitle>
</DialogHeader>
{loading ? (
<div className="flex flex-col space-y-3">
<Skeleton className="h-[125px] w-full rounded-xl" />
<div className="space-y-2">
<Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-[90%]" />
</div>
</div>
) : (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div className="grid grid-cols-2 gap-4">
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<div className="grid grid-cols-2 gap-4">
<FormField
key="name"
control={form.control}
name="name"
render={({ field }) => {
return (
<FormInput field={field} label={t('Model Display Name')!} />
);
}}
></FormField>
<div className="flex justify-between">
<FormField
key="name"
key="modelKeyId"
control={form.control}
name="name"
name="modelKeyId"
render={({ field }) => {
return (
<FormInput
<FormSelect
className="w-full"
field={field}
label={t('Model Display Name')!}
label={t('Model Keys')!}
items={modelKeys
.filter(
(x) =>
x.modelProviderId === selected.modelProviderId,
)
.map((keys) => ({
name: keys.name,
value: keys.id.toString(),
}))}
/>
);
}}
></FormField>
<div className="flex justify-between">
<FormField
key="modelKeyId"
control={form.control}
name="modelKeyId"
render={({ field }) => {
return (
<FormSelect
className="w-full"
field={field}
label={t('Model Keys')!}
items={modelKeys
.filter(
(x) =>
x.modelProviderId === selected.modelProviderId,
)
.map((keys) => ({
name: keys.name,
value: keys.id.toString(),
}))}
/>
);
}}
></FormField>
<div
hidden={!form.getValues('modelKeyId')}
className="text-sm mt-12 w-36 text-right"
>
<Popover>
<PopoverTrigger>
<span className="text-primary">
{t('Click View Configs')}
</span>
</PopoverTrigger>
<PopoverContent className="w-full">
{JSON.stringify(
modelKeys
.find(
(x) =>
x.id ===
parseInt(form.getValues('modelKeyId')!),
)
?.toConfigs(),
null,
2,
)}
</PopoverContent>
</Popover>
</div>
<div
hidden={!form.getValues('modelKeyId')}
className="text-sm mt-12 w-36 text-right"
>
<Popover>
<PopoverTrigger>
<span className="text-primary">
{t('Click View Configs')}
</span>
</PopoverTrigger>
<PopoverContent className="w-full">
{JSON.stringify(
modelKeys
.find(
(x) =>
x.id === parseInt(form.getValues('modelKeyId')!),
)
?.toConfigs(),
null,
2,
)}
</PopoverContent>
</Popover>
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<FormField
key="modelReferenceName"
control={form.control}
name="modelReferenceName"
render={({ field }) => {
return (
<FormInput
disabled
field={field}
label={t('Model Version')!}
/>
);
}}
></FormField>
<FormField
key="deploymentName"
control={form.control}
name="deploymentName"
render={({ field }) => {
return (
<FormInput label={t('Deployment Name')!} field={field} />
);
}}
></FormField>
</div>
<div className="grid grid-cols-2 gap-4">
<FormField
key="inputPrice1M"
control={form.control}
name="inputPrice1M"
render={({ field }) => {
return (
<FormInput
type="number"
label={`${t('1M input tokens price')}(${t('Yuan')})`}
field={field}
/>
);
}}
></FormField>
<FormField
key="outputPrice1M"
control={form.control}
name="outputPrice1M"
render={({ field }) => {
return (
<FormInput
type="number"
label={`1M ${t('1M output tokens price')}(${t(
'Yuan',
)})`}
field={field}
/>
);
}}
></FormField>
</div>
<div>
</div>
<div className="grid grid-cols-2 gap-4">
<FormField
key="modelReferenceName"
control={form.control}
name="modelReferenceName"
render={({ field }) => {
return (
<FormInput
disabled
field={field}
label={t('Model Version')!}
/>
);
}}
></FormField>
<FormField
key="deploymentName"
control={form.control}
name="deploymentName"
render={({ field }) => {
return (
<FormInput label={t('Deployment Name')!} field={field} />
);
}}
></FormField>
</div>
<div className="grid grid-cols-2 gap-4">
<FormField
key="inputPrice1M"
control={form.control}
name="inputPrice1M"
render={({ field }) => {
return (
<FormInput
type="number"
label={`${t('1M input tokens price')}(${t('Yuan')})`}
field={field}
/>
);
}}
></FormField>
<FormField
key="outputPrice1M"
control={form.control}
name="outputPrice1M"
render={({ field }) => {
return (
<FormInput
type="number"
label={`1M ${t('1M output tokens price')}(${t('Yuan')})`}
field={field}
/>
);
}}
></FormField>
</div>
<div>
<FormField
key="fileServiceId"
control={form.control}
name="fileServiceId"
render={({ field }) => {
return (
<FormSelect
field={field}
label={t('File Service Type')!}
hidden={!selected.allowVision}
items={fileServices.map((item) => ({
name: item.name,
value: item.id.toString(),
}))}
/>
);
}}
></FormField>
</div>
<div className="grid grid-cols-2 gap-4">
<div className="flex gap-4">
<FormField
key="fileServiceId"
key={'enabled'}
control={form.control}
name="fileServiceId"
name={'enabled'}
render={({ field }) => {
return (
<FormSelect
field={field}
label={t('File Service Type')!}
hidden={!selected.allowVision}
items={fileServices.map((item) => ({
name: item.name,
value: item.id.toString(),
}))}
/>
<FormSwitch label={t('Is it enabled')!} field={field} />
);
}}
></FormField>
</div>
<div className="grid grid-cols-2 gap-4">
<div className="flex gap-4">
<FormField
key={'enabled'}
control={form.control}
name={'enabled'}
render={({ field }) => {
return (
<FormSwitch label={t('Is it enabled')!} field={field} />
);
}}
></FormField>
</div>
</div>
<DialogFooter className="pt-4">
<Button
type="button"
variant="destructive"
onClick={(e) => {
onDelete();
e.preventDefault();
}}
>
{t('Delete')}
</Button>
<Button type="submit">{t('Save')}</Button>
</DialogFooter>
</form>
</Form>
)}
</div>
<DialogFooter className="pt-4">
<Button
type="button"
variant="destructive"
onClick={(e) => {
onDelete();
e.preventDefault();
}}
>
{t('Delete')}
</Button>
<Button type="submit">{t('Save')}</Button>
</DialogFooter>
</form>
</Form>
</DialogContent>
</Dialog>
);
Expand Down
4 changes: 2 additions & 2 deletions src/FE/components/Button/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export default function CopyButton(props: Props) {
title={t('Copy')}
>
{isCopied ? (
<IconCheck stroke={'#7d7d7d'} size={18} />
<IconCheck size={18} />
) : (
<IconClipboard stroke={'#7d7d7d'} size={18} />
<IconClipboard size={18} />
)}
</Button>
);
Expand Down
Loading

0 comments on commit 4b1a522

Please sign in to comment.