mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: plugin setting
This commit is contained in:
parent
fd709ff6d4
commit
7990b6de64
@ -11,6 +11,7 @@ import { BlockCreateDto } from '@/chat/dto/block.dto';
|
|||||||
import { Block } from '@/chat/schemas/block.schema';
|
import { Block } from '@/chat/schemas/block.schema';
|
||||||
import { Conversation } from '@/chat/schemas/conversation.schema';
|
import { Conversation } from '@/chat/schemas/conversation.schema';
|
||||||
import { SettingCreateDto } from '@/setting/dto/setting.dto';
|
import { SettingCreateDto } from '@/setting/dto/setting.dto';
|
||||||
|
import { SettingType } from '@/setting/schemas/types';
|
||||||
|
|
||||||
export type PluginName = `${string}-plugin`;
|
export type PluginName = `${string}-plugin`;
|
||||||
|
|
||||||
@ -23,7 +24,21 @@ export interface CustomBlocks {}
|
|||||||
|
|
||||||
type BlockAttrs = Partial<BlockCreateDto> & { name: string };
|
type BlockAttrs = Partial<BlockCreateDto> & { name: string };
|
||||||
|
|
||||||
export type PluginSetting = Omit<SettingCreateDto, 'weight'>;
|
type EnforceTranslatable<T extends SettingType> = T extends
|
||||||
|
| 'text'
|
||||||
|
| 'multiple_text'
|
||||||
|
? { translatable: boolean }
|
||||||
|
: { translatable: boolean };
|
||||||
|
|
||||||
|
export type SettingCreateDtoStrict<
|
||||||
|
T extends SettingType,
|
||||||
|
S extends SettingCreateDto,
|
||||||
|
> = S & EnforceTranslatable<T>;
|
||||||
|
|
||||||
|
export type PluginSetting = Omit<
|
||||||
|
SettingCreateDtoStrict<SettingType, SettingCreateDto>,
|
||||||
|
'weight'
|
||||||
|
>;
|
||||||
|
|
||||||
export type PluginBlockTemplate = Omit<
|
export type PluginBlockTemplate = Omit<
|
||||||
BlockAttrs,
|
BlockAttrs,
|
||||||
|
Loading…
Reference in New Issue
Block a user