librechat-data-provider 0.7.78 → 0.7.82
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/mcp.spec.ts +126 -1
- package/specs/parsers.spec.ts +125 -0
- package/src/actions.ts +73 -19
- package/src/api-endpoints.ts +42 -10
- package/src/config.ts +30 -2
- 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/mcp.ts +12 -8
- package/src/parsers.ts +47 -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 +152 -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/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,
|
|
@@ -401,6 +417,7 @@ export const tPluginSchema = z.object({
|
|
|
401
417
|
icon: z.string().optional(),
|
|
402
418
|
authConfig: z.array(tPluginAuthConfigSchema).optional(),
|
|
403
419
|
authenticated: z.boolean().optional(),
|
|
420
|
+
chatMenu: z.boolean().optional(),
|
|
404
421
|
isButton: z.boolean().optional(),
|
|
405
422
|
toolkit: z.boolean().optional(),
|
|
406
423
|
});
|
|
@@ -639,6 +656,8 @@ export const tPresetSchema = tConversationSchema
|
|
|
639
656
|
export const tConvoUpdateSchema = tConversationSchema.merge(
|
|
640
657
|
z.object({
|
|
641
658
|
endpoint: extendedModelEndpointSchema.nullable(),
|
|
659
|
+
createdAt: z.string().optional(),
|
|
660
|
+
updatedAt: z.string().optional(),
|
|
642
661
|
}),
|
|
643
662
|
);
|
|
644
663
|
|
|
@@ -752,22 +771,23 @@ export const tConversationTagSchema = z.object({
|
|
|
752
771
|
});
|
|
753
772
|
export type TConversationTag = z.infer<typeof tConversationTagSchema>;
|
|
754
773
|
|
|
755
|
-
export const
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
774
|
+
export const googleBaseSchema = tConversationSchema.pick({
|
|
775
|
+
model: true,
|
|
776
|
+
modelLabel: true,
|
|
777
|
+
promptPrefix: true,
|
|
778
|
+
examples: true,
|
|
779
|
+
temperature: true,
|
|
780
|
+
maxOutputTokens: true,
|
|
781
|
+
artifacts: true,
|
|
782
|
+
topP: true,
|
|
783
|
+
topK: true,
|
|
784
|
+
iconURL: true,
|
|
785
|
+
greeting: true,
|
|
786
|
+
spec: true,
|
|
787
|
+
maxContextTokens: true,
|
|
788
|
+
});
|
|
789
|
+
|
|
790
|
+
export const googleSchema = googleBaseSchema
|
|
771
791
|
.transform((obj: Partial<TConversation>) => removeNullishValues(obj))
|
|
772
792
|
.catch(() => ({}));
|
|
773
793
|
|
|
@@ -790,36 +810,25 @@ export const googleGenConfigSchema = z
|
|
|
790
810
|
.strip()
|
|
791
811
|
.optional();
|
|
792
812
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
813
|
+
const gptPluginsBaseSchema = tConversationSchema.pick({
|
|
814
|
+
model: true,
|
|
815
|
+
modelLabel: true,
|
|
816
|
+
chatGptLabel: true,
|
|
817
|
+
promptPrefix: true,
|
|
818
|
+
temperature: true,
|
|
819
|
+
artifacts: true,
|
|
820
|
+
top_p: true,
|
|
821
|
+
presence_penalty: true,
|
|
822
|
+
frequency_penalty: true,
|
|
823
|
+
tools: true,
|
|
824
|
+
agentOptions: true,
|
|
825
|
+
iconURL: true,
|
|
826
|
+
greeting: true,
|
|
827
|
+
spec: true,
|
|
828
|
+
maxContextTokens: true,
|
|
829
|
+
});
|
|
804
830
|
|
|
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
|
-
})
|
|
831
|
+
export const gptPluginsSchema = gptPluginsBaseSchema
|
|
823
832
|
.transform((obj) => {
|
|
824
833
|
const result = {
|
|
825
834
|
...obj,
|
|
@@ -889,18 +898,19 @@ export function removeNullishValues<T extends Record<string, unknown>>(
|
|
|
889
898
|
return newObj;
|
|
890
899
|
}
|
|
891
900
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
901
|
+
const assistantBaseSchema = tConversationSchema.pick({
|
|
902
|
+
model: true,
|
|
903
|
+
assistant_id: true,
|
|
904
|
+
instructions: true,
|
|
905
|
+
artifacts: true,
|
|
906
|
+
promptPrefix: true,
|
|
907
|
+
iconURL: true,
|
|
908
|
+
greeting: true,
|
|
909
|
+
spec: true,
|
|
910
|
+
append_current_datetime: true,
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
export const assistantSchema = assistantBaseSchema
|
|
904
914
|
.transform((obj) => ({
|
|
905
915
|
...obj,
|
|
906
916
|
model: obj.model ?? openAISettings.model.default,
|
|
@@ -923,37 +933,39 @@ export const assistantSchema = tConversationSchema
|
|
|
923
933
|
append_current_datetime: false,
|
|
924
934
|
}));
|
|
925
935
|
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
936
|
+
const compactAssistantBaseSchema = tConversationSchema.pick({
|
|
937
|
+
model: true,
|
|
938
|
+
assistant_id: true,
|
|
939
|
+
instructions: true,
|
|
940
|
+
promptPrefix: true,
|
|
941
|
+
artifacts: true,
|
|
942
|
+
iconURL: true,
|
|
943
|
+
greeting: true,
|
|
944
|
+
spec: true,
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
export const compactAssistantSchema = compactAssistantBaseSchema
|
|
937
948
|
.transform((obj) => removeNullishValues(obj))
|
|
938
949
|
.catch(() => ({}));
|
|
939
950
|
|
|
940
|
-
export const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
951
|
+
export const agentsBaseSchema = tConversationSchema.pick({
|
|
952
|
+
model: true,
|
|
953
|
+
modelLabel: true,
|
|
954
|
+
temperature: true,
|
|
955
|
+
top_p: true,
|
|
956
|
+
presence_penalty: true,
|
|
957
|
+
frequency_penalty: true,
|
|
958
|
+
resendFiles: true,
|
|
959
|
+
imageDetail: true,
|
|
960
|
+
agent_id: true,
|
|
961
|
+
instructions: true,
|
|
962
|
+
promptPrefix: true,
|
|
963
|
+
iconURL: true,
|
|
964
|
+
greeting: true,
|
|
965
|
+
maxContextTokens: true,
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
export const agentsSchema = agentsBaseSchema
|
|
957
969
|
.transform((obj) => ({
|
|
958
970
|
...obj,
|
|
959
971
|
model: obj.model ?? agentsSettings.model.default,
|
|
@@ -989,46 +1001,32 @@ export const agentsSchema = tConversationSchema
|
|
|
989
1001
|
maxContextTokens: undefined,
|
|
990
1002
|
}));
|
|
991
1003
|
|
|
992
|
-
export const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1004
|
+
export const openAIBaseSchema = tConversationSchema.pick({
|
|
1005
|
+
model: true,
|
|
1006
|
+
modelLabel: true,
|
|
1007
|
+
chatGptLabel: true,
|
|
1008
|
+
promptPrefix: true,
|
|
1009
|
+
temperature: true,
|
|
1010
|
+
top_p: true,
|
|
1011
|
+
presence_penalty: true,
|
|
1012
|
+
frequency_penalty: true,
|
|
1013
|
+
resendFiles: true,
|
|
1014
|
+
artifacts: true,
|
|
1015
|
+
imageDetail: true,
|
|
1016
|
+
stop: true,
|
|
1017
|
+
iconURL: true,
|
|
1018
|
+
greeting: true,
|
|
1019
|
+
spec: true,
|
|
1020
|
+
maxContextTokens: true,
|
|
1021
|
+
max_tokens: true,
|
|
1022
|
+
reasoning_effort: true,
|
|
1023
|
+
});
|
|
1024
|
+
|
|
1025
|
+
export const openAISchema = openAIBaseSchema
|
|
1013
1026
|
.transform((obj: Partial<TConversation>) => removeNullishValues(obj))
|
|
1014
1027
|
.catch(() => ({}));
|
|
1015
1028
|
|
|
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
|
-
})
|
|
1029
|
+
export const compactGoogleSchema = googleBaseSchema
|
|
1032
1030
|
.transform((obj) => {
|
|
1033
1031
|
const newObj: Partial<TConversation> = { ...obj };
|
|
1034
1032
|
if (newObj.temperature === google.temperature.default) {
|
|
@@ -1048,55 +1046,30 @@ export const compactGoogleSchema = tConversationSchema
|
|
|
1048
1046
|
})
|
|
1049
1047
|
.catch(() => ({}));
|
|
1050
1048
|
|
|
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(() => ({}));
|
|
1049
|
+
export const anthropicBaseSchema = tConversationSchema.pick({
|
|
1050
|
+
model: true,
|
|
1051
|
+
modelLabel: true,
|
|
1052
|
+
promptPrefix: true,
|
|
1053
|
+
temperature: true,
|
|
1054
|
+
maxOutputTokens: true,
|
|
1055
|
+
topP: true,
|
|
1056
|
+
topK: true,
|
|
1057
|
+
resendFiles: true,
|
|
1058
|
+
promptCache: true,
|
|
1059
|
+
thinking: true,
|
|
1060
|
+
thinkingBudget: true,
|
|
1061
|
+
artifacts: true,
|
|
1062
|
+
iconURL: true,
|
|
1063
|
+
greeting: true,
|
|
1064
|
+
spec: true,
|
|
1065
|
+
maxContextTokens: true,
|
|
1066
|
+
});
|
|
1072
1067
|
|
|
1073
|
-
export const
|
|
1074
|
-
.
|
|
1075
|
-
model: true,
|
|
1076
|
-
})
|
|
1077
|
-
.transform((obj) => {
|
|
1078
|
-
const newObj: Partial<TConversation> = { ...obj };
|
|
1079
|
-
return removeNullishValues(newObj);
|
|
1080
|
-
})
|
|
1068
|
+
export const anthropicSchema = anthropicBaseSchema
|
|
1069
|
+
.transform((obj) => removeNullishValues(obj))
|
|
1081
1070
|
.catch(() => ({}));
|
|
1082
1071
|
|
|
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
|
-
})
|
|
1072
|
+
export const compactPluginsSchema = gptPluginsBaseSchema
|
|
1100
1073
|
.transform((obj) => {
|
|
1101
1074
|
const newObj: Partial<TConversation> = { ...obj };
|
|
1102
1075
|
if (newObj.modelLabel === null) {
|
|
@@ -1149,15 +1122,16 @@ export const tBannerSchema = z.object({
|
|
|
1149
1122
|
});
|
|
1150
1123
|
export type TBanner = z.infer<typeof tBannerSchema>;
|
|
1151
1124
|
|
|
1152
|
-
export const
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1125
|
+
export const compactAgentsBaseSchema = tConversationSchema.pick({
|
|
1126
|
+
spec: true,
|
|
1127
|
+
// model: true,
|
|
1128
|
+
iconURL: true,
|
|
1129
|
+
greeting: true,
|
|
1130
|
+
agent_id: true,
|
|
1131
|
+
instructions: true,
|
|
1132
|
+
additional_instructions: true,
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
export const compactAgentsSchema = compactAgentsBaseSchema
|
|
1162
1136
|
.transform((obj) => removeNullishValues(obj))
|
|
1163
1137
|
.catch(() => ({}));
|
package/src/types/assistants.ts
CHANGED
|
@@ -27,6 +27,7 @@ export enum EToolResources {
|
|
|
27
27
|
code_interpreter = 'code_interpreter',
|
|
28
28
|
execute_code = 'execute_code',
|
|
29
29
|
file_search = 'file_search',
|
|
30
|
+
image_edit = 'image_edit',
|
|
30
31
|
ocr = 'ocr',
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -163,15 +164,9 @@ export type AgentModelParameters = {
|
|
|
163
164
|
presence_penalty: AgentParameterValue;
|
|
164
165
|
};
|
|
165
166
|
|
|
166
|
-
export interface
|
|
167
|
-
execute_code?: ExecuteCodeResource;
|
|
168
|
-
file_search?: AgentFileResource;
|
|
169
|
-
ocr?: Omit<AgentFileResource, 'vector_store_ids'>;
|
|
170
|
-
}
|
|
171
|
-
export interface ExecuteCodeResource {
|
|
167
|
+
export interface AgentBaseResource {
|
|
172
168
|
/**
|
|
173
|
-
* A list of file IDs made available to the
|
|
174
|
-
* There can be a maximum of 20 files associated with the tool.
|
|
169
|
+
* A list of file IDs made available to the tool.
|
|
175
170
|
*/
|
|
176
171
|
file_ids?: Array<string>;
|
|
177
172
|
/**
|
|
@@ -180,21 +175,24 @@ export interface ExecuteCodeResource {
|
|
|
180
175
|
files?: Array<TFile>;
|
|
181
176
|
}
|
|
182
177
|
|
|
183
|
-
export interface
|
|
178
|
+
export interface AgentToolResources {
|
|
179
|
+
[EToolResources.image_edit]?: AgentBaseResource;
|
|
180
|
+
[EToolResources.execute_code]?: ExecuteCodeResource;
|
|
181
|
+
[EToolResources.file_search]?: AgentFileResource;
|
|
182
|
+
[EToolResources.ocr]?: AgentBaseResource;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A resource for the execute_code tool.
|
|
186
|
+
* Contains file IDs made available to the tool (max 20 files) and already fetched files.
|
|
187
|
+
*/
|
|
188
|
+
export type ExecuteCodeResource = AgentBaseResource;
|
|
189
|
+
|
|
190
|
+
export interface AgentFileResource extends AgentBaseResource {
|
|
184
191
|
/**
|
|
185
192
|
* The ID of the vector store attached to this agent. There
|
|
186
193
|
* can be a maximum of 1 vector store attached to the agent.
|
|
187
194
|
*/
|
|
188
195
|
vector_store_ids?: Array<string>;
|
|
189
|
-
/**
|
|
190
|
-
* A list of file IDs made available to the `file_search` tool.
|
|
191
|
-
* To be used before vector stores are implemented.
|
|
192
|
-
*/
|
|
193
|
-
file_ids?: Array<string>;
|
|
194
|
-
/**
|
|
195
|
-
* A list of files already fetched.
|
|
196
|
-
*/
|
|
197
|
-
files?: Array<TFile>;
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
export type Agent = {
|
package/src/types/mutations.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as types from '../types';
|
|
2
2
|
import * as r from '../roles';
|
|
3
|
+
import * as p from '../permissions';
|
|
3
4
|
import {
|
|
4
5
|
Tools,
|
|
5
6
|
Assistant,
|
|
@@ -163,6 +164,11 @@ export type DeleteConversationOptions = MutationOptions<
|
|
|
163
164
|
types.TDeleteConversationRequest
|
|
164
165
|
>;
|
|
165
166
|
|
|
167
|
+
export type ArchiveConversationOptions = MutationOptions<
|
|
168
|
+
types.TArchiveConversationResponse,
|
|
169
|
+
types.TArchiveConversationRequest
|
|
170
|
+
>;
|
|
171
|
+
|
|
166
172
|
export type DuplicateConvoOptions = MutationOptions<
|
|
167
173
|
types.TDuplicateConvoResponse,
|
|
168
174
|
types.TDuplicateConvoRequest
|
|
@@ -251,9 +257,9 @@ export type UpdatePermVars<T> = {
|
|
|
251
257
|
updates: Partial<T>;
|
|
252
258
|
};
|
|
253
259
|
|
|
254
|
-
export type UpdatePromptPermVars = UpdatePermVars<
|
|
260
|
+
export type UpdatePromptPermVars = UpdatePermVars<p.TPromptPermissions>;
|
|
255
261
|
|
|
256
|
-
export type UpdateAgentPermVars = UpdatePermVars<
|
|
262
|
+
export type UpdateAgentPermVars = UpdatePermVars<p.TAgentPermissions>;
|
|
257
263
|
|
|
258
264
|
export type UpdatePermResponse = r.TRole;
|
|
259
265
|
|
package/src/types/queries.ts
CHANGED
|
@@ -11,25 +11,23 @@ export type Conversation = {
|
|
|
11
11
|
conversations: s.TConversation[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
// Parameters for listing conversations (e.g., for pagination)
|
|
15
14
|
export type ConversationListParams = {
|
|
16
|
-
|
|
17
|
-
before?: string | null;
|
|
18
|
-
after?: string | null;
|
|
19
|
-
order?: 'asc' | 'desc';
|
|
20
|
-
pageNumber: string;
|
|
21
|
-
conversationId?: string;
|
|
15
|
+
cursor?: string;
|
|
22
16
|
isArchived?: boolean;
|
|
17
|
+
sortBy?: 'title' | 'createdAt' | 'updatedAt';
|
|
18
|
+
sortDirection?: 'asc' | 'desc';
|
|
23
19
|
tags?: string[];
|
|
20
|
+
search?: string;
|
|
24
21
|
};
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
export type MinimalConversation = Pick<
|
|
24
|
+
s.TConversation,
|
|
25
|
+
'conversationId' | 'endpoint' | 'title' | 'createdAt' | 'updatedAt' | 'user'
|
|
26
|
+
>;
|
|
27
|
+
|
|
27
28
|
export type ConversationListResponse = {
|
|
28
|
-
conversations:
|
|
29
|
-
|
|
30
|
-
pageSize: string | number;
|
|
31
|
-
pages: string | number;
|
|
32
|
-
messages: s.TMessage[];
|
|
29
|
+
conversations: MinimalConversation[];
|
|
30
|
+
nextCursor: string | null;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
export type ConversationData = InfiniteData<ConversationListResponse>;
|
|
@@ -38,6 +36,23 @@ export type ConversationUpdater = (
|
|
|
38
36
|
conversation: s.TConversation,
|
|
39
37
|
) => ConversationData;
|
|
40
38
|
|
|
39
|
+
/* Messages */
|
|
40
|
+
export type MessagesListParams = {
|
|
41
|
+
cursor?: string | null;
|
|
42
|
+
sortBy?: 'endpoint' | 'createdAt' | 'updatedAt';
|
|
43
|
+
sortDirection?: 'asc' | 'desc';
|
|
44
|
+
pageSize?: number;
|
|
45
|
+
conversationId?: string;
|
|
46
|
+
messageId?: string;
|
|
47
|
+
search?: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type MessagesListResponse = {
|
|
51
|
+
messages: s.TMessage[];
|
|
52
|
+
nextCursor: string | null;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/* Shared Links */
|
|
41
56
|
export type SharedMessagesResponse = Omit<s.TSharedLink, 'messages'> & {
|
|
42
57
|
messages: s.TMessage[];
|
|
43
58
|
};
|
package/src/types.ts
CHANGED
|
@@ -18,6 +18,8 @@ export type TMessages = TMessage[];
|
|
|
18
18
|
|
|
19
19
|
/* TODO: Cleanup EndpointOption types */
|
|
20
20
|
export type TEndpointOption = {
|
|
21
|
+
spec?: string | null;
|
|
22
|
+
iconURL?: string | null;
|
|
21
23
|
endpoint: EModelEndpoint;
|
|
22
24
|
endpointType?: EModelEndpoint;
|
|
23
25
|
modelDisplayLabel?: string;
|
|
@@ -39,12 +41,18 @@ export type TEndpointOption = {
|
|
|
39
41
|
overrideUserMessageId?: string;
|
|
40
42
|
};
|
|
41
43
|
|
|
44
|
+
export type TEphemeralAgent = {
|
|
45
|
+
mcp?: string[];
|
|
46
|
+
execute_code?: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
42
49
|
export type TPayload = Partial<TMessage> &
|
|
43
50
|
Partial<TEndpointOption> & {
|
|
44
51
|
isContinued: boolean;
|
|
45
52
|
conversationId: string | null;
|
|
46
53
|
messages?: TMessages;
|
|
47
54
|
isTemporary: boolean;
|
|
55
|
+
ephemeralAgent?: TEphemeralAgent | null;
|
|
48
56
|
};
|
|
49
57
|
|
|
50
58
|
export type TSubmission = {
|
|
@@ -57,10 +65,12 @@ export type TSubmission = {
|
|
|
57
65
|
isTemporary: boolean;
|
|
58
66
|
messages: TMessage[];
|
|
59
67
|
isRegenerate?: boolean;
|
|
68
|
+
isResubmission?: boolean;
|
|
60
69
|
initialResponse?: TMessage;
|
|
61
70
|
conversation: Partial<TConversation>;
|
|
62
71
|
endpointOption: TEndpointOption;
|
|
63
72
|
clientTimestamp?: string;
|
|
73
|
+
ephemeralAgent?: TEphemeralAgent | null;
|
|
64
74
|
};
|
|
65
75
|
|
|
66
76
|
export type EventSubmission = Omit<TSubmission, 'initialResponse'> & { initialResponse: TMessage };
|