librechat-data-provider 0.1.5 → 0.1.6
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 +51 -30
- package/dist/index.js +52 -29
- package/package.json +1 -1
- package/src/api-endpoints.ts +2 -2
- package/src/createPayload.ts +2 -1
- package/src/data-service.ts +11 -2
- package/src/react-query-service.ts +11 -0
- package/src/schemas.ts +49 -26
- package/src/types.ts +16 -26
- package/types/api-endpoints.d.ts +1 -1
- package/types/createPayload.d.ts +9 -1
- package/types/data-service.d.ts +2 -1
- package/types/react-query-service.d.ts +1 -0
- package/types/schemas.d.ts +91 -58
- package/types/types.d.ts +15 -26
package/dist/index.es.js
CHANGED
|
@@ -186,8 +186,8 @@ var user = function () {
|
|
|
186
186
|
var userPlugins = function () {
|
|
187
187
|
return '/api/user/plugins';
|
|
188
188
|
};
|
|
189
|
-
var messages = function (
|
|
190
|
-
return "/api/messages/".concat(
|
|
189
|
+
var messages = function (conversationId, messageId) {
|
|
190
|
+
return "/api/messages/".concat(conversationId).concat(messageId ? "/".concat(messageId) : '');
|
|
191
191
|
};
|
|
192
192
|
var abortRequest = function (endpoint) {
|
|
193
193
|
return "/api/ask/".concat(endpoint, "/abort");
|
|
@@ -263,8 +263,8 @@ function deleteConversation(payload) {
|
|
|
263
263
|
function clearAllConversations() {
|
|
264
264
|
return request.post(deleteConversation$1(), { arg: {} });
|
|
265
265
|
}
|
|
266
|
-
function getMessagesByConvoId(
|
|
267
|
-
return request.get(messages(
|
|
266
|
+
function getMessagesByConvoId(conversationId) {
|
|
267
|
+
return request.get(messages(conversationId));
|
|
268
268
|
}
|
|
269
269
|
function getConversationById(id) {
|
|
270
270
|
return request.get(conversationById(id));
|
|
@@ -272,6 +272,13 @@ function getConversationById(id) {
|
|
|
272
272
|
function updateConversation(payload) {
|
|
273
273
|
return request.post(updateConversation$1(), { arg: payload });
|
|
274
274
|
}
|
|
275
|
+
function updateMessage(payload) {
|
|
276
|
+
var conversationId = payload.conversationId, messageId = payload.messageId, text = payload.text;
|
|
277
|
+
if (!conversationId) {
|
|
278
|
+
throw new Error('conversationId is required');
|
|
279
|
+
}
|
|
280
|
+
return request.put(messages(conversationId, messageId), { text: text });
|
|
281
|
+
}
|
|
275
282
|
function getPresets() {
|
|
276
283
|
return request.get(presets());
|
|
277
284
|
}
|
|
@@ -343,29 +350,6 @@ var EModelEndpoint;
|
|
|
343
350
|
EModelEndpoint["anthropic"] = "anthropic";
|
|
344
351
|
})(EModelEndpoint || (EModelEndpoint = {}));
|
|
345
352
|
var eModelEndpointSchema = z.nativeEnum(EModelEndpoint);
|
|
346
|
-
var tMessageSchema = z.object({
|
|
347
|
-
messageId: z.string(),
|
|
348
|
-
clientId: z.string().nullable().optional(),
|
|
349
|
-
conversationId: z.string().nullable(),
|
|
350
|
-
parentMessageId: z.string().nullable(),
|
|
351
|
-
sender: z.string(),
|
|
352
|
-
text: z.string(),
|
|
353
|
-
isCreatedByUser: z.boolean(),
|
|
354
|
-
error: z.boolean(),
|
|
355
|
-
createdAt: z
|
|
356
|
-
.string()
|
|
357
|
-
.optional()
|
|
358
|
-
.default(function () { return new Date().toISOString(); }),
|
|
359
|
-
updatedAt: z
|
|
360
|
-
.string()
|
|
361
|
-
.optional()
|
|
362
|
-
.default(function () { return new Date().toISOString(); }),
|
|
363
|
-
current: z.boolean().optional(),
|
|
364
|
-
unfinished: z.boolean().optional(),
|
|
365
|
-
submitting: z.boolean().optional(),
|
|
366
|
-
searchResult: z.boolean().optional(),
|
|
367
|
-
finish_reason: z.string().optional(),
|
|
368
|
-
});
|
|
369
353
|
var tPluginAuthConfigSchema = z.object({
|
|
370
354
|
authField: z.string(),
|
|
371
355
|
label: z.string(),
|
|
@@ -394,6 +378,35 @@ var tAgentOptionsSchema = z.object({
|
|
|
394
378
|
model: z.string(),
|
|
395
379
|
temperature: z.number(),
|
|
396
380
|
});
|
|
381
|
+
var tMessageSchema = z.object({
|
|
382
|
+
messageId: z.string(),
|
|
383
|
+
clientId: z.string().nullable().optional(),
|
|
384
|
+
conversationId: z.string().nullable(),
|
|
385
|
+
parentMessageId: z.string().nullable(),
|
|
386
|
+
responseMessageId: z.string().nullable().optional(),
|
|
387
|
+
overrideParentMessageId: z.string().nullable().optional(),
|
|
388
|
+
bg: z.string().nullable().optional(),
|
|
389
|
+
model: z.string().nullable().optional(),
|
|
390
|
+
title: z.string().nullable().optional(),
|
|
391
|
+
sender: z.string(),
|
|
392
|
+
text: z.string(),
|
|
393
|
+
generation: z.string().nullable().optional(),
|
|
394
|
+
isCreatedByUser: z.boolean(),
|
|
395
|
+
error: z.boolean(),
|
|
396
|
+
createdAt: z
|
|
397
|
+
.string()
|
|
398
|
+
.optional()
|
|
399
|
+
.default(function () { return new Date().toISOString(); }),
|
|
400
|
+
updatedAt: z
|
|
401
|
+
.string()
|
|
402
|
+
.optional()
|
|
403
|
+
.default(function () { return new Date().toISOString(); }),
|
|
404
|
+
current: z.boolean().optional(),
|
|
405
|
+
unfinished: z.boolean().optional(),
|
|
406
|
+
submitting: z.boolean().optional(),
|
|
407
|
+
searchResult: z.boolean().optional(),
|
|
408
|
+
finish_reason: z.string().optional(),
|
|
409
|
+
});
|
|
397
410
|
var tConversationSchema = z.object({
|
|
398
411
|
conversationId: z.string().nullable(),
|
|
399
412
|
title: z.string(),
|
|
@@ -682,6 +695,14 @@ var useUpdateConversationMutation = function (id) {
|
|
|
682
695
|
},
|
|
683
696
|
});
|
|
684
697
|
};
|
|
698
|
+
var useUpdateMessageMutation = function (id) {
|
|
699
|
+
var queryClient = useQueryClient();
|
|
700
|
+
return useMutation(function (payload) { return updateMessage(payload); }, {
|
|
701
|
+
onSuccess: function () {
|
|
702
|
+
queryClient.invalidateQueries([QueryKeys.messages, id]);
|
|
703
|
+
},
|
|
704
|
+
});
|
|
705
|
+
};
|
|
685
706
|
var useDeleteConversationMutation = function (id) {
|
|
686
707
|
var queryClient = useQueryClient();
|
|
687
708
|
return useMutation(function (payload) { return deleteConversation(payload); }, {
|
|
@@ -1042,7 +1063,7 @@ var SSE = function (url, options) {
|
|
|
1042
1063
|
// }
|
|
1043
1064
|
|
|
1044
1065
|
function createPayload(submission) {
|
|
1045
|
-
var conversation = submission.conversation, message = submission.message, endpointOption = submission.endpointOption, isEdited = submission.isEdited;
|
|
1066
|
+
var conversation = submission.conversation, message = submission.message, endpointOption = submission.endpointOption, isEdited = submission.isEdited, isContinued = submission.isContinued;
|
|
1046
1067
|
var conversationId = tConversationSchema.parse(conversation).conversationId;
|
|
1047
1068
|
var endpoint = endpointOption.endpoint;
|
|
1048
1069
|
var endpointUrlMap = {
|
|
@@ -1059,8 +1080,8 @@ function createPayload(submission) {
|
|
|
1059
1080
|
if (isEdited) {
|
|
1060
1081
|
server = server.replace('/ask/', '/edit/');
|
|
1061
1082
|
}
|
|
1062
|
-
var payload = __assign(__assign(__assign({}, message), endpointOption), { conversationId: conversationId });
|
|
1083
|
+
var payload = __assign(__assign(__assign({}, message), endpointOption), { isContinued: isEdited && isContinued, conversationId: conversationId });
|
|
1063
1084
|
return { server: server, payload: payload };
|
|
1064
1085
|
}
|
|
1065
1086
|
|
|
1066
|
-
export { EModelEndpoint, QueryKeys, SSE, abortRequestWithMessage, anthropicSchema, bingAISchema, chatGPTBrowserSchema, clearAllConversations, createPayload, createPreset, deleteConversation, deletePreset, eModelEndpointSchema, getAIEndpoints, getAvailablePlugins, getConversationById, getConversations, getLoginGoogle, getMessagesByConvoId, getPresets, getResponseSender, getSearchEnabled, getStartupConfig, getUser, googleSchema, gptPluginsSchema, login, logout, openAISchema, parseConvo, refreshToken, register, requestPasswordReset, resetPassword, searchConversations, setAcceptLanguageHeader, setTokenHeader, tAgentOptionsSchema, tConversationSchema, tExampleSchema, tMessageSchema, tPluginAuthConfigSchema, tPluginSchema, tPresetSchema, updateConversation, updatePreset, updateTokenCount, updateUserPlugins, useAbortRequestWithMessage, useAvailablePluginsQuery, useClearConversationsMutation, useCreatePresetMutation, useDeleteConversationMutation, useDeletePresetMutation, useGetConversationByIdMutation, useGetConversationByIdQuery, useGetConversationsQuery, useGetEndpointsQuery, useGetMessagesByConvoId, useGetPresetsQuery, useGetSearchEnabledQuery, useGetStartupConfig, useGetUserQuery, useLoginUserMutation, useLogoutUserMutation, useRefreshTokenMutation, useRegisterUserMutation, useRequestPasswordResetMutation, useResetPasswordMutation, useSearchQuery, useUpdateConversationMutation, useUpdatePresetMutation, useUpdateTokenCountMutation, useUpdateUserPluginsMutation };
|
|
1087
|
+
export { EModelEndpoint, QueryKeys, SSE, abortRequestWithMessage, anthropicSchema, bingAISchema, chatGPTBrowserSchema, clearAllConversations, createPayload, createPreset, deleteConversation, deletePreset, eModelEndpointSchema, getAIEndpoints, getAvailablePlugins, getConversationById, getConversations, getLoginGoogle, getMessagesByConvoId, getPresets, getResponseSender, getSearchEnabled, getStartupConfig, getUser, googleSchema, gptPluginsSchema, login, logout, openAISchema, parseConvo, refreshToken, register, requestPasswordReset, resetPassword, searchConversations, setAcceptLanguageHeader, setTokenHeader, tAgentOptionsSchema, tConversationSchema, tExampleSchema, tMessageSchema, tPluginAuthConfigSchema, tPluginSchema, tPresetSchema, updateConversation, updateMessage, updatePreset, updateTokenCount, updateUserPlugins, useAbortRequestWithMessage, useAvailablePluginsQuery, useClearConversationsMutation, useCreatePresetMutation, useDeleteConversationMutation, useDeletePresetMutation, useGetConversationByIdMutation, useGetConversationByIdQuery, useGetConversationsQuery, useGetEndpointsQuery, useGetMessagesByConvoId, useGetPresetsQuery, useGetSearchEnabledQuery, useGetStartupConfig, useGetUserQuery, useLoginUserMutation, useLogoutUserMutation, useRefreshTokenMutation, useRegisterUserMutation, useRequestPasswordResetMutation, useResetPasswordMutation, useSearchQuery, useUpdateConversationMutation, useUpdateMessageMutation, useUpdatePresetMutation, useUpdateTokenCountMutation, useUpdateUserPluginsMutation };
|
package/dist/index.js
CHANGED
|
@@ -188,8 +188,8 @@ var user = function () {
|
|
|
188
188
|
var userPlugins = function () {
|
|
189
189
|
return '/api/user/plugins';
|
|
190
190
|
};
|
|
191
|
-
var messages = function (
|
|
192
|
-
return "/api/messages/".concat(
|
|
191
|
+
var messages = function (conversationId, messageId) {
|
|
192
|
+
return "/api/messages/".concat(conversationId).concat(messageId ? "/".concat(messageId) : '');
|
|
193
193
|
};
|
|
194
194
|
var abortRequest = function (endpoint) {
|
|
195
195
|
return "/api/ask/".concat(endpoint, "/abort");
|
|
@@ -265,8 +265,8 @@ function deleteConversation(payload) {
|
|
|
265
265
|
function clearAllConversations() {
|
|
266
266
|
return request.post(deleteConversation$1(), { arg: {} });
|
|
267
267
|
}
|
|
268
|
-
function getMessagesByConvoId(
|
|
269
|
-
return request.get(messages(
|
|
268
|
+
function getMessagesByConvoId(conversationId) {
|
|
269
|
+
return request.get(messages(conversationId));
|
|
270
270
|
}
|
|
271
271
|
function getConversationById(id) {
|
|
272
272
|
return request.get(conversationById(id));
|
|
@@ -274,6 +274,13 @@ function getConversationById(id) {
|
|
|
274
274
|
function updateConversation(payload) {
|
|
275
275
|
return request.post(updateConversation$1(), { arg: payload });
|
|
276
276
|
}
|
|
277
|
+
function updateMessage(payload) {
|
|
278
|
+
var conversationId = payload.conversationId, messageId = payload.messageId, text = payload.text;
|
|
279
|
+
if (!conversationId) {
|
|
280
|
+
throw new Error('conversationId is required');
|
|
281
|
+
}
|
|
282
|
+
return request.put(messages(conversationId, messageId), { text: text });
|
|
283
|
+
}
|
|
277
284
|
function getPresets() {
|
|
278
285
|
return request.get(presets());
|
|
279
286
|
}
|
|
@@ -345,29 +352,6 @@ exports.EModelEndpoint = void 0;
|
|
|
345
352
|
EModelEndpoint["anthropic"] = "anthropic";
|
|
346
353
|
})(exports.EModelEndpoint || (exports.EModelEndpoint = {}));
|
|
347
354
|
var eModelEndpointSchema = zod.z.nativeEnum(exports.EModelEndpoint);
|
|
348
|
-
var tMessageSchema = zod.z.object({
|
|
349
|
-
messageId: zod.z.string(),
|
|
350
|
-
clientId: zod.z.string().nullable().optional(),
|
|
351
|
-
conversationId: zod.z.string().nullable(),
|
|
352
|
-
parentMessageId: zod.z.string().nullable(),
|
|
353
|
-
sender: zod.z.string(),
|
|
354
|
-
text: zod.z.string(),
|
|
355
|
-
isCreatedByUser: zod.z.boolean(),
|
|
356
|
-
error: zod.z.boolean(),
|
|
357
|
-
createdAt: zod.z
|
|
358
|
-
.string()
|
|
359
|
-
.optional()
|
|
360
|
-
.default(function () { return new Date().toISOString(); }),
|
|
361
|
-
updatedAt: zod.z
|
|
362
|
-
.string()
|
|
363
|
-
.optional()
|
|
364
|
-
.default(function () { return new Date().toISOString(); }),
|
|
365
|
-
current: zod.z.boolean().optional(),
|
|
366
|
-
unfinished: zod.z.boolean().optional(),
|
|
367
|
-
submitting: zod.z.boolean().optional(),
|
|
368
|
-
searchResult: zod.z.boolean().optional(),
|
|
369
|
-
finish_reason: zod.z.string().optional(),
|
|
370
|
-
});
|
|
371
355
|
var tPluginAuthConfigSchema = zod.z.object({
|
|
372
356
|
authField: zod.z.string(),
|
|
373
357
|
label: zod.z.string(),
|
|
@@ -396,6 +380,35 @@ var tAgentOptionsSchema = zod.z.object({
|
|
|
396
380
|
model: zod.z.string(),
|
|
397
381
|
temperature: zod.z.number(),
|
|
398
382
|
});
|
|
383
|
+
var tMessageSchema = zod.z.object({
|
|
384
|
+
messageId: zod.z.string(),
|
|
385
|
+
clientId: zod.z.string().nullable().optional(),
|
|
386
|
+
conversationId: zod.z.string().nullable(),
|
|
387
|
+
parentMessageId: zod.z.string().nullable(),
|
|
388
|
+
responseMessageId: zod.z.string().nullable().optional(),
|
|
389
|
+
overrideParentMessageId: zod.z.string().nullable().optional(),
|
|
390
|
+
bg: zod.z.string().nullable().optional(),
|
|
391
|
+
model: zod.z.string().nullable().optional(),
|
|
392
|
+
title: zod.z.string().nullable().optional(),
|
|
393
|
+
sender: zod.z.string(),
|
|
394
|
+
text: zod.z.string(),
|
|
395
|
+
generation: zod.z.string().nullable().optional(),
|
|
396
|
+
isCreatedByUser: zod.z.boolean(),
|
|
397
|
+
error: zod.z.boolean(),
|
|
398
|
+
createdAt: zod.z
|
|
399
|
+
.string()
|
|
400
|
+
.optional()
|
|
401
|
+
.default(function () { return new Date().toISOString(); }),
|
|
402
|
+
updatedAt: zod.z
|
|
403
|
+
.string()
|
|
404
|
+
.optional()
|
|
405
|
+
.default(function () { return new Date().toISOString(); }),
|
|
406
|
+
current: zod.z.boolean().optional(),
|
|
407
|
+
unfinished: zod.z.boolean().optional(),
|
|
408
|
+
submitting: zod.z.boolean().optional(),
|
|
409
|
+
searchResult: zod.z.boolean().optional(),
|
|
410
|
+
finish_reason: zod.z.string().optional(),
|
|
411
|
+
});
|
|
399
412
|
var tConversationSchema = zod.z.object({
|
|
400
413
|
conversationId: zod.z.string().nullable(),
|
|
401
414
|
title: zod.z.string(),
|
|
@@ -684,6 +697,14 @@ var useUpdateConversationMutation = function (id) {
|
|
|
684
697
|
},
|
|
685
698
|
});
|
|
686
699
|
};
|
|
700
|
+
var useUpdateMessageMutation = function (id) {
|
|
701
|
+
var queryClient = reactQuery.useQueryClient();
|
|
702
|
+
return reactQuery.useMutation(function (payload) { return updateMessage(payload); }, {
|
|
703
|
+
onSuccess: function () {
|
|
704
|
+
queryClient.invalidateQueries([exports.QueryKeys.messages, id]);
|
|
705
|
+
},
|
|
706
|
+
});
|
|
707
|
+
};
|
|
687
708
|
var useDeleteConversationMutation = function (id) {
|
|
688
709
|
var queryClient = reactQuery.useQueryClient();
|
|
689
710
|
return reactQuery.useMutation(function (payload) { return deleteConversation(payload); }, {
|
|
@@ -1044,7 +1065,7 @@ var SSE = function (url, options) {
|
|
|
1044
1065
|
// }
|
|
1045
1066
|
|
|
1046
1067
|
function createPayload(submission) {
|
|
1047
|
-
var conversation = submission.conversation, message = submission.message, endpointOption = submission.endpointOption, isEdited = submission.isEdited;
|
|
1068
|
+
var conversation = submission.conversation, message = submission.message, endpointOption = submission.endpointOption, isEdited = submission.isEdited, isContinued = submission.isContinued;
|
|
1048
1069
|
var conversationId = tConversationSchema.parse(conversation).conversationId;
|
|
1049
1070
|
var endpoint = endpointOption.endpoint;
|
|
1050
1071
|
var endpointUrlMap = {
|
|
@@ -1061,7 +1082,7 @@ function createPayload(submission) {
|
|
|
1061
1082
|
if (isEdited) {
|
|
1062
1083
|
server = server.replace('/ask/', '/edit/');
|
|
1063
1084
|
}
|
|
1064
|
-
var payload = __assign(__assign(__assign({}, message), endpointOption), { conversationId: conversationId });
|
|
1085
|
+
var payload = __assign(__assign(__assign({}, message), endpointOption), { isContinued: isEdited && isContinued, conversationId: conversationId });
|
|
1065
1086
|
return { server: server, payload: payload };
|
|
1066
1087
|
}
|
|
1067
1088
|
|
|
@@ -1108,6 +1129,7 @@ exports.tPluginAuthConfigSchema = tPluginAuthConfigSchema;
|
|
|
1108
1129
|
exports.tPluginSchema = tPluginSchema;
|
|
1109
1130
|
exports.tPresetSchema = tPresetSchema;
|
|
1110
1131
|
exports.updateConversation = updateConversation;
|
|
1132
|
+
exports.updateMessage = updateMessage;
|
|
1111
1133
|
exports.updatePreset = updatePreset;
|
|
1112
1134
|
exports.updateTokenCount = updateTokenCount;
|
|
1113
1135
|
exports.updateUserPlugins = updateUserPlugins;
|
|
@@ -1134,6 +1156,7 @@ exports.useRequestPasswordResetMutation = useRequestPasswordResetMutation;
|
|
|
1134
1156
|
exports.useResetPasswordMutation = useResetPasswordMutation;
|
|
1135
1157
|
exports.useSearchQuery = useSearchQuery;
|
|
1136
1158
|
exports.useUpdateConversationMutation = useUpdateConversationMutation;
|
|
1159
|
+
exports.useUpdateMessageMutation = useUpdateMessageMutation;
|
|
1137
1160
|
exports.useUpdatePresetMutation = useUpdatePresetMutation;
|
|
1138
1161
|
exports.useUpdateTokenCountMutation = useUpdateTokenCountMutation;
|
|
1139
1162
|
exports.useUpdateUserPluginsMutation = useUpdateUserPluginsMutation;
|
package/package.json
CHANGED
package/src/api-endpoints.ts
CHANGED
|
@@ -6,8 +6,8 @@ export const userPlugins = () => {
|
|
|
6
6
|
return '/api/user/plugins';
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const messages = (
|
|
10
|
-
return `/api/messages/${
|
|
9
|
+
export const messages = (conversationId: string, messageId?: string) => {
|
|
10
|
+
return `/api/messages/${conversationId}${messageId ? `/${messageId}` : ''}`;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export const abortRequest = (endpoint: string) => {
|
package/src/createPayload.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { tConversationSchema } from './schemas';
|
|
|
2
2
|
import { TSubmission, EModelEndpoint } from './types';
|
|
3
3
|
|
|
4
4
|
export default function createPayload(submission: TSubmission) {
|
|
5
|
-
const { conversation, message, endpointOption, isEdited } = submission;
|
|
5
|
+
const { conversation, message, endpointOption, isEdited, isContinued } = submission;
|
|
6
6
|
const { conversationId } = tConversationSchema.parse(conversation);
|
|
7
7
|
const { endpoint } = endpointOption as { endpoint: EModelEndpoint };
|
|
8
8
|
|
|
@@ -26,6 +26,7 @@ export default function createPayload(submission: TSubmission) {
|
|
|
26
26
|
const payload = {
|
|
27
27
|
...message,
|
|
28
28
|
...endpointOption,
|
|
29
|
+
isContinued: isEdited && isContinued,
|
|
29
30
|
conversationId,
|
|
30
31
|
};
|
|
31
32
|
|
package/src/data-service.ts
CHANGED
|
@@ -24,8 +24,8 @@ export function clearAllConversations(): Promise<unknown> {
|
|
|
24
24
|
return request.post(endpoints.deleteConversation(), { arg: {} });
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function getMessagesByConvoId(
|
|
28
|
-
return request.get(endpoints.messages(
|
|
27
|
+
export function getMessagesByConvoId(conversationId: string): Promise<s.TMessage[]> {
|
|
28
|
+
return request.get(endpoints.messages(conversationId));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function getConversationById(id: string): Promise<s.TConversation> {
|
|
@@ -38,6 +38,15 @@ export function updateConversation(
|
|
|
38
38
|
return request.post(endpoints.updateConversation(), { arg: payload });
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export function updateMessage(payload: t.TUpdateMessageRequest): Promise<unknown> {
|
|
42
|
+
const { conversationId, messageId, text } = payload;
|
|
43
|
+
if (!conversationId) {
|
|
44
|
+
throw new Error('conversationId is required');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return request.put(endpoints.messages(conversationId, messageId), { text });
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
export function getPresets(): Promise<s.TPreset[]> {
|
|
42
51
|
return request.get(endpoints.presets());
|
|
43
52
|
}
|
|
@@ -110,6 +110,17 @@ export const useUpdateConversationMutation = (
|
|
|
110
110
|
);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
+
export const useUpdateMessageMutation = (
|
|
114
|
+
id: string,
|
|
115
|
+
): UseMutationResult<unknown, unknown, t.TUpdateMessageRequest, unknown> => {
|
|
116
|
+
const queryClient = useQueryClient();
|
|
117
|
+
return useMutation((payload: t.TUpdateMessageRequest) => dataService.updateMessage(payload), {
|
|
118
|
+
onSuccess: () => {
|
|
119
|
+
queryClient.invalidateQueries([QueryKeys.messages, id]);
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
113
124
|
export const useDeleteConversationMutation = (
|
|
114
125
|
id?: string,
|
|
115
126
|
): UseMutationResult<
|
package/src/schemas.ts
CHANGED
|
@@ -12,32 +12,6 @@ export enum EModelEndpoint {
|
|
|
12
12
|
|
|
13
13
|
export const eModelEndpointSchema = z.nativeEnum(EModelEndpoint);
|
|
14
14
|
|
|
15
|
-
export const tMessageSchema = z.object({
|
|
16
|
-
messageId: z.string(),
|
|
17
|
-
clientId: z.string().nullable().optional(),
|
|
18
|
-
conversationId: z.string().nullable(),
|
|
19
|
-
parentMessageId: z.string().nullable(),
|
|
20
|
-
sender: z.string(),
|
|
21
|
-
text: z.string(),
|
|
22
|
-
isCreatedByUser: z.boolean(),
|
|
23
|
-
error: z.boolean(),
|
|
24
|
-
createdAt: z
|
|
25
|
-
.string()
|
|
26
|
-
.optional()
|
|
27
|
-
.default(() => new Date().toISOString()),
|
|
28
|
-
updatedAt: z
|
|
29
|
-
.string()
|
|
30
|
-
.optional()
|
|
31
|
-
.default(() => new Date().toISOString()),
|
|
32
|
-
current: z.boolean().optional(),
|
|
33
|
-
unfinished: z.boolean().optional(),
|
|
34
|
-
submitting: z.boolean().optional(),
|
|
35
|
-
searchResult: z.boolean().optional(),
|
|
36
|
-
finish_reason: z.string().optional(),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export type TMessage = z.input<typeof tMessageSchema>;
|
|
40
|
-
|
|
41
15
|
export const tPluginAuthConfigSchema = z.object({
|
|
42
16
|
authField: z.string(),
|
|
43
17
|
label: z.string(),
|
|
@@ -58,6 +32,20 @@ export const tPluginSchema = z.object({
|
|
|
58
32
|
|
|
59
33
|
export type TPlugin = z.infer<typeof tPluginSchema>;
|
|
60
34
|
|
|
35
|
+
export type TInput = {
|
|
36
|
+
inputStr: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type TResPlugin = {
|
|
40
|
+
plugin: string;
|
|
41
|
+
input: string;
|
|
42
|
+
thought: string;
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
outputs?: string;
|
|
45
|
+
latest?: string;
|
|
46
|
+
inputs?: TInput[];
|
|
47
|
+
};
|
|
48
|
+
|
|
61
49
|
export const tExampleSchema = z.object({
|
|
62
50
|
input: z.object({
|
|
63
51
|
content: z.string(),
|
|
@@ -76,6 +64,41 @@ export const tAgentOptionsSchema = z.object({
|
|
|
76
64
|
temperature: z.number(),
|
|
77
65
|
});
|
|
78
66
|
|
|
67
|
+
export const tMessageSchema = z.object({
|
|
68
|
+
messageId: z.string(),
|
|
69
|
+
clientId: z.string().nullable().optional(),
|
|
70
|
+
conversationId: z.string().nullable(),
|
|
71
|
+
parentMessageId: z.string().nullable(),
|
|
72
|
+
responseMessageId: z.string().nullable().optional(),
|
|
73
|
+
overrideParentMessageId: z.string().nullable().optional(),
|
|
74
|
+
bg: z.string().nullable().optional(),
|
|
75
|
+
model: z.string().nullable().optional(),
|
|
76
|
+
title: z.string().nullable().optional(),
|
|
77
|
+
sender: z.string(),
|
|
78
|
+
text: z.string(),
|
|
79
|
+
generation: z.string().nullable().optional(),
|
|
80
|
+
isCreatedByUser: z.boolean(),
|
|
81
|
+
error: z.boolean(),
|
|
82
|
+
createdAt: z
|
|
83
|
+
.string()
|
|
84
|
+
.optional()
|
|
85
|
+
.default(() => new Date().toISOString()),
|
|
86
|
+
updatedAt: z
|
|
87
|
+
.string()
|
|
88
|
+
.optional()
|
|
89
|
+
.default(() => new Date().toISOString()),
|
|
90
|
+
current: z.boolean().optional(),
|
|
91
|
+
unfinished: z.boolean().optional(),
|
|
92
|
+
submitting: z.boolean().optional(),
|
|
93
|
+
searchResult: z.boolean().optional(),
|
|
94
|
+
finish_reason: z.string().optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export type TMessage = z.input<typeof tMessageSchema> & {
|
|
98
|
+
children?: TMessage[];
|
|
99
|
+
plugin?: TResPlugin | null;
|
|
100
|
+
};
|
|
101
|
+
|
|
79
102
|
export const tConversationSchema = z.object({
|
|
80
103
|
conversationId: z.string().nullable(),
|
|
81
104
|
title: z.string(),
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TResPlugin, TMessage, TConversation, TEndpointOption } from './schemas';
|
|
2
2
|
|
|
3
3
|
export * from './schemas';
|
|
4
4
|
|
|
@@ -7,32 +7,15 @@ export type TMessages = TMessage[];
|
|
|
7
7
|
export type TMessagesAtom = TMessages | null;
|
|
8
8
|
|
|
9
9
|
export type TSubmission = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
conversationId?: string;
|
|
13
|
-
conversationSignature?: string;
|
|
14
|
-
current: boolean;
|
|
15
|
-
endpoint: EModelEndpoint | null;
|
|
16
|
-
invocationId: number;
|
|
17
|
-
isCreatedByUser: boolean;
|
|
18
|
-
jailbreak: boolean;
|
|
19
|
-
jailbreakConversationId?: string;
|
|
20
|
-
messageId: string;
|
|
21
|
-
overrideParentMessageId?: string | boolean;
|
|
22
|
-
parentMessageId?: string;
|
|
23
|
-
sender: string;
|
|
24
|
-
systemMessage?: string;
|
|
25
|
-
text: string;
|
|
26
|
-
toneStyle?: string;
|
|
27
|
-
model?: string;
|
|
28
|
-
promptPrefix?: string;
|
|
29
|
-
temperature?: number;
|
|
30
|
-
top_p?: number;
|
|
31
|
-
presence_penalty?: number;
|
|
32
|
-
frequence_penalty?: number;
|
|
10
|
+
plugin?: TResPlugin;
|
|
11
|
+
message: TMessage;
|
|
33
12
|
isEdited?: boolean;
|
|
13
|
+
isContinued?: boolean;
|
|
14
|
+
messages: TMessage[];
|
|
15
|
+
isRegenerate?: boolean;
|
|
16
|
+
conversationId?: string;
|
|
17
|
+
initialResponse: TMessage;
|
|
34
18
|
conversation: TConversation;
|
|
35
|
-
message: TMessage;
|
|
36
19
|
endpointOption: TEndpointOption;
|
|
37
20
|
};
|
|
38
21
|
|
|
@@ -55,6 +38,7 @@ export type TError = {
|
|
|
55
38
|
data?: {
|
|
56
39
|
message?: string;
|
|
57
40
|
};
|
|
41
|
+
status?: number;
|
|
58
42
|
};
|
|
59
43
|
};
|
|
60
44
|
|
|
@@ -78,6 +62,12 @@ export type TGetConversationsResponse = {
|
|
|
78
62
|
pages: string | number;
|
|
79
63
|
};
|
|
80
64
|
|
|
65
|
+
export type TUpdateMessageRequest = {
|
|
66
|
+
conversationId: string;
|
|
67
|
+
messageId: string;
|
|
68
|
+
text: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
81
71
|
export type TUpdateConversationRequest = {
|
|
82
72
|
conversationId: string;
|
|
83
73
|
title: string;
|
|
@@ -167,7 +157,7 @@ export type TResetPassword = {
|
|
|
167
157
|
};
|
|
168
158
|
|
|
169
159
|
export type TStartupConfig = {
|
|
170
|
-
appTitle:
|
|
160
|
+
appTitle: string;
|
|
171
161
|
googleLoginEnabled: boolean;
|
|
172
162
|
openidLoginEnabled: boolean;
|
|
173
163
|
githubLoginEnabled: boolean;
|
package/types/api-endpoints.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const user: () => string;
|
|
2
2
|
export declare const userPlugins: () => string;
|
|
3
|
-
export declare const messages: (
|
|
3
|
+
export declare const messages: (conversationId: string, messageId?: string) => string;
|
|
4
4
|
export declare const abortRequest: (endpoint: string) => string;
|
|
5
5
|
export declare const conversations: (pageNumber: string) => string;
|
|
6
6
|
export declare const conversationById: (id: string) => string;
|
package/types/createPayload.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { TSubmission, EModelEndpoint } from './types';
|
|
|
2
2
|
export default function createPayload(submission: TSubmission): {
|
|
3
3
|
server: string;
|
|
4
4
|
payload: {
|
|
5
|
+
isContinued: boolean | undefined;
|
|
5
6
|
conversationId: string | null;
|
|
6
7
|
endpoint: EModelEndpoint;
|
|
7
|
-
model?: string | undefined;
|
|
8
|
+
model?: string | null | undefined;
|
|
8
9
|
promptPrefix?: string | undefined;
|
|
9
10
|
temperature?: number | undefined;
|
|
10
11
|
chatGptLabel?: string | null | undefined;
|
|
@@ -18,6 +19,11 @@ export default function createPayload(submission: TSubmission): {
|
|
|
18
19
|
text: string;
|
|
19
20
|
isCreatedByUser: boolean;
|
|
20
21
|
clientId?: string | null | undefined;
|
|
22
|
+
responseMessageId?: string | null | undefined;
|
|
23
|
+
overrideParentMessageId?: string | null | undefined;
|
|
24
|
+
bg?: string | null | undefined;
|
|
25
|
+
title?: string | null | undefined;
|
|
26
|
+
generation?: string | null | undefined;
|
|
21
27
|
createdAt?: string | undefined;
|
|
22
28
|
updatedAt?: string | undefined;
|
|
23
29
|
current?: boolean | undefined;
|
|
@@ -25,5 +31,7 @@ export default function createPayload(submission: TSubmission): {
|
|
|
25
31
|
submitting?: boolean | undefined;
|
|
26
32
|
searchResult?: boolean | undefined;
|
|
27
33
|
finish_reason?: string | undefined;
|
|
34
|
+
children?: import("./schemas").TMessage[] | undefined;
|
|
35
|
+
plugin?: import("./schemas").TResPlugin | null | undefined;
|
|
28
36
|
};
|
|
29
37
|
};
|
package/types/data-service.d.ts
CHANGED
|
@@ -4,9 +4,10 @@ export declare function getConversations(pageNumber: string): Promise<t.TGetConv
|
|
|
4
4
|
export declare function abortRequestWithMessage(endpoint: string, abortKey: string, message: string): Promise<void>;
|
|
5
5
|
export declare function deleteConversation(payload: t.TDeleteConversationRequest): Promise<any>;
|
|
6
6
|
export declare function clearAllConversations(): Promise<unknown>;
|
|
7
|
-
export declare function getMessagesByConvoId(
|
|
7
|
+
export declare function getMessagesByConvoId(conversationId: string): Promise<s.TMessage[]>;
|
|
8
8
|
export declare function getConversationById(id: string): Promise<s.TConversation>;
|
|
9
9
|
export declare function updateConversation(payload: t.TUpdateConversationRequest): Promise<t.TUpdateConversationResponse>;
|
|
10
|
+
export declare function updateMessage(payload: t.TUpdateMessageRequest): Promise<unknown>;
|
|
10
11
|
export declare function getPresets(): Promise<s.TPreset[]>;
|
|
11
12
|
export declare function createPreset(payload: s.TPreset): Promise<s.TPreset[]>;
|
|
12
13
|
export declare function updatePreset(payload: s.TPreset): Promise<s.TPreset[]>;
|
|
@@ -24,6 +24,7 @@ export declare const useGetMessagesByConvoId: (id: string, config?: UseQueryOpti
|
|
|
24
24
|
export declare const useGetConversationByIdQuery: (id: string, config?: UseQueryOptions<s.TConversation>) => QueryObserverResult<s.TConversation>;
|
|
25
25
|
export declare const useGetConversationByIdMutation: (id: string) => UseMutationResult<s.TConversation>;
|
|
26
26
|
export declare const useUpdateConversationMutation: (id: string) => UseMutationResult<t.TUpdateConversationResponse, unknown, t.TUpdateConversationRequest, unknown>;
|
|
27
|
+
export declare const useUpdateMessageMutation: (id: string) => UseMutationResult<unknown, unknown, t.TUpdateMessageRequest, unknown>;
|
|
27
28
|
export declare const useDeleteConversationMutation: (id?: string) => UseMutationResult<t.TDeleteConversationResponse, unknown, t.TDeleteConversationRequest, unknown>;
|
|
28
29
|
export declare const useClearConversationsMutation: () => UseMutationResult<unknown>;
|
|
29
30
|
export declare const useGetConversationsQuery: (pageNumber: string, config?: UseQueryOptions<t.TGetConversationsResponse>) => QueryObserverResult<t.TGetConversationsResponse>;
|
package/types/schemas.d.ts
CHANGED
|
@@ -9,56 +9,6 @@ export declare enum EModelEndpoint {
|
|
|
9
9
|
anthropic = "anthropic"
|
|
10
10
|
}
|
|
11
11
|
export declare const eModelEndpointSchema: z.ZodNativeEnum<typeof EModelEndpoint>;
|
|
12
|
-
export declare const tMessageSchema: z.ZodObject<{
|
|
13
|
-
messageId: z.ZodString;
|
|
14
|
-
clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
-
conversationId: z.ZodNullable<z.ZodString>;
|
|
16
|
-
parentMessageId: z.ZodNullable<z.ZodString>;
|
|
17
|
-
sender: z.ZodString;
|
|
18
|
-
text: z.ZodString;
|
|
19
|
-
isCreatedByUser: z.ZodBoolean;
|
|
20
|
-
error: z.ZodBoolean;
|
|
21
|
-
createdAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
22
|
-
updatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
23
|
-
current: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
-
unfinished: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
-
submitting: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
searchResult: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
-
finish_reason: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
messageId: string;
|
|
30
|
-
conversationId: string | null;
|
|
31
|
-
parentMessageId: string | null;
|
|
32
|
-
sender: string;
|
|
33
|
-
text: string;
|
|
34
|
-
isCreatedByUser: boolean;
|
|
35
|
-
error: boolean;
|
|
36
|
-
createdAt: string;
|
|
37
|
-
updatedAt: string;
|
|
38
|
-
clientId?: string | null | undefined;
|
|
39
|
-
current?: boolean | undefined;
|
|
40
|
-
unfinished?: boolean | undefined;
|
|
41
|
-
submitting?: boolean | undefined;
|
|
42
|
-
searchResult?: boolean | undefined;
|
|
43
|
-
finish_reason?: string | undefined;
|
|
44
|
-
}, {
|
|
45
|
-
messageId: string;
|
|
46
|
-
conversationId: string | null;
|
|
47
|
-
parentMessageId: string | null;
|
|
48
|
-
sender: string;
|
|
49
|
-
text: string;
|
|
50
|
-
isCreatedByUser: boolean;
|
|
51
|
-
error: boolean;
|
|
52
|
-
clientId?: string | null | undefined;
|
|
53
|
-
createdAt?: string | undefined;
|
|
54
|
-
updatedAt?: string | undefined;
|
|
55
|
-
current?: boolean | undefined;
|
|
56
|
-
unfinished?: boolean | undefined;
|
|
57
|
-
submitting?: boolean | undefined;
|
|
58
|
-
searchResult?: boolean | undefined;
|
|
59
|
-
finish_reason?: string | undefined;
|
|
60
|
-
}>;
|
|
61
|
-
export type TMessage = z.input<typeof tMessageSchema>;
|
|
62
12
|
export declare const tPluginAuthConfigSchema: z.ZodObject<{
|
|
63
13
|
authField: z.ZodString;
|
|
64
14
|
label: z.ZodString;
|
|
@@ -119,6 +69,18 @@ export declare const tPluginSchema: z.ZodObject<{
|
|
|
119
69
|
isButton?: boolean | undefined;
|
|
120
70
|
}>;
|
|
121
71
|
export type TPlugin = z.infer<typeof tPluginSchema>;
|
|
72
|
+
export type TInput = {
|
|
73
|
+
inputStr: string;
|
|
74
|
+
};
|
|
75
|
+
export type TResPlugin = {
|
|
76
|
+
plugin: string;
|
|
77
|
+
input: string;
|
|
78
|
+
thought: string;
|
|
79
|
+
loading?: boolean;
|
|
80
|
+
outputs?: string;
|
|
81
|
+
latest?: string;
|
|
82
|
+
inputs?: TInput[];
|
|
83
|
+
};
|
|
122
84
|
export declare const tExampleSchema: z.ZodObject<{
|
|
123
85
|
input: z.ZodObject<{
|
|
124
86
|
content: z.ZodString;
|
|
@@ -166,6 +128,77 @@ export declare const tAgentOptionsSchema: z.ZodObject<{
|
|
|
166
128
|
model: string;
|
|
167
129
|
temperature: number;
|
|
168
130
|
}>;
|
|
131
|
+
export declare const tMessageSchema: z.ZodObject<{
|
|
132
|
+
messageId: z.ZodString;
|
|
133
|
+
clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
+
conversationId: z.ZodNullable<z.ZodString>;
|
|
135
|
+
parentMessageId: z.ZodNullable<z.ZodString>;
|
|
136
|
+
responseMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
overrideParentMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
138
|
+
bg: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
139
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
140
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
sender: z.ZodString;
|
|
142
|
+
text: z.ZodString;
|
|
143
|
+
generation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
144
|
+
isCreatedByUser: z.ZodBoolean;
|
|
145
|
+
error: z.ZodBoolean;
|
|
146
|
+
createdAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
147
|
+
updatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
148
|
+
current: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
unfinished: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
submitting: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
searchResult: z.ZodOptional<z.ZodBoolean>;
|
|
152
|
+
finish_reason: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
error: boolean;
|
|
155
|
+
messageId: string;
|
|
156
|
+
conversationId: string | null;
|
|
157
|
+
parentMessageId: string | null;
|
|
158
|
+
sender: string;
|
|
159
|
+
text: string;
|
|
160
|
+
isCreatedByUser: boolean;
|
|
161
|
+
createdAt: string;
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
clientId?: string | null | undefined;
|
|
164
|
+
responseMessageId?: string | null | undefined;
|
|
165
|
+
overrideParentMessageId?: string | null | undefined;
|
|
166
|
+
bg?: string | null | undefined;
|
|
167
|
+
model?: string | null | undefined;
|
|
168
|
+
title?: string | null | undefined;
|
|
169
|
+
generation?: string | null | undefined;
|
|
170
|
+
current?: boolean | undefined;
|
|
171
|
+
unfinished?: boolean | undefined;
|
|
172
|
+
submitting?: boolean | undefined;
|
|
173
|
+
searchResult?: boolean | undefined;
|
|
174
|
+
finish_reason?: string | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
error: boolean;
|
|
177
|
+
messageId: string;
|
|
178
|
+
conversationId: string | null;
|
|
179
|
+
parentMessageId: string | null;
|
|
180
|
+
sender: string;
|
|
181
|
+
text: string;
|
|
182
|
+
isCreatedByUser: boolean;
|
|
183
|
+
clientId?: string | null | undefined;
|
|
184
|
+
responseMessageId?: string | null | undefined;
|
|
185
|
+
overrideParentMessageId?: string | null | undefined;
|
|
186
|
+
bg?: string | null | undefined;
|
|
187
|
+
model?: string | null | undefined;
|
|
188
|
+
title?: string | null | undefined;
|
|
189
|
+
generation?: string | null | undefined;
|
|
190
|
+
createdAt?: string | undefined;
|
|
191
|
+
updatedAt?: string | undefined;
|
|
192
|
+
current?: boolean | undefined;
|
|
193
|
+
unfinished?: boolean | undefined;
|
|
194
|
+
submitting?: boolean | undefined;
|
|
195
|
+
searchResult?: boolean | undefined;
|
|
196
|
+
finish_reason?: string | undefined;
|
|
197
|
+
}>;
|
|
198
|
+
export type TMessage = z.input<typeof tMessageSchema> & {
|
|
199
|
+
children?: TMessage[];
|
|
200
|
+
plugin?: TResPlugin | null;
|
|
201
|
+
};
|
|
169
202
|
export declare const tConversationSchema: z.ZodObject<{
|
|
170
203
|
conversationId: z.ZodNullable<z.ZodString>;
|
|
171
204
|
title: z.ZodString;
|
|
@@ -289,9 +322,9 @@ export declare const tConversationSchema: z.ZodObject<{
|
|
|
289
322
|
}>>>;
|
|
290
323
|
}, "strip", z.ZodTypeAny, {
|
|
291
324
|
conversationId: string | null;
|
|
325
|
+
title: string;
|
|
292
326
|
createdAt: string;
|
|
293
327
|
updatedAt: string;
|
|
294
|
-
title: string;
|
|
295
328
|
endpoint: EModelEndpoint | null;
|
|
296
329
|
user?: string | undefined;
|
|
297
330
|
suggestions?: string[] | undefined;
|
|
@@ -346,9 +379,9 @@ export declare const tConversationSchema: z.ZodObject<{
|
|
|
346
379
|
} | null | undefined;
|
|
347
380
|
}, {
|
|
348
381
|
conversationId: string | null;
|
|
382
|
+
title: string;
|
|
349
383
|
createdAt: string;
|
|
350
384
|
updatedAt: string;
|
|
351
|
-
title: string;
|
|
352
385
|
endpoint: EModelEndpoint | null;
|
|
353
386
|
user?: string | undefined;
|
|
354
387
|
suggestions?: string[] | undefined;
|
|
@@ -404,10 +437,10 @@ export declare const tConversationSchema: z.ZodObject<{
|
|
|
404
437
|
}>;
|
|
405
438
|
export type TConversation = z.infer<typeof tConversationSchema>;
|
|
406
439
|
export declare const tPresetSchema: z.ZodObject<{
|
|
407
|
-
clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
408
|
-
parentMessageId: z.ZodOptional<z.ZodString>;
|
|
409
440
|
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
410
441
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
442
|
+
clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
443
|
+
parentMessageId: z.ZodOptional<z.ZodString>;
|
|
411
444
|
user: z.ZodOptional<z.ZodString>;
|
|
412
445
|
endpoint: z.ZodNullable<z.ZodNativeEnum<typeof EModelEndpoint>>;
|
|
413
446
|
suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -525,10 +558,10 @@ export declare const tPresetSchema: z.ZodObject<{
|
|
|
525
558
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
526
559
|
}, "strip", z.ZodTypeAny, {
|
|
527
560
|
endpoint: EModelEndpoint | null;
|
|
528
|
-
clientId?: string | null | undefined;
|
|
529
|
-
parentMessageId?: string | undefined;
|
|
530
561
|
model?: string | null | undefined;
|
|
531
562
|
temperature?: number | undefined;
|
|
563
|
+
clientId?: string | null | undefined;
|
|
564
|
+
parentMessageId?: string | undefined;
|
|
532
565
|
user?: string | undefined;
|
|
533
566
|
suggestions?: string[] | undefined;
|
|
534
567
|
messages?: string[] | undefined;
|
|
@@ -581,10 +614,10 @@ export declare const tPresetSchema: z.ZodObject<{
|
|
|
581
614
|
title?: string | null | undefined;
|
|
582
615
|
}, {
|
|
583
616
|
endpoint: EModelEndpoint | null;
|
|
584
|
-
clientId?: string | null | undefined;
|
|
585
|
-
parentMessageId?: string | undefined;
|
|
586
617
|
model?: string | null | undefined;
|
|
587
618
|
temperature?: number | undefined;
|
|
619
|
+
clientId?: string | null | undefined;
|
|
620
|
+
parentMessageId?: string | undefined;
|
|
588
621
|
user?: string | undefined;
|
|
589
622
|
suggestions?: string[] | undefined;
|
|
590
623
|
messages?: string[] | undefined;
|
package/types/types.d.ts
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TResPlugin, TMessage, TConversation, TEndpointOption } from './schemas';
|
|
2
2
|
export * from './schemas';
|
|
3
3
|
export type TMessages = TMessage[];
|
|
4
4
|
export type TMessagesAtom = TMessages | null;
|
|
5
5
|
export type TSubmission = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
conversationId?: string;
|
|
9
|
-
conversationSignature?: string;
|
|
10
|
-
current: boolean;
|
|
11
|
-
endpoint: EModelEndpoint | null;
|
|
12
|
-
invocationId: number;
|
|
13
|
-
isCreatedByUser: boolean;
|
|
14
|
-
jailbreak: boolean;
|
|
15
|
-
jailbreakConversationId?: string;
|
|
16
|
-
messageId: string;
|
|
17
|
-
overrideParentMessageId?: string | boolean;
|
|
18
|
-
parentMessageId?: string;
|
|
19
|
-
sender: string;
|
|
20
|
-
systemMessage?: string;
|
|
21
|
-
text: string;
|
|
22
|
-
toneStyle?: string;
|
|
23
|
-
model?: string;
|
|
24
|
-
promptPrefix?: string;
|
|
25
|
-
temperature?: number;
|
|
26
|
-
top_p?: number;
|
|
27
|
-
presence_penalty?: number;
|
|
28
|
-
frequence_penalty?: number;
|
|
6
|
+
plugin?: TResPlugin;
|
|
7
|
+
message: TMessage;
|
|
29
8
|
isEdited?: boolean;
|
|
9
|
+
isContinued?: boolean;
|
|
10
|
+
messages: TMessage[];
|
|
11
|
+
isRegenerate?: boolean;
|
|
12
|
+
conversationId?: string;
|
|
13
|
+
initialResponse: TMessage;
|
|
30
14
|
conversation: TConversation;
|
|
31
|
-
message: TMessage;
|
|
32
15
|
endpointOption: TEndpointOption;
|
|
33
16
|
};
|
|
34
17
|
export type TPluginAction = {
|
|
@@ -48,6 +31,7 @@ export type TError = {
|
|
|
48
31
|
data?: {
|
|
49
32
|
message?: string;
|
|
50
33
|
};
|
|
34
|
+
status?: number;
|
|
51
35
|
};
|
|
52
36
|
};
|
|
53
37
|
export type TUser = {
|
|
@@ -68,6 +52,11 @@ export type TGetConversationsResponse = {
|
|
|
68
52
|
pageSize: string | number;
|
|
69
53
|
pages: string | number;
|
|
70
54
|
};
|
|
55
|
+
export type TUpdateMessageRequest = {
|
|
56
|
+
conversationId: string;
|
|
57
|
+
messageId: string;
|
|
58
|
+
text: string;
|
|
59
|
+
};
|
|
71
60
|
export type TUpdateConversationRequest = {
|
|
72
61
|
conversationId: string;
|
|
73
62
|
title: string;
|
|
@@ -141,7 +130,7 @@ export type TResetPassword = {
|
|
|
141
130
|
confirm_password?: string;
|
|
142
131
|
};
|
|
143
132
|
export type TStartupConfig = {
|
|
144
|
-
appTitle:
|
|
133
|
+
appTitle: string;
|
|
145
134
|
googleLoginEnabled: boolean;
|
|
146
135
|
openidLoginEnabled: boolean;
|
|
147
136
|
githubLoginEnabled: boolean;
|