librechat-data-provider 0.7.430 → 0.7.692
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/check_updates.sh +1 -0
- 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 +4 -4
- package/server-rollup.config.js +2 -2
- package/specs/actions.spec.ts +299 -28
- package/specs/azure.spec.ts +8 -5
- package/src/actions.ts +114 -43
- package/src/api-endpoints.ts +16 -11
- package/src/azure.ts +38 -32
- package/src/config.ts +126 -68
- package/src/data-service.ts +61 -6
- package/src/file-config.ts +3 -2
- package/src/generate.ts +1 -1
- package/src/index.ts +6 -4
- package/src/keys.ts +2 -0
- package/src/mcp.ts +71 -0
- package/src/models.ts +1 -1
- package/src/react-query/react-query-service.ts +17 -20
- package/src/request.ts +21 -7
- package/src/schemas.ts +104 -23
- package/src/types/agents.ts +12 -0
- package/src/types/assistants.ts +19 -2
- package/src/types/files.ts +1 -0
- package/src/types/mutations.ts +55 -5
- package/src/types/queries.ts +17 -10
- package/src/types.ts +20 -69
- package/src/zod.spec.ts +467 -0
- package/src/zod.ts +66 -0
- package/src/sse.js +0 -242
package/src/request.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import axios, {
|
|
3
|
-
import { setTokenHeader } from './headers-helpers';
|
|
2
|
+
import axios, { AxiosError, AxiosRequestConfig } from 'axios';
|
|
4
3
|
import * as endpoints from './api-endpoints';
|
|
4
|
+
import { setTokenHeader } from './headers-helpers';
|
|
5
|
+
import type * as t from './types';
|
|
5
6
|
|
|
6
7
|
async function _get<T>(url: string, options?: AxiosRequestConfig): Promise<T> {
|
|
7
8
|
const response = await axios.get(url, { ...options });
|
|
@@ -63,7 +64,13 @@ async function _patch(url: string, data?: any) {
|
|
|
63
64
|
let isRefreshing = false;
|
|
64
65
|
let failedQueue: { resolve: (value?: any) => void; reject: (reason?: any) => void }[] = [];
|
|
65
66
|
|
|
66
|
-
const refreshToken = (retry?: boolean) =>
|
|
67
|
+
const refreshToken = (retry?: boolean): Promise<t.TRefreshTokenResponse | undefined> =>
|
|
68
|
+
_post(endpoints.refreshToken(retry));
|
|
69
|
+
|
|
70
|
+
const dispatchTokenUpdatedEvent = (token: string) => {
|
|
71
|
+
setTokenHeader(token);
|
|
72
|
+
window.dispatchEvent(new CustomEvent('tokenUpdated', { detail: token }));
|
|
73
|
+
};
|
|
67
74
|
|
|
68
75
|
const processQueue = (error: AxiosError | null, token: string | null = null) => {
|
|
69
76
|
failedQueue.forEach((prom) => {
|
|
@@ -85,6 +92,7 @@ axios.interceptors.response.use(
|
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
if (error.response.status === 401 && !originalRequest._retry) {
|
|
95
|
+
console.warn('401 error, refreshing token');
|
|
88
96
|
originalRequest._retry = true;
|
|
89
97
|
|
|
90
98
|
if (isRefreshing) {
|
|
@@ -102,17 +110,22 @@ axios.interceptors.response.use(
|
|
|
102
110
|
isRefreshing = true;
|
|
103
111
|
|
|
104
112
|
try {
|
|
105
|
-
const
|
|
113
|
+
const response = await refreshToken(
|
|
106
114
|
// Handle edge case where we get a blank screen if the initial 401 error is from a refresh token request
|
|
107
|
-
originalRequest.url?.includes('api/auth/refresh') ? true : false,
|
|
115
|
+
originalRequest.url?.includes('api/auth/refresh') === true ? true : false,
|
|
108
116
|
);
|
|
109
117
|
|
|
118
|
+
const token = response?.token ?? '';
|
|
119
|
+
|
|
110
120
|
if (token) {
|
|
111
121
|
originalRequest.headers['Authorization'] = 'Bearer ' + token;
|
|
112
|
-
|
|
113
|
-
window.dispatchEvent(new CustomEvent('tokenUpdated', { detail: token }));
|
|
122
|
+
dispatchTokenUpdatedEvent(token);
|
|
114
123
|
processQueue(null, token);
|
|
115
124
|
return await axios(originalRequest);
|
|
125
|
+
} else if (window.location.href.includes('share/')) {
|
|
126
|
+
console.log(
|
|
127
|
+
`Refresh token failed from shared link, attempting request to ${originalRequest.url}`,
|
|
128
|
+
);
|
|
116
129
|
} else {
|
|
117
130
|
window.location.href = '/login';
|
|
118
131
|
}
|
|
@@ -139,4 +152,5 @@ export default {
|
|
|
139
152
|
deleteWithOptions: _deleteWithOptions,
|
|
140
153
|
patch: _patch,
|
|
141
154
|
refreshToken,
|
|
155
|
+
dispatchTokenUpdatedEvent,
|
|
142
156
|
};
|
package/src/schemas.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const isUUID = z.string().uuid();
|
|
|
8
8
|
export enum AuthType {
|
|
9
9
|
OVERRIDE_AUTH = 'override_auth',
|
|
10
10
|
USER_PROVIDED = 'user_provided',
|
|
11
|
-
SYSTEM_DEFINED = '
|
|
11
|
+
SYSTEM_DEFINED = 'system_defined',
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const authTypeSchema = z.nativeEnum(AuthType);
|
|
@@ -16,16 +16,19 @@ export const authTypeSchema = z.nativeEnum(AuthType);
|
|
|
16
16
|
export enum EModelEndpoint {
|
|
17
17
|
azureOpenAI = 'azureOpenAI',
|
|
18
18
|
openAI = 'openAI',
|
|
19
|
-
bingAI = 'bingAI',
|
|
20
|
-
chatGPTBrowser = 'chatGPTBrowser',
|
|
21
19
|
google = 'google',
|
|
22
|
-
gptPlugins = 'gptPlugins',
|
|
23
20
|
anthropic = 'anthropic',
|
|
24
21
|
assistants = 'assistants',
|
|
25
22
|
azureAssistants = 'azureAssistants',
|
|
26
23
|
agents = 'agents',
|
|
27
24
|
custom = 'custom',
|
|
28
25
|
bedrock = 'bedrock',
|
|
26
|
+
/** @deprecated */
|
|
27
|
+
bingAI = 'bingAI',
|
|
28
|
+
/** @deprecated */
|
|
29
|
+
chatGPTBrowser = 'chatGPTBrowser',
|
|
30
|
+
/** @deprecated */
|
|
31
|
+
gptPlugins = 'gptPlugins',
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export const paramEndpoints = new Set<EModelEndpoint | string>([
|
|
@@ -49,7 +52,11 @@ export enum BedrockProviders {
|
|
|
49
52
|
|
|
50
53
|
export const getModelKey = (endpoint: EModelEndpoint | string, model: string) => {
|
|
51
54
|
if (endpoint === EModelEndpoint.bedrock) {
|
|
52
|
-
|
|
55
|
+
const parts = model.split('.');
|
|
56
|
+
const provider = [parts[0], parts[1]].find((part) =>
|
|
57
|
+
Object.values(BedrockProviders).includes(part as BedrockProviders),
|
|
58
|
+
);
|
|
59
|
+
return (provider ?? parts[0]) as BedrockProviders;
|
|
53
60
|
}
|
|
54
61
|
return model;
|
|
55
62
|
};
|
|
@@ -128,6 +135,7 @@ export const defaultAssistantFormValues = {
|
|
|
128
135
|
code_interpreter: false,
|
|
129
136
|
image_vision: false,
|
|
130
137
|
retrieval: false,
|
|
138
|
+
append_current_datetime: false,
|
|
131
139
|
};
|
|
132
140
|
|
|
133
141
|
export const defaultAgentFormValues = {
|
|
@@ -368,8 +376,8 @@ export const tPluginSchema = z.object({
|
|
|
368
376
|
name: z.string(),
|
|
369
377
|
pluginKey: z.string(),
|
|
370
378
|
description: z.string(),
|
|
371
|
-
icon: z.string(),
|
|
372
|
-
authConfig: z.array(tPluginAuthConfigSchema),
|
|
379
|
+
icon: z.string().optional(),
|
|
380
|
+
authConfig: z.array(tPluginAuthConfigSchema).optional(),
|
|
373
381
|
authenticated: z.boolean().optional(),
|
|
374
382
|
isButton: z.boolean().optional(),
|
|
375
383
|
});
|
|
@@ -445,12 +453,13 @@ export const tMessageSchema = z.object({
|
|
|
445
453
|
bg: z.string().nullable().optional(),
|
|
446
454
|
model: z.string().nullable().optional(),
|
|
447
455
|
title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),
|
|
448
|
-
sender: z.string(),
|
|
456
|
+
sender: z.string().optional(),
|
|
449
457
|
text: z.string(),
|
|
450
458
|
generation: z.string().nullable().optional(),
|
|
451
459
|
isEdited: z.boolean().optional(),
|
|
452
460
|
isCreatedByUser: z.boolean(),
|
|
453
|
-
error: z.boolean(),
|
|
461
|
+
error: z.boolean().optional(),
|
|
462
|
+
clientTimestamp: z.string().optional(),
|
|
454
463
|
createdAt: z
|
|
455
464
|
.string()
|
|
456
465
|
.optional()
|
|
@@ -485,6 +494,7 @@ export type TMessage = z.input<typeof tMessageSchema> & {
|
|
|
485
494
|
depth?: number;
|
|
486
495
|
siblingIndex?: number;
|
|
487
496
|
attachments?: TAttachment[];
|
|
497
|
+
clientTimestamp?: string;
|
|
488
498
|
};
|
|
489
499
|
|
|
490
500
|
export const coerceNumber = z.union([z.number(), z.string()]).transform((val) => {
|
|
@@ -516,7 +526,7 @@ const DocumentType: z.ZodType<DocumentTypeValue> = z.lazy(() =>
|
|
|
516
526
|
export const tConversationSchema = z.object({
|
|
517
527
|
conversationId: z.string().nullable(),
|
|
518
528
|
endpoint: eModelEndpointSchema.nullable(),
|
|
519
|
-
endpointType: eModelEndpointSchema.optional(),
|
|
529
|
+
endpointType: eModelEndpointSchema.nullable().optional(),
|
|
520
530
|
isArchived: z.boolean().optional(),
|
|
521
531
|
title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),
|
|
522
532
|
user: z.string().optional(),
|
|
@@ -549,9 +559,9 @@ export const tConversationSchema = z.object({
|
|
|
549
559
|
createdAt: z.string(),
|
|
550
560
|
updatedAt: z.string(),
|
|
551
561
|
/* Files */
|
|
562
|
+
resendFiles: z.boolean().optional(),
|
|
552
563
|
file_ids: z.array(z.string()).optional(),
|
|
553
564
|
/* vision */
|
|
554
|
-
resendFiles: z.boolean().optional(),
|
|
555
565
|
imageDetail: eImageDetailSchema.optional(),
|
|
556
566
|
/* assistant */
|
|
557
567
|
assistant_id: z.string().optional(),
|
|
@@ -561,16 +571,17 @@ export const tConversationSchema = z.object({
|
|
|
561
571
|
region: z.string().optional(),
|
|
562
572
|
maxTokens: coerceNumber.optional(),
|
|
563
573
|
additionalModelRequestFields: DocumentType.optional(),
|
|
564
|
-
/*
|
|
574
|
+
/* assistants */
|
|
565
575
|
instructions: z.string().optional(),
|
|
566
576
|
additional_instructions: z.string().optional(),
|
|
577
|
+
append_current_datetime: z.boolean().optional(),
|
|
567
578
|
/** Used to overwrite active conversation settings when saving a Preset */
|
|
568
579
|
presetOverride: z.record(z.unknown()).optional(),
|
|
569
580
|
stop: z.array(z.string()).optional(),
|
|
570
581
|
/* frontend components */
|
|
571
|
-
iconURL: z.string().optional(),
|
|
572
582
|
greeting: z.string().optional(),
|
|
573
|
-
spec: z.string().optional(),
|
|
583
|
+
spec: z.string().nullable().optional(),
|
|
584
|
+
iconURL: z.string().nullable().optional(),
|
|
574
585
|
/*
|
|
575
586
|
Deprecated fields
|
|
576
587
|
*/
|
|
@@ -622,11 +633,77 @@ export const tConvoUpdateSchema = tConversationSchema.merge(
|
|
|
622
633
|
}),
|
|
623
634
|
);
|
|
624
635
|
|
|
625
|
-
export const
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
636
|
+
export const tQueryParamsSchema = tConversationSchema
|
|
637
|
+
.pick({
|
|
638
|
+
// librechat settings
|
|
639
|
+
/** The AI context window, overrides the system-defined window as determined by `model` value */
|
|
640
|
+
maxContextTokens: true,
|
|
641
|
+
/**
|
|
642
|
+
* Whether or not to re-submit files from previous messages on subsequent messages
|
|
643
|
+
* */
|
|
644
|
+
resendFiles: true,
|
|
645
|
+
/**
|
|
646
|
+
* @endpoints openAI, custom, azureOpenAI
|
|
647
|
+
*
|
|
648
|
+
* System parameter that only affects the above endpoints.
|
|
649
|
+
* Image detail for re-sizing according to OpenAI spec, defaults to `auto`
|
|
650
|
+
* */
|
|
651
|
+
imageDetail: true,
|
|
652
|
+
/**
|
|
653
|
+
* AKA Custom Instructions, dynamically added to chat history as a system message;
|
|
654
|
+
* for `bedrock` endpoint, this is used as the `system` model param if the provider uses it;
|
|
655
|
+
* for `assistants` endpoint, this is used as the `additional_instructions` model param:
|
|
656
|
+
* https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_instructions
|
|
657
|
+
* ; otherwise, a message with `system` role is added to the chat history
|
|
658
|
+
*/
|
|
659
|
+
promptPrefix: true,
|
|
660
|
+
// Model parameters
|
|
661
|
+
/** @endpoints openAI, custom, azureOpenAI, google, anthropic, assistants, azureAssistants, bedrock */
|
|
662
|
+
model: true,
|
|
663
|
+
/** @endpoints openAI, custom, azureOpenAI, google, anthropic, bedrock */
|
|
664
|
+
temperature: true,
|
|
665
|
+
/** @endpoints openAI, custom, azureOpenAI */
|
|
666
|
+
presence_penalty: true,
|
|
667
|
+
/** @endpoints openAI, custom, azureOpenAI */
|
|
668
|
+
frequency_penalty: true,
|
|
669
|
+
/** @endpoints openAI, custom, azureOpenAI */
|
|
670
|
+
stop: true,
|
|
671
|
+
/** @endpoints openAI, custom, azureOpenAI */
|
|
672
|
+
top_p: true,
|
|
673
|
+
/** @endpoints openAI, custom, azureOpenAI */
|
|
674
|
+
max_tokens: true,
|
|
675
|
+
/** @endpoints google, anthropic, bedrock */
|
|
676
|
+
topP: true,
|
|
677
|
+
/** @endpoints google, anthropic */
|
|
678
|
+
topK: true,
|
|
679
|
+
/** @endpoints google, anthropic */
|
|
680
|
+
maxOutputTokens: true,
|
|
681
|
+
/** @endpoints anthropic */
|
|
682
|
+
promptCache: true,
|
|
683
|
+
/** @endpoints bedrock */
|
|
684
|
+
region: true,
|
|
685
|
+
/** @endpoints bedrock */
|
|
686
|
+
maxTokens: true,
|
|
687
|
+
/** @endpoints agents */
|
|
688
|
+
agent_id: true,
|
|
689
|
+
/** @endpoints assistants, azureAssistants */
|
|
690
|
+
assistant_id: true,
|
|
691
|
+
/** @endpoints assistants, azureAssistants */
|
|
692
|
+
append_current_datetime: true,
|
|
693
|
+
/**
|
|
694
|
+
* @endpoints assistants, azureAssistants
|
|
695
|
+
*
|
|
696
|
+
* Overrides existing assistant instructions, only used for the current run:
|
|
697
|
+
* https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-instructions
|
|
698
|
+
* */
|
|
699
|
+
instructions: true,
|
|
700
|
+
})
|
|
701
|
+
.merge(
|
|
702
|
+
z.object({
|
|
703
|
+
/** @endpoints openAI, custom, azureOpenAI, google, anthropic, assistants, azureAssistants, bedrock, agents */
|
|
704
|
+
endpoint: extendedModelEndpointSchema.nullable(),
|
|
705
|
+
}),
|
|
706
|
+
);
|
|
630
707
|
|
|
631
708
|
export type TPreset = z.infer<typeof tPresetSchema>;
|
|
632
709
|
|
|
@@ -849,6 +926,7 @@ export const assistantSchema = tConversationSchema
|
|
|
849
926
|
iconURL: true,
|
|
850
927
|
greeting: true,
|
|
851
928
|
spec: true,
|
|
929
|
+
append_current_datetime: true,
|
|
852
930
|
})
|
|
853
931
|
.transform((obj) => ({
|
|
854
932
|
...obj,
|
|
@@ -859,6 +937,7 @@ export const assistantSchema = tConversationSchema
|
|
|
859
937
|
iconURL: obj.iconURL ?? undefined,
|
|
860
938
|
greeting: obj.greeting ?? undefined,
|
|
861
939
|
spec: obj.spec ?? undefined,
|
|
940
|
+
append_current_datetime: obj.append_current_datetime ?? false,
|
|
862
941
|
}))
|
|
863
942
|
.catch(() => ({
|
|
864
943
|
model: openAISettings.model.default,
|
|
@@ -868,6 +947,7 @@ export const assistantSchema = tConversationSchema
|
|
|
868
947
|
iconURL: undefined,
|
|
869
948
|
greeting: undefined,
|
|
870
949
|
spec: undefined,
|
|
950
|
+
append_current_datetime: false,
|
|
871
951
|
}));
|
|
872
952
|
|
|
873
953
|
export const compactAssistantSchema = tConversationSchema
|
|
@@ -1096,13 +1176,14 @@ export type TBanner = z.infer<typeof tBannerSchema>;
|
|
|
1096
1176
|
|
|
1097
1177
|
export const compactAgentsSchema = tConversationSchema
|
|
1098
1178
|
.pick({
|
|
1099
|
-
|
|
1179
|
+
spec: true,
|
|
1180
|
+
// model: true,
|
|
1181
|
+
iconURL: true,
|
|
1182
|
+
greeting: true,
|
|
1100
1183
|
agent_id: true,
|
|
1184
|
+
resendFiles: true,
|
|
1101
1185
|
instructions: true,
|
|
1102
1186
|
additional_instructions: true,
|
|
1103
|
-
iconURL: true,
|
|
1104
|
-
greeting: true,
|
|
1105
|
-
spec: true,
|
|
1106
1187
|
})
|
|
1107
1188
|
.transform(removeNullishValues)
|
|
1108
1189
|
.catch(() => ({}));
|
package/src/types/agents.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
2
|
import { StepTypes, ContentTypes, ToolCallTypes } from './runs';
|
|
3
3
|
import type { FunctionToolCall } from './assistants';
|
|
4
|
+
import type { TAttachment } from 'src/schemas';
|
|
4
5
|
|
|
5
6
|
export namespace Agents {
|
|
6
7
|
export type MessageType = 'human' | 'ai' | 'generic' | 'system' | 'function' | 'tool' | 'remove';
|
|
@@ -218,3 +219,14 @@ export namespace Agents {
|
|
|
218
219
|
}
|
|
219
220
|
export type ContentType = ContentTypes.TEXT | ContentTypes.IMAGE_URL | string;
|
|
220
221
|
}
|
|
222
|
+
|
|
223
|
+
export type ToolCallResult = {
|
|
224
|
+
user: string;
|
|
225
|
+
toolId: string;
|
|
226
|
+
result?: unknown;
|
|
227
|
+
messageId: string;
|
|
228
|
+
partIndex?: number;
|
|
229
|
+
blockIndex?: number;
|
|
230
|
+
conversationId: string;
|
|
231
|
+
attachments?: TAttachment[];
|
|
232
|
+
};
|
package/src/types/assistants.ts
CHANGED
|
@@ -100,6 +100,7 @@ export type AssistantCreateParams = {
|
|
|
100
100
|
tools?: Array<FunctionTool | string>;
|
|
101
101
|
endpoint: AssistantsEndpoint;
|
|
102
102
|
version: number | string;
|
|
103
|
+
append_current_datetime?: boolean;
|
|
103
104
|
};
|
|
104
105
|
|
|
105
106
|
export type AssistantUpdateParams = {
|
|
@@ -113,6 +114,7 @@ export type AssistantUpdateParams = {
|
|
|
113
114
|
tools?: Array<FunctionTool | string>;
|
|
114
115
|
tool_resources?: ToolResources;
|
|
115
116
|
endpoint: AssistantsEndpoint;
|
|
117
|
+
append_current_datetime?: boolean;
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
export type AssistantListParams = {
|
|
@@ -147,6 +149,7 @@ export type File = {
|
|
|
147
149
|
export type AgentParameterValue = number | null;
|
|
148
150
|
|
|
149
151
|
export type AgentModelParameters = {
|
|
152
|
+
model?: string;
|
|
150
153
|
temperature: AgentParameterValue;
|
|
151
154
|
max_context_tokens: AgentParameterValue;
|
|
152
155
|
max_output_tokens: AgentParameterValue;
|
|
@@ -165,6 +168,10 @@ export interface ExecuteCodeResource {
|
|
|
165
168
|
* There can be a maximum of 20 files associated with the tool.
|
|
166
169
|
*/
|
|
167
170
|
file_ids?: Array<string>;
|
|
171
|
+
/**
|
|
172
|
+
* A list of files already fetched.
|
|
173
|
+
*/
|
|
174
|
+
files?: Array<TFile>;
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
export interface AgentFileSearchResource {
|
|
@@ -178,12 +185,18 @@ export interface AgentFileSearchResource {
|
|
|
178
185
|
* To be used before vector stores are implemented.
|
|
179
186
|
*/
|
|
180
187
|
file_ids?: Array<string>;
|
|
188
|
+
/**
|
|
189
|
+
* A list of files already fetched.
|
|
190
|
+
*/
|
|
191
|
+
files?: Array<TFile>;
|
|
181
192
|
}
|
|
182
193
|
|
|
183
194
|
export type Agent = {
|
|
184
195
|
id: string;
|
|
185
196
|
name: string | null;
|
|
186
197
|
author?: string | null;
|
|
198
|
+
/** The original custom endpoint name, lowercased */
|
|
199
|
+
endpoint?: string | null;
|
|
187
200
|
authorName?: string | null;
|
|
188
201
|
description: string | null;
|
|
189
202
|
created_at: number;
|
|
@@ -199,6 +212,9 @@ export type Agent = {
|
|
|
199
212
|
conversation_starters?: string[];
|
|
200
213
|
isCollaborative?: boolean;
|
|
201
214
|
tool_resources?: AgentToolResources;
|
|
215
|
+
agent_ids?: string[];
|
|
216
|
+
end_after_tools?: boolean;
|
|
217
|
+
hide_sequential_outputs?: boolean;
|
|
202
218
|
};
|
|
203
219
|
|
|
204
220
|
export type TAgentsMap = Record<string, Agent | undefined>;
|
|
@@ -213,7 +229,7 @@ export type AgentCreateParams = {
|
|
|
213
229
|
provider: AgentProvider;
|
|
214
230
|
model: string | null;
|
|
215
231
|
model_parameters: AgentModelParameters;
|
|
216
|
-
}
|
|
232
|
+
} & Pick<Agent, 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs'>;
|
|
217
233
|
|
|
218
234
|
export type AgentUpdateParams = {
|
|
219
235
|
name?: string | null;
|
|
@@ -229,7 +245,7 @@ export type AgentUpdateParams = {
|
|
|
229
245
|
projectIds?: string[];
|
|
230
246
|
removeProjectIds?: string[];
|
|
231
247
|
isCollaborative?: boolean;
|
|
232
|
-
}
|
|
248
|
+
} & Pick<Agent, 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs'>;
|
|
233
249
|
|
|
234
250
|
export type AgentListParams = {
|
|
235
251
|
limit?: number;
|
|
@@ -514,6 +530,7 @@ export type AssistantDocument = {
|
|
|
514
530
|
actions?: string[];
|
|
515
531
|
createdAt?: Date;
|
|
516
532
|
updatedAt?: Date;
|
|
533
|
+
append_current_datetime?: boolean;
|
|
517
534
|
};
|
|
518
535
|
|
|
519
536
|
/* Agent types */
|
package/src/types/files.ts
CHANGED
package/src/types/mutations.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as types from '../types';
|
|
2
2
|
import * as r from '../roles';
|
|
3
3
|
import {
|
|
4
|
+
Tools,
|
|
4
5
|
Assistant,
|
|
5
6
|
AssistantCreateParams,
|
|
6
7
|
AssistantUpdateParams,
|
|
@@ -125,6 +126,15 @@ export type UpdateAgentVariables = {
|
|
|
125
126
|
|
|
126
127
|
export type UpdateAgentMutationOptions = MutationOptions<Agent, UpdateAgentVariables>;
|
|
127
128
|
|
|
129
|
+
export type DuplicateAgentBody = {
|
|
130
|
+
agent_id: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export type DuplicateAgentMutationOptions = MutationOptions<
|
|
134
|
+
{ agent: Agent; actions: Action[] },
|
|
135
|
+
Pick<DuplicateAgentBody, 'agent_id'>
|
|
136
|
+
>;
|
|
137
|
+
|
|
128
138
|
export type DeleteAgentBody = {
|
|
129
139
|
agent_id: string;
|
|
130
140
|
};
|
|
@@ -149,6 +159,11 @@ export type DeleteConversationOptions = MutationOptions<
|
|
|
149
159
|
types.TDeleteConversationRequest
|
|
150
160
|
>;
|
|
151
161
|
|
|
162
|
+
export type DuplicateConvoOptions = MutationOptions<
|
|
163
|
+
types.TDuplicateConvoResponse,
|
|
164
|
+
types.TDuplicateConvoRequest
|
|
165
|
+
>;
|
|
166
|
+
|
|
152
167
|
export type ForkConvoOptions = MutationOptions<types.TForkConvoResponse, types.TForkConvoRequest>;
|
|
153
168
|
|
|
154
169
|
export type CreateSharedLinkOptions = MutationOptions<
|
|
@@ -222,18 +237,29 @@ export type RegistrationOptions = MutationOptions<
|
|
|
222
237
|
types.TError
|
|
223
238
|
>;
|
|
224
239
|
|
|
225
|
-
export type
|
|
240
|
+
export type UpdatePermVars<T> = {
|
|
226
241
|
roleName: string;
|
|
227
|
-
updates: Partial<
|
|
242
|
+
updates: Partial<T>;
|
|
228
243
|
};
|
|
229
244
|
|
|
230
|
-
export type
|
|
245
|
+
export type UpdatePromptPermVars = UpdatePermVars<r.TPromptPermissions>;
|
|
246
|
+
|
|
247
|
+
export type UpdateAgentPermVars = UpdatePermVars<r.TAgentPermissions>;
|
|
248
|
+
|
|
249
|
+
export type UpdatePermResponse = r.TRole;
|
|
231
250
|
|
|
232
251
|
export type UpdatePromptPermOptions = MutationOptions<
|
|
233
|
-
|
|
252
|
+
UpdatePermResponse,
|
|
234
253
|
UpdatePromptPermVars,
|
|
235
254
|
unknown,
|
|
236
|
-
types.TError
|
|
255
|
+
types.TError | null | undefined
|
|
256
|
+
>;
|
|
257
|
+
|
|
258
|
+
export type UpdateAgentPermOptions = MutationOptions<
|
|
259
|
+
UpdatePermResponse,
|
|
260
|
+
UpdateAgentPermVars,
|
|
261
|
+
unknown,
|
|
262
|
+
types.TError | null | undefined
|
|
237
263
|
>;
|
|
238
264
|
|
|
239
265
|
export type UpdateConversationTagOptions = MutationOptions<
|
|
@@ -248,3 +274,27 @@ export type AcceptTermsMutationOptions = MutationOptions<
|
|
|
248
274
|
unknown,
|
|
249
275
|
void
|
|
250
276
|
>;
|
|
277
|
+
|
|
278
|
+
/* Tools */
|
|
279
|
+
export type UpdatePluginAuthOptions = MutationOptions<types.TUser, types.TUpdateUserPlugins>;
|
|
280
|
+
|
|
281
|
+
export type ToolParamsMap = {
|
|
282
|
+
[Tools.execute_code]: {
|
|
283
|
+
lang: string;
|
|
284
|
+
code: string;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export type ToolId = keyof ToolParamsMap;
|
|
289
|
+
|
|
290
|
+
export type ToolParams<T extends ToolId> = ToolParamsMap[T] & {
|
|
291
|
+
messageId: string;
|
|
292
|
+
partIndex?: number;
|
|
293
|
+
blockIndex?: number;
|
|
294
|
+
conversationId: string;
|
|
295
|
+
};
|
|
296
|
+
export type ToolCallResponse = { result: unknown; attachments?: types.TAttachment[] };
|
|
297
|
+
export type ToolCallMutationOptions<T extends ToolId> = MutationOptions<
|
|
298
|
+
ToolCallResponse,
|
|
299
|
+
ToolParams<T>
|
|
300
|
+
>;
|
package/src/types/queries.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { InfiniteData } from '@tanstack/react-query';
|
|
2
|
+
import type * as a from '../types/agents';
|
|
3
|
+
import type * as s from '../schemas';
|
|
2
4
|
import type * as t from '../types';
|
|
3
|
-
import type { TMessage, TConversation, TSharedLink, TConversationTag } from '../schemas';
|
|
4
5
|
|
|
5
6
|
export type Conversation = {
|
|
6
7
|
id: string;
|
|
7
8
|
createdAt: number;
|
|
8
9
|
participants: string[];
|
|
9
10
|
lastMessage: string;
|
|
10
|
-
conversations: TConversation[];
|
|
11
|
+
conversations: s.TConversation[];
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
// Parameters for listing conversations (e.g., for pagination)
|
|
@@ -24,33 +25,33 @@ export type ConversationListParams = {
|
|
|
24
25
|
|
|
25
26
|
// Type for the response from the conversation list API
|
|
26
27
|
export type ConversationListResponse = {
|
|
27
|
-
conversations: TConversation[];
|
|
28
|
+
conversations: s.TConversation[];
|
|
28
29
|
pageNumber: string;
|
|
29
30
|
pageSize: string | number;
|
|
30
31
|
pages: string | number;
|
|
31
|
-
messages: TMessage[];
|
|
32
|
+
messages: s.TMessage[];
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
export type ConversationData = InfiniteData<ConversationListResponse>;
|
|
35
36
|
export type ConversationUpdater = (
|
|
36
37
|
data: ConversationData,
|
|
37
|
-
conversation: TConversation,
|
|
38
|
+
conversation: s.TConversation,
|
|
38
39
|
) => ConversationData;
|
|
39
40
|
|
|
40
|
-
export type SharedMessagesResponse = Omit<TSharedLink, 'messages'> & {
|
|
41
|
-
messages: TMessage[];
|
|
41
|
+
export type SharedMessagesResponse = Omit<s.TSharedLink, 'messages'> & {
|
|
42
|
+
messages: s.TMessage[];
|
|
42
43
|
};
|
|
43
44
|
export type SharedLinkListParams = Omit<ConversationListParams, 'isArchived' | 'conversationId'> & {
|
|
44
45
|
isPublic?: boolean;
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
export type SharedLinksResponse = Omit<ConversationListResponse, 'conversations' | 'messages'> & {
|
|
48
|
-
sharedLinks: TSharedLink[];
|
|
49
|
+
sharedLinks: s.TSharedLink[];
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
// Type for the response from the conversation list API
|
|
52
53
|
export type SharedLinkListResponse = {
|
|
53
|
-
sharedLinks: TSharedLink[];
|
|
54
|
+
sharedLinks: s.TSharedLink[];
|
|
54
55
|
pageNumber: string;
|
|
55
56
|
pageSize: string | number;
|
|
56
57
|
pages: string | number;
|
|
@@ -71,4 +72,10 @@ export type AllPromptGroupsFilterRequest = {
|
|
|
71
72
|
|
|
72
73
|
export type AllPromptGroupsResponse = t.TPromptGroup[];
|
|
73
74
|
|
|
74
|
-
export type ConversationTagsResponse = TConversationTag[];
|
|
75
|
+
export type ConversationTagsResponse = s.TConversationTag[];
|
|
76
|
+
|
|
77
|
+
export type VerifyToolAuthParams = { toolId: string };
|
|
78
|
+
export type VerifyToolAuthResponse = { authenticated: boolean; message?: string | s.AuthType };
|
|
79
|
+
|
|
80
|
+
export type GetToolCallParams = { conversationId: string };
|
|
81
|
+
export type ToolCallResults = a.ToolCallResult[];
|