librechat-data-provider 0.7.78 → 0.7.81
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/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/package.json +2 -1
- package/specs/actions.spec.ts +238 -0
- package/specs/parsers.spec.ts +125 -0
- package/src/actions.ts +73 -19
- package/src/api-endpoints.ts +42 -10
- package/src/config.ts +28 -1
- package/src/createPayload.ts +13 -2
- package/src/data-service.ts +47 -69
- package/src/file-config.ts +3 -2
- package/src/index.ts +1 -0
- package/src/parsers.ts +45 -16
- package/src/permissions.ts +90 -0
- package/src/react-query/react-query-service.ts +5 -34
- package/src/roles.ts +72 -126
- package/src/schemas.ts +151 -178
- package/src/types/assistants.ts +16 -18
- package/src/types/mutations.ts +8 -2
- package/src/types/queries.ts +28 -13
- package/src/types.ts +10 -0
- package/src/zod.spec.ts +569 -1
- package/src/zod.ts +318 -9
package/src/roles.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
Permissions,
|
|
4
|
+
PermissionTypes,
|
|
5
|
+
permissionsSchema,
|
|
6
|
+
agentPermissionsSchema,
|
|
7
|
+
promptPermissionsSchema,
|
|
8
|
+
runCodePermissionsSchema,
|
|
9
|
+
bookmarkPermissionsSchema,
|
|
10
|
+
multiConvoPermissionsSchema,
|
|
11
|
+
temporaryChatPermissionsSchema,
|
|
12
|
+
} from './permissions';
|
|
2
13
|
|
|
3
14
|
/**
|
|
4
15
|
* Enum for System Defined Roles
|
|
@@ -14,153 +25,88 @@ export enum SystemRoles {
|
|
|
14
25
|
USER = 'USER',
|
|
15
26
|
}
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
* Enum for Permission Types
|
|
19
|
-
*/
|
|
20
|
-
export enum PermissionTypes {
|
|
21
|
-
/**
|
|
22
|
-
* Type for Prompt Permissions
|
|
23
|
-
*/
|
|
24
|
-
PROMPTS = 'PROMPTS',
|
|
25
|
-
/**
|
|
26
|
-
* Type for Bookmark Permissions
|
|
27
|
-
*/
|
|
28
|
-
BOOKMARKS = 'BOOKMARKS',
|
|
29
|
-
/**
|
|
30
|
-
* Type for Agent Permissions
|
|
31
|
-
*/
|
|
32
|
-
AGENTS = 'AGENTS',
|
|
33
|
-
/**
|
|
34
|
-
* Type for Multi-Conversation Permissions
|
|
35
|
-
*/
|
|
36
|
-
MULTI_CONVO = 'MULTI_CONVO',
|
|
37
|
-
/**
|
|
38
|
-
* Type for Temporary Chat
|
|
39
|
-
*/
|
|
40
|
-
TEMPORARY_CHAT = 'TEMPORARY_CHAT',
|
|
41
|
-
/**
|
|
42
|
-
* Type for using the "Run Code" LC Code Interpreter API feature
|
|
43
|
-
*/
|
|
44
|
-
RUN_CODE = 'RUN_CODE',
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Enum for Role-Based Access Control Constants
|
|
49
|
-
*/
|
|
50
|
-
export enum Permissions {
|
|
51
|
-
SHARED_GLOBAL = 'SHARED_GLOBAL',
|
|
52
|
-
USE = 'USE',
|
|
53
|
-
CREATE = 'CREATE',
|
|
54
|
-
UPDATE = 'UPDATE',
|
|
55
|
-
READ = 'READ',
|
|
56
|
-
READ_AUTHOR = 'READ_AUTHOR',
|
|
57
|
-
SHARE = 'SHARE',
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const promptPermissionsSchema = z.object({
|
|
61
|
-
[Permissions.SHARED_GLOBAL]: z.boolean().default(false),
|
|
62
|
-
[Permissions.USE]: z.boolean().default(true),
|
|
63
|
-
[Permissions.CREATE]: z.boolean().default(true),
|
|
64
|
-
// [Permissions.SHARE]: z.boolean().default(false),
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
export const bookmarkPermissionsSchema = z.object({
|
|
68
|
-
[Permissions.USE]: z.boolean().default(true),
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export const agentPermissionsSchema = z.object({
|
|
72
|
-
[Permissions.SHARED_GLOBAL]: z.boolean().default(false),
|
|
73
|
-
[Permissions.USE]: z.boolean().default(true),
|
|
74
|
-
[Permissions.CREATE]: z.boolean().default(true),
|
|
75
|
-
// [Permissions.SHARE]: z.boolean().default(false),
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
export const multiConvoPermissionsSchema = z.object({
|
|
79
|
-
[Permissions.USE]: z.boolean().default(true),
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
export const temporaryChatPermissionsSchema = z.object({
|
|
83
|
-
[Permissions.USE]: z.boolean().default(true),
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
export const runCodePermissionsSchema = z.object({
|
|
87
|
-
[Permissions.USE]: z.boolean().default(true),
|
|
88
|
-
});
|
|
89
|
-
|
|
28
|
+
// The role schema now only needs to reference the permissions schema.
|
|
90
29
|
export const roleSchema = z.object({
|
|
91
30
|
name: z.string(),
|
|
92
|
-
|
|
93
|
-
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema,
|
|
94
|
-
[PermissionTypes.AGENTS]: agentPermissionsSchema,
|
|
95
|
-
[PermissionTypes.MULTI_CONVO]: multiConvoPermissionsSchema,
|
|
96
|
-
[PermissionTypes.TEMPORARY_CHAT]: temporaryChatPermissionsSchema,
|
|
97
|
-
[PermissionTypes.RUN_CODE]: runCodePermissionsSchema,
|
|
31
|
+
permissions: permissionsSchema,
|
|
98
32
|
});
|
|
99
33
|
|
|
100
34
|
export type TRole = z.infer<typeof roleSchema>;
|
|
101
|
-
export type TAgentPermissions = z.infer<typeof agentPermissionsSchema>;
|
|
102
|
-
export type TPromptPermissions = z.infer<typeof promptPermissionsSchema>;
|
|
103
|
-
export type TBookmarkPermissions = z.infer<typeof bookmarkPermissionsSchema>;
|
|
104
|
-
export type TMultiConvoPermissions = z.infer<typeof multiConvoPermissionsSchema>;
|
|
105
|
-
export type TTemporaryChatPermissions = z.infer<typeof temporaryChatPermissionsSchema>;
|
|
106
|
-
export type TRunCodePermissions = z.infer<typeof runCodePermissionsSchema>;
|
|
107
35
|
|
|
36
|
+
// Define default roles using the new structure.
|
|
108
37
|
const defaultRolesSchema = z.object({
|
|
109
38
|
[SystemRoles.ADMIN]: roleSchema.extend({
|
|
110
39
|
name: z.literal(SystemRoles.ADMIN),
|
|
111
|
-
|
|
112
|
-
[
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
[
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
[
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
[
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
[
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
[
|
|
40
|
+
permissions: permissionsSchema.extend({
|
|
41
|
+
[PermissionTypes.PROMPTS]: promptPermissionsSchema.extend({
|
|
42
|
+
[Permissions.SHARED_GLOBAL]: z.boolean().default(true),
|
|
43
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
44
|
+
[Permissions.CREATE]: z.boolean().default(true),
|
|
45
|
+
// [Permissions.SHARE]: z.boolean().default(true),
|
|
46
|
+
}),
|
|
47
|
+
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema.extend({
|
|
48
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
49
|
+
}),
|
|
50
|
+
[PermissionTypes.AGENTS]: agentPermissionsSchema.extend({
|
|
51
|
+
[Permissions.SHARED_GLOBAL]: z.boolean().default(true),
|
|
52
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
53
|
+
[Permissions.CREATE]: z.boolean().default(true),
|
|
54
|
+
// [Permissions.SHARE]: z.boolean().default(true),
|
|
55
|
+
}),
|
|
56
|
+
[PermissionTypes.MULTI_CONVO]: multiConvoPermissionsSchema.extend({
|
|
57
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
58
|
+
}),
|
|
59
|
+
[PermissionTypes.TEMPORARY_CHAT]: temporaryChatPermissionsSchema.extend({
|
|
60
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
61
|
+
}),
|
|
62
|
+
[PermissionTypes.RUN_CODE]: runCodePermissionsSchema.extend({
|
|
63
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
64
|
+
}),
|
|
134
65
|
}),
|
|
135
66
|
}),
|
|
136
67
|
[SystemRoles.USER]: roleSchema.extend({
|
|
137
68
|
name: z.literal(SystemRoles.USER),
|
|
138
|
-
|
|
139
|
-
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema,
|
|
140
|
-
[PermissionTypes.AGENTS]: agentPermissionsSchema,
|
|
141
|
-
[PermissionTypes.MULTI_CONVO]: multiConvoPermissionsSchema,
|
|
142
|
-
[PermissionTypes.TEMPORARY_CHAT]: temporaryChatPermissionsSchema,
|
|
143
|
-
[PermissionTypes.RUN_CODE]: runCodePermissionsSchema,
|
|
69
|
+
permissions: permissionsSchema,
|
|
144
70
|
}),
|
|
145
71
|
});
|
|
146
72
|
|
|
147
73
|
export const roleDefaults = defaultRolesSchema.parse({
|
|
148
74
|
[SystemRoles.ADMIN]: {
|
|
149
75
|
name: SystemRoles.ADMIN,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
76
|
+
permissions: {
|
|
77
|
+
[PermissionTypes.PROMPTS]: {
|
|
78
|
+
[Permissions.SHARED_GLOBAL]: true,
|
|
79
|
+
[Permissions.USE]: true,
|
|
80
|
+
[Permissions.CREATE]: true,
|
|
81
|
+
},
|
|
82
|
+
[PermissionTypes.BOOKMARKS]: {
|
|
83
|
+
[Permissions.USE]: true,
|
|
84
|
+
},
|
|
85
|
+
[PermissionTypes.AGENTS]: {
|
|
86
|
+
[Permissions.SHARED_GLOBAL]: true,
|
|
87
|
+
[Permissions.USE]: true,
|
|
88
|
+
[Permissions.CREATE]: true,
|
|
89
|
+
},
|
|
90
|
+
[PermissionTypes.MULTI_CONVO]: {
|
|
91
|
+
[Permissions.USE]: true,
|
|
92
|
+
},
|
|
93
|
+
[PermissionTypes.TEMPORARY_CHAT]: {
|
|
94
|
+
[Permissions.USE]: true,
|
|
95
|
+
},
|
|
96
|
+
[PermissionTypes.RUN_CODE]: {
|
|
97
|
+
[Permissions.USE]: true,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
156
100
|
},
|
|
157
101
|
[SystemRoles.USER]: {
|
|
158
102
|
name: SystemRoles.USER,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
103
|
+
permissions: {
|
|
104
|
+
[PermissionTypes.PROMPTS]: {},
|
|
105
|
+
[PermissionTypes.BOOKMARKS]: {},
|
|
106
|
+
[PermissionTypes.AGENTS]: {},
|
|
107
|
+
[PermissionTypes.MULTI_CONVO]: {},
|
|
108
|
+
[PermissionTypes.TEMPORARY_CHAT]: {},
|
|
109
|
+
[PermissionTypes.RUN_CODE]: {},
|
|
110
|
+
},
|
|
165
111
|
},
|
|
166
112
|
});
|
package/src/schemas.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Tools } from './types/assistants';
|
|
3
3
|
import type { TMessageContentParts, FunctionTool, FunctionToolCall } from './types/assistants';
|
|
4
|
+
import type { TEphemeralAgent } from './types';
|
|
4
5
|
import type { TFile } from './types/files';
|
|
5
6
|
|
|
6
7
|
export const isUUID = z.string().uuid();
|
|
@@ -88,6 +89,21 @@ export const isAgentsEndpoint = (_endpoint?: EModelEndpoint.agents | null | stri
|
|
|
88
89
|
return endpoint === EModelEndpoint.agents;
|
|
89
90
|
};
|
|
90
91
|
|
|
92
|
+
export const isEphemeralAgent = (
|
|
93
|
+
endpoint?: EModelEndpoint.agents | null | string,
|
|
94
|
+
ephemeralAgent?: TEphemeralAgent | null,
|
|
95
|
+
) => {
|
|
96
|
+
if (!ephemeralAgent) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
if (isAgentsEndpoint(endpoint)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
const hasMCPSelected = (ephemeralAgent?.mcp?.length ?? 0) > 0;
|
|
103
|
+
const hasCodeSelected = (ephemeralAgent?.execute_code ?? false) === true;
|
|
104
|
+
return hasMCPSelected || hasCodeSelected;
|
|
105
|
+
};
|
|
106
|
+
|
|
91
107
|
export const isParamEndpoint = (
|
|
92
108
|
endpoint: EModelEndpoint | string,
|
|
93
109
|
endpointType?: EModelEndpoint | string,
|
|
@@ -639,6 +655,8 @@ export const tPresetSchema = tConversationSchema
|
|
|
639
655
|
export const tConvoUpdateSchema = tConversationSchema.merge(
|
|
640
656
|
z.object({
|
|
641
657
|
endpoint: extendedModelEndpointSchema.nullable(),
|
|
658
|
+
createdAt: z.string().optional(),
|
|
659
|
+
updatedAt: z.string().optional(),
|
|
642
660
|
}),
|
|
643
661
|
);
|
|
644
662
|
|
|
@@ -752,22 +770,23 @@ export const tConversationTagSchema = z.object({
|
|
|
752
770
|
});
|
|
753
771
|
export type TConversationTag = z.infer<typeof tConversationTagSchema>;
|
|
754
772
|
|
|
755
|
-
export const
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
773
|
+
export const googleBaseSchema = tConversationSchema.pick({
|
|
774
|
+
model: true,
|
|
775
|
+
modelLabel: true,
|
|
776
|
+
promptPrefix: true,
|
|
777
|
+
examples: true,
|
|
778
|
+
temperature: true,
|
|
779
|
+
maxOutputTokens: true,
|
|
780
|
+
artifacts: true,
|
|
781
|
+
topP: true,
|
|
782
|
+
topK: true,
|
|
783
|
+
iconURL: true,
|
|
784
|
+
greeting: true,
|
|
785
|
+
spec: true,
|
|
786
|
+
maxContextTokens: true,
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
export const googleSchema = googleBaseSchema
|
|
771
790
|
.transform((obj: Partial<TConversation>) => removeNullishValues(obj))
|
|
772
791
|
.catch(() => ({}));
|
|
773
792
|
|
|
@@ -790,36 +809,25 @@ export const googleGenConfigSchema = z
|
|
|
790
809
|
.strip()
|
|
791
810
|
.optional();
|
|
792
811
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
812
|
+
const gptPluginsBaseSchema = tConversationSchema.pick({
|
|
813
|
+
model: true,
|
|
814
|
+
modelLabel: true,
|
|
815
|
+
chatGptLabel: true,
|
|
816
|
+
promptPrefix: true,
|
|
817
|
+
temperature: true,
|
|
818
|
+
artifacts: true,
|
|
819
|
+
top_p: true,
|
|
820
|
+
presence_penalty: true,
|
|
821
|
+
frequency_penalty: true,
|
|
822
|
+
tools: true,
|
|
823
|
+
agentOptions: true,
|
|
824
|
+
iconURL: true,
|
|
825
|
+
greeting: true,
|
|
826
|
+
spec: true,
|
|
827
|
+
maxContextTokens: true,
|
|
828
|
+
});
|
|
804
829
|
|
|
805
|
-
export const gptPluginsSchema =
|
|
806
|
-
.pick({
|
|
807
|
-
model: true,
|
|
808
|
-
modelLabel: true,
|
|
809
|
-
chatGptLabel: true,
|
|
810
|
-
promptPrefix: true,
|
|
811
|
-
temperature: true,
|
|
812
|
-
artifacts: true,
|
|
813
|
-
top_p: true,
|
|
814
|
-
presence_penalty: true,
|
|
815
|
-
frequency_penalty: true,
|
|
816
|
-
tools: true,
|
|
817
|
-
agentOptions: true,
|
|
818
|
-
iconURL: true,
|
|
819
|
-
greeting: true,
|
|
820
|
-
spec: true,
|
|
821
|
-
maxContextTokens: true,
|
|
822
|
-
})
|
|
830
|
+
export const gptPluginsSchema = gptPluginsBaseSchema
|
|
823
831
|
.transform((obj) => {
|
|
824
832
|
const result = {
|
|
825
833
|
...obj,
|
|
@@ -889,18 +897,19 @@ export function removeNullishValues<T extends Record<string, unknown>>(
|
|
|
889
897
|
return newObj;
|
|
890
898
|
}
|
|
891
899
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
900
|
+
const assistantBaseSchema = tConversationSchema.pick({
|
|
901
|
+
model: true,
|
|
902
|
+
assistant_id: true,
|
|
903
|
+
instructions: true,
|
|
904
|
+
artifacts: true,
|
|
905
|
+
promptPrefix: true,
|
|
906
|
+
iconURL: true,
|
|
907
|
+
greeting: true,
|
|
908
|
+
spec: true,
|
|
909
|
+
append_current_datetime: true,
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
export const assistantSchema = assistantBaseSchema
|
|
904
913
|
.transform((obj) => ({
|
|
905
914
|
...obj,
|
|
906
915
|
model: obj.model ?? openAISettings.model.default,
|
|
@@ -923,37 +932,39 @@ export const assistantSchema = tConversationSchema
|
|
|
923
932
|
append_current_datetime: false,
|
|
924
933
|
}));
|
|
925
934
|
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
935
|
+
const compactAssistantBaseSchema = tConversationSchema.pick({
|
|
936
|
+
model: true,
|
|
937
|
+
assistant_id: true,
|
|
938
|
+
instructions: true,
|
|
939
|
+
promptPrefix: true,
|
|
940
|
+
artifacts: true,
|
|
941
|
+
iconURL: true,
|
|
942
|
+
greeting: true,
|
|
943
|
+
spec: true,
|
|
944
|
+
});
|
|
945
|
+
|
|
946
|
+
export const compactAssistantSchema = compactAssistantBaseSchema
|
|
937
947
|
.transform((obj) => removeNullishValues(obj))
|
|
938
948
|
.catch(() => ({}));
|
|
939
949
|
|
|
940
|
-
export const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
950
|
+
export const agentsBaseSchema = tConversationSchema.pick({
|
|
951
|
+
model: true,
|
|
952
|
+
modelLabel: true,
|
|
953
|
+
temperature: true,
|
|
954
|
+
top_p: true,
|
|
955
|
+
presence_penalty: true,
|
|
956
|
+
frequency_penalty: true,
|
|
957
|
+
resendFiles: true,
|
|
958
|
+
imageDetail: true,
|
|
959
|
+
agent_id: true,
|
|
960
|
+
instructions: true,
|
|
961
|
+
promptPrefix: true,
|
|
962
|
+
iconURL: true,
|
|
963
|
+
greeting: true,
|
|
964
|
+
maxContextTokens: true,
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
export const agentsSchema = agentsBaseSchema
|
|
957
968
|
.transform((obj) => ({
|
|
958
969
|
...obj,
|
|
959
970
|
model: obj.model ?? agentsSettings.model.default,
|
|
@@ -989,46 +1000,32 @@ export const agentsSchema = tConversationSchema
|
|
|
989
1000
|
maxContextTokens: undefined,
|
|
990
1001
|
}));
|
|
991
1002
|
|
|
992
|
-
export const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1003
|
+
export const openAIBaseSchema = tConversationSchema.pick({
|
|
1004
|
+
model: true,
|
|
1005
|
+
modelLabel: true,
|
|
1006
|
+
chatGptLabel: true,
|
|
1007
|
+
promptPrefix: true,
|
|
1008
|
+
temperature: true,
|
|
1009
|
+
top_p: true,
|
|
1010
|
+
presence_penalty: true,
|
|
1011
|
+
frequency_penalty: true,
|
|
1012
|
+
resendFiles: true,
|
|
1013
|
+
artifacts: true,
|
|
1014
|
+
imageDetail: true,
|
|
1015
|
+
stop: true,
|
|
1016
|
+
iconURL: true,
|
|
1017
|
+
greeting: true,
|
|
1018
|
+
spec: true,
|
|
1019
|
+
maxContextTokens: true,
|
|
1020
|
+
max_tokens: true,
|
|
1021
|
+
reasoning_effort: true,
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
export const openAISchema = openAIBaseSchema
|
|
1013
1025
|
.transform((obj: Partial<TConversation>) => removeNullishValues(obj))
|
|
1014
1026
|
.catch(() => ({}));
|
|
1015
1027
|
|
|
1016
|
-
export const compactGoogleSchema =
|
|
1017
|
-
.pick({
|
|
1018
|
-
model: true,
|
|
1019
|
-
modelLabel: true,
|
|
1020
|
-
promptPrefix: true,
|
|
1021
|
-
examples: true,
|
|
1022
|
-
temperature: true,
|
|
1023
|
-
maxOutputTokens: true,
|
|
1024
|
-
artifacts: true,
|
|
1025
|
-
topP: true,
|
|
1026
|
-
topK: true,
|
|
1027
|
-
iconURL: true,
|
|
1028
|
-
greeting: true,
|
|
1029
|
-
spec: true,
|
|
1030
|
-
maxContextTokens: true,
|
|
1031
|
-
})
|
|
1028
|
+
export const compactGoogleSchema = googleBaseSchema
|
|
1032
1029
|
.transform((obj) => {
|
|
1033
1030
|
const newObj: Partial<TConversation> = { ...obj };
|
|
1034
1031
|
if (newObj.temperature === google.temperature.default) {
|
|
@@ -1048,55 +1045,30 @@ export const compactGoogleSchema = tConversationSchema
|
|
|
1048
1045
|
})
|
|
1049
1046
|
.catch(() => ({}));
|
|
1050
1047
|
|
|
1051
|
-
export const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
})
|
|
1070
|
-
.transform((obj) => removeNullishValues(obj))
|
|
1071
|
-
.catch(() => ({}));
|
|
1048
|
+
export const anthropicBaseSchema = tConversationSchema.pick({
|
|
1049
|
+
model: true,
|
|
1050
|
+
modelLabel: true,
|
|
1051
|
+
promptPrefix: true,
|
|
1052
|
+
temperature: true,
|
|
1053
|
+
maxOutputTokens: true,
|
|
1054
|
+
topP: true,
|
|
1055
|
+
topK: true,
|
|
1056
|
+
resendFiles: true,
|
|
1057
|
+
promptCache: true,
|
|
1058
|
+
thinking: true,
|
|
1059
|
+
thinkingBudget: true,
|
|
1060
|
+
artifacts: true,
|
|
1061
|
+
iconURL: true,
|
|
1062
|
+
greeting: true,
|
|
1063
|
+
spec: true,
|
|
1064
|
+
maxContextTokens: true,
|
|
1065
|
+
});
|
|
1072
1066
|
|
|
1073
|
-
export const
|
|
1074
|
-
.
|
|
1075
|
-
model: true,
|
|
1076
|
-
})
|
|
1077
|
-
.transform((obj) => {
|
|
1078
|
-
const newObj: Partial<TConversation> = { ...obj };
|
|
1079
|
-
return removeNullishValues(newObj);
|
|
1080
|
-
})
|
|
1067
|
+
export const anthropicSchema = anthropicBaseSchema
|
|
1068
|
+
.transform((obj) => removeNullishValues(obj))
|
|
1081
1069
|
.catch(() => ({}));
|
|
1082
1070
|
|
|
1083
|
-
export const compactPluginsSchema =
|
|
1084
|
-
.pick({
|
|
1085
|
-
model: true,
|
|
1086
|
-
modelLabel: true,
|
|
1087
|
-
chatGptLabel: true,
|
|
1088
|
-
promptPrefix: true,
|
|
1089
|
-
temperature: true,
|
|
1090
|
-
top_p: true,
|
|
1091
|
-
presence_penalty: true,
|
|
1092
|
-
frequency_penalty: true,
|
|
1093
|
-
tools: true,
|
|
1094
|
-
agentOptions: true,
|
|
1095
|
-
iconURL: true,
|
|
1096
|
-
greeting: true,
|
|
1097
|
-
spec: true,
|
|
1098
|
-
maxContextTokens: true,
|
|
1099
|
-
})
|
|
1071
|
+
export const compactPluginsSchema = gptPluginsBaseSchema
|
|
1100
1072
|
.transform((obj) => {
|
|
1101
1073
|
const newObj: Partial<TConversation> = { ...obj };
|
|
1102
1074
|
if (newObj.modelLabel === null) {
|
|
@@ -1149,15 +1121,16 @@ export const tBannerSchema = z.object({
|
|
|
1149
1121
|
});
|
|
1150
1122
|
export type TBanner = z.infer<typeof tBannerSchema>;
|
|
1151
1123
|
|
|
1152
|
-
export const
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1124
|
+
export const compactAgentsBaseSchema = tConversationSchema.pick({
|
|
1125
|
+
spec: true,
|
|
1126
|
+
// model: true,
|
|
1127
|
+
iconURL: true,
|
|
1128
|
+
greeting: true,
|
|
1129
|
+
agent_id: true,
|
|
1130
|
+
instructions: true,
|
|
1131
|
+
additional_instructions: true,
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
export const compactAgentsSchema = compactAgentsBaseSchema
|
|
1162
1135
|
.transform((obj) => removeNullishValues(obj))
|
|
1163
1136
|
.catch(() => ({}));
|