librechat-data-provider 0.7.1 → 0.7.3
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 +1 -1
- package/src/api-endpoints.ts +8 -2
- package/src/config.ts +201 -76
- package/src/data-service.ts +8 -0
- package/src/keys.ts +2 -0
- package/src/react-query/react-query-service.ts +15 -0
- package/src/schemas.ts +1 -1
- package/src/types/queries.ts +14 -0
- package/src/types.ts +5 -1
package/package.json
CHANGED
package/src/api-endpoints.ts
CHANGED
|
@@ -128,14 +128,18 @@ export const images = () => `${files()}/images`;
|
|
|
128
128
|
|
|
129
129
|
export const avatar = () => `${images()}/avatar`;
|
|
130
130
|
|
|
131
|
-
export const
|
|
131
|
+
export const speech = () => `${files()}/speech`;
|
|
132
132
|
|
|
133
|
-
export const
|
|
133
|
+
export const speechToText = () => `${speech()}/stt`;
|
|
134
|
+
|
|
135
|
+
export const textToSpeech = () => `${speech()}/tts`;
|
|
134
136
|
|
|
135
137
|
export const textToSpeechManual = () => `${textToSpeech()}/manual`;
|
|
136
138
|
|
|
137
139
|
export const textToSpeechVoices = () => `${textToSpeech()}/voices`;
|
|
138
140
|
|
|
141
|
+
export const getCustomConfigSpeech = () => `${speech()}/config/get`;
|
|
142
|
+
|
|
139
143
|
export const getPromptGroup = (_id: string) => `${prompts()}/groups/${_id}`;
|
|
140
144
|
|
|
141
145
|
export const getPromptGroupsWithFilters = (filter: object) => {
|
|
@@ -177,6 +181,8 @@ export const deletePrompt = ({ _id, groupId }: { _id: string; groupId: string })
|
|
|
177
181
|
|
|
178
182
|
export const getCategories = () => '/api/categories';
|
|
179
183
|
|
|
184
|
+
export const getAllPromptGroups = () => `${prompts()}/all`;
|
|
185
|
+
|
|
180
186
|
/* Roles */
|
|
181
187
|
export const roles = () => '/api/roles';
|
|
182
188
|
export const getRole = (roleName: string) => `${roles()}/${roleName.toLowerCase()}`;
|
package/src/config.ts
CHANGED
|
@@ -12,6 +12,8 @@ export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'd
|
|
|
12
12
|
export const defaultRetrievalModels = [
|
|
13
13
|
'gpt-4o',
|
|
14
14
|
'gpt-4o-2024-05-13',
|
|
15
|
+
'gpt-4o-mini',
|
|
16
|
+
'gpt-4o-mini-2024-07-18',
|
|
15
17
|
'gpt-4-turbo-preview',
|
|
16
18
|
'gpt-3.5-turbo-0125',
|
|
17
19
|
'gpt-4-0125-preview',
|
|
@@ -136,71 +138,81 @@ export const defaultAssistantsVersion = {
|
|
|
136
138
|
[EModelEndpoint.azureAssistants]: 1,
|
|
137
139
|
};
|
|
138
140
|
|
|
139
|
-
export const
|
|
140
|
-
|
|
141
|
-
disableBuilder: z.boolean().optional(),
|
|
142
|
-
pollIntervalMs: z.number().optional(),
|
|
143
|
-
timeoutMs: z.number().optional(),
|
|
144
|
-
version: z.union([z.string(), z.number()]).default(2),
|
|
145
|
-
supportedIds: z.array(z.string()).min(1).optional(),
|
|
146
|
-
excludedIds: z.array(z.string()).min(1).optional(),
|
|
147
|
-
privateAssistants: z.boolean().optional(),
|
|
148
|
-
retrievalModels: z.array(z.string()).min(1).optional().default(defaultRetrievalModels),
|
|
149
|
-
capabilities: z
|
|
150
|
-
.array(z.nativeEnum(Capabilities))
|
|
151
|
-
.optional()
|
|
152
|
-
.default([
|
|
153
|
-
Capabilities.code_interpreter,
|
|
154
|
-
Capabilities.image_vision,
|
|
155
|
-
Capabilities.retrieval,
|
|
156
|
-
Capabilities.actions,
|
|
157
|
-
Capabilities.tools,
|
|
158
|
-
]),
|
|
159
|
-
/* general */
|
|
160
|
-
apiKey: z.string().optional(),
|
|
161
|
-
baseURL: z.string().optional(),
|
|
162
|
-
models: z
|
|
163
|
-
.object({
|
|
164
|
-
default: z.array(z.string()).min(1),
|
|
165
|
-
fetch: z.boolean().optional(),
|
|
166
|
-
userIdQuery: z.boolean().optional(),
|
|
167
|
-
})
|
|
168
|
-
.optional(),
|
|
169
|
-
titleConvo: z.boolean().optional(),
|
|
170
|
-
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
171
|
-
titleModel: z.string().optional(),
|
|
172
|
-
headers: z.record(z.any()).optional(),
|
|
141
|
+
export const baseEndpointSchema = z.object({
|
|
142
|
+
streamRate: z.number().optional(),
|
|
173
143
|
});
|
|
174
144
|
|
|
145
|
+
export type TBaseEndpoint = z.infer<typeof baseEndpointSchema>;
|
|
146
|
+
|
|
147
|
+
export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
148
|
+
z.object({
|
|
149
|
+
/* assistants specific */
|
|
150
|
+
disableBuilder: z.boolean().optional(),
|
|
151
|
+
pollIntervalMs: z.number().optional(),
|
|
152
|
+
timeoutMs: z.number().optional(),
|
|
153
|
+
version: z.union([z.string(), z.number()]).default(2),
|
|
154
|
+
supportedIds: z.array(z.string()).min(1).optional(),
|
|
155
|
+
excludedIds: z.array(z.string()).min(1).optional(),
|
|
156
|
+
privateAssistants: z.boolean().optional(),
|
|
157
|
+
retrievalModels: z.array(z.string()).min(1).optional().default(defaultRetrievalModels),
|
|
158
|
+
capabilities: z
|
|
159
|
+
.array(z.nativeEnum(Capabilities))
|
|
160
|
+
.optional()
|
|
161
|
+
.default([
|
|
162
|
+
Capabilities.code_interpreter,
|
|
163
|
+
Capabilities.image_vision,
|
|
164
|
+
Capabilities.retrieval,
|
|
165
|
+
Capabilities.actions,
|
|
166
|
+
Capabilities.tools,
|
|
167
|
+
]),
|
|
168
|
+
/* general */
|
|
169
|
+
apiKey: z.string().optional(),
|
|
170
|
+
baseURL: z.string().optional(),
|
|
171
|
+
models: z
|
|
172
|
+
.object({
|
|
173
|
+
default: z.array(z.string()).min(1),
|
|
174
|
+
fetch: z.boolean().optional(),
|
|
175
|
+
userIdQuery: z.boolean().optional(),
|
|
176
|
+
})
|
|
177
|
+
.optional(),
|
|
178
|
+
titleConvo: z.boolean().optional(),
|
|
179
|
+
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
180
|
+
titleModel: z.string().optional(),
|
|
181
|
+
headers: z.record(z.any()).optional(),
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
184
|
+
|
|
175
185
|
export type TAssistantEndpoint = z.infer<typeof assistantEndpointSchema>;
|
|
176
186
|
|
|
177
|
-
export const endpointSchema =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
EModelEndpoint
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
export const endpointSchema = baseEndpointSchema.merge(
|
|
188
|
+
z.object({
|
|
189
|
+
name: z.string().refine((value) => !eModelEndpointSchema.safeParse(value).success, {
|
|
190
|
+
message: `Value cannot be one of the default endpoint (EModelEndpoint) values: ${Object.values(
|
|
191
|
+
EModelEndpoint,
|
|
192
|
+
).join(', ')}`,
|
|
193
|
+
}),
|
|
194
|
+
apiKey: z.string(),
|
|
195
|
+
baseURL: z.string(),
|
|
196
|
+
models: z.object({
|
|
197
|
+
default: z.array(z.string()).min(1),
|
|
198
|
+
fetch: z.boolean().optional(),
|
|
199
|
+
userIdQuery: z.boolean().optional(),
|
|
200
|
+
}),
|
|
201
|
+
titleConvo: z.boolean().optional(),
|
|
202
|
+
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
203
|
+
titleModel: z.string().optional(),
|
|
204
|
+
summarize: z.boolean().optional(),
|
|
205
|
+
summaryModel: z.string().optional(),
|
|
206
|
+
forcePrompt: z.boolean().optional(),
|
|
207
|
+
modelDisplayLabel: z.string().optional(),
|
|
208
|
+
headers: z.record(z.any()).optional(),
|
|
209
|
+
addParams: z.record(z.any()).optional(),
|
|
210
|
+
dropParams: z.array(z.string()).optional(),
|
|
211
|
+
customOrder: z.number().optional(),
|
|
212
|
+
directEndpoint: z.boolean().optional(),
|
|
213
|
+
titleMessageRole: z.string().optional(),
|
|
189
214
|
}),
|
|
190
|
-
|
|
191
|
-
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
192
|
-
titleModel: z.string().optional(),
|
|
193
|
-
summarize: z.boolean().optional(),
|
|
194
|
-
summaryModel: z.string().optional(),
|
|
195
|
-
forcePrompt: z.boolean().optional(),
|
|
196
|
-
modelDisplayLabel: z.string().optional(),
|
|
197
|
-
headers: z.record(z.any()).optional(),
|
|
198
|
-
addParams: z.record(z.any()).optional(),
|
|
199
|
-
dropParams: z.array(z.string()).optional(),
|
|
200
|
-
customOrder: z.number().optional(),
|
|
201
|
-
directEndpoint: z.boolean().optional(),
|
|
202
|
-
titleMessageRole: z.string().optional(),
|
|
203
|
-
});
|
|
215
|
+
);
|
|
204
216
|
|
|
205
217
|
export type TEndpoint = z.infer<typeof endpointSchema>;
|
|
206
218
|
|
|
@@ -213,6 +225,7 @@ export const azureEndpointSchema = z
|
|
|
213
225
|
.and(
|
|
214
226
|
endpointSchema
|
|
215
227
|
.pick({
|
|
228
|
+
streamRate: true,
|
|
216
229
|
titleConvo: true,
|
|
217
230
|
titleMethod: true,
|
|
218
231
|
titleModel: true,
|
|
@@ -233,6 +246,15 @@ const ttsOpenaiSchema = z.object({
|
|
|
233
246
|
voices: z.array(z.string()),
|
|
234
247
|
});
|
|
235
248
|
|
|
249
|
+
const ttsAzureOpenAISchema = z.object({
|
|
250
|
+
instanceName: z.string(),
|
|
251
|
+
apiKey: z.string(),
|
|
252
|
+
deploymentName: z.string(),
|
|
253
|
+
apiVersion: z.string(),
|
|
254
|
+
model: z.string(),
|
|
255
|
+
voices: z.array(z.string()),
|
|
256
|
+
});
|
|
257
|
+
|
|
236
258
|
const ttsElevenLabsSchema = z.object({
|
|
237
259
|
url: z.string().optional(),
|
|
238
260
|
websocketUrl: z.string().optional(),
|
|
@@ -259,20 +281,63 @@ const ttsLocalaiSchema = z.object({
|
|
|
259
281
|
|
|
260
282
|
const ttsSchema = z.object({
|
|
261
283
|
openai: ttsOpenaiSchema.optional(),
|
|
284
|
+
azureOpenAI: ttsAzureOpenAISchema.optional(),
|
|
262
285
|
elevenLabs: ttsElevenLabsSchema.optional(),
|
|
263
286
|
localai: ttsLocalaiSchema.optional(),
|
|
264
287
|
});
|
|
265
288
|
|
|
289
|
+
const sttOpenaiSchema = z.object({
|
|
290
|
+
url: z.string().optional(),
|
|
291
|
+
apiKey: z.string(),
|
|
292
|
+
model: z.string(),
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
const sttAzureOpenAISchema = z.object({
|
|
296
|
+
instanceName: z.string(),
|
|
297
|
+
apiKey: z.string(),
|
|
298
|
+
deploymentName: z.string(),
|
|
299
|
+
apiVersion: z.string(),
|
|
300
|
+
});
|
|
301
|
+
|
|
266
302
|
const sttSchema = z.object({
|
|
267
|
-
openai:
|
|
268
|
-
|
|
269
|
-
url: z.string().optional(),
|
|
270
|
-
apiKey: z.string().optional(),
|
|
271
|
-
model: z.string().optional(),
|
|
272
|
-
})
|
|
273
|
-
.optional(),
|
|
303
|
+
openai: sttOpenaiSchema.optional(),
|
|
304
|
+
azureOpenAI: sttAzureOpenAISchema.optional(),
|
|
274
305
|
});
|
|
275
306
|
|
|
307
|
+
const speechTab = z
|
|
308
|
+
.object({
|
|
309
|
+
conversationMode: z.boolean().optional(),
|
|
310
|
+
advancedMode: z.boolean().optional(),
|
|
311
|
+
speechToText: z
|
|
312
|
+
.boolean()
|
|
313
|
+
.optional()
|
|
314
|
+
.or(
|
|
315
|
+
z.object({
|
|
316
|
+
engineSTT: z.string().optional(),
|
|
317
|
+
languageSTT: z.string().optional(),
|
|
318
|
+
autoTranscribeAudio: z.boolean().optional(),
|
|
319
|
+
decibelValue: z.number().optional(),
|
|
320
|
+
autoSendText: z.number().optional(),
|
|
321
|
+
}),
|
|
322
|
+
)
|
|
323
|
+
.optional(),
|
|
324
|
+
textToSpeech: z
|
|
325
|
+
.boolean()
|
|
326
|
+
.optional()
|
|
327
|
+
.or(
|
|
328
|
+
z.object({
|
|
329
|
+
engineTTS: z.string().optional(),
|
|
330
|
+
voice: z.string().optional(),
|
|
331
|
+
languageTTS: z.string().optional(),
|
|
332
|
+
automaticPlayback: z.boolean().optional(),
|
|
333
|
+
playbackRate: z.number().optional(),
|
|
334
|
+
cacheTTS: z.boolean().optional(),
|
|
335
|
+
}),
|
|
336
|
+
)
|
|
337
|
+
.optional(),
|
|
338
|
+
})
|
|
339
|
+
.optional();
|
|
340
|
+
|
|
276
341
|
export enum RateLimitPrefix {
|
|
277
342
|
FILE_UPLOAD = 'FILE_UPLOAD',
|
|
278
343
|
IMPORT = 'IMPORT',
|
|
@@ -362,17 +427,27 @@ export const configSchema = z.object({
|
|
|
362
427
|
allowedDomains: z.array(z.string()).optional(),
|
|
363
428
|
})
|
|
364
429
|
.default({ socialLogins: defaultSocialLogins }),
|
|
365
|
-
|
|
366
|
-
|
|
430
|
+
speech: z
|
|
431
|
+
.object({
|
|
432
|
+
tts: ttsSchema.optional(),
|
|
433
|
+
stt: sttSchema.optional(),
|
|
434
|
+
speechTab: speechTab.optional(),
|
|
435
|
+
})
|
|
436
|
+
.optional(),
|
|
367
437
|
rateLimits: rateLimitSchema.optional(),
|
|
368
438
|
fileConfig: fileConfigSchema.optional(),
|
|
369
439
|
modelSpecs: specsConfigSchema.optional(),
|
|
370
440
|
endpoints: z
|
|
371
441
|
.object({
|
|
442
|
+
all: baseEndpointSchema.optional(),
|
|
443
|
+
[EModelEndpoint.openAI]: baseEndpointSchema.optional(),
|
|
444
|
+
[EModelEndpoint.google]: baseEndpointSchema.optional(),
|
|
445
|
+
[EModelEndpoint.anthropic]: baseEndpointSchema.optional(),
|
|
446
|
+
[EModelEndpoint.gptPlugins]: baseEndpointSchema.optional(),
|
|
372
447
|
[EModelEndpoint.azureOpenAI]: azureEndpointSchema.optional(),
|
|
373
448
|
[EModelEndpoint.azureAssistants]: assistantEndpointSchema.optional(),
|
|
374
449
|
[EModelEndpoint.assistants]: assistantEndpointSchema.optional(),
|
|
375
|
-
custom: z.array(endpointSchema.partial()).optional(),
|
|
450
|
+
[EModelEndpoint.custom]: z.array(endpointSchema.partial()).optional(),
|
|
376
451
|
})
|
|
377
452
|
.strict()
|
|
378
453
|
.refine((data) => Object.keys(data).length > 0, {
|
|
@@ -457,7 +532,7 @@ const sharedOpenAIModels = [
|
|
|
457
532
|
|
|
458
533
|
export const defaultModels = {
|
|
459
534
|
[EModelEndpoint.azureAssistants]: sharedOpenAIModels,
|
|
460
|
-
[EModelEndpoint.assistants]: ['gpt-4o', ...sharedOpenAIModels],
|
|
535
|
+
[EModelEndpoint.assistants]: ['gpt-4o-mini', 'gpt-4o', ...sharedOpenAIModels],
|
|
461
536
|
[EModelEndpoint.google]: [
|
|
462
537
|
'gemini-pro',
|
|
463
538
|
'gemini-pro-vision',
|
|
@@ -486,13 +561,12 @@ export const defaultModels = {
|
|
|
486
561
|
'claude-instant-1-100k',
|
|
487
562
|
],
|
|
488
563
|
[EModelEndpoint.openAI]: [
|
|
564
|
+
'gpt-4o-mini',
|
|
489
565
|
'gpt-4o',
|
|
490
566
|
...sharedOpenAIModels,
|
|
491
567
|
'gpt-4-vision-preview',
|
|
492
568
|
'gpt-3.5-turbo-instruct-0914',
|
|
493
|
-
'gpt-3.5-turbo-0301',
|
|
494
569
|
'gpt-3.5-turbo-instruct',
|
|
495
|
-
'text-davinci-003',
|
|
496
570
|
],
|
|
497
571
|
};
|
|
498
572
|
|
|
@@ -548,6 +622,7 @@ export const supportsBalanceCheck = {
|
|
|
548
622
|
|
|
549
623
|
export const visionModels = [
|
|
550
624
|
'gpt-4o',
|
|
625
|
+
'gpt-4o-mini',
|
|
551
626
|
'gpt-4-turbo',
|
|
552
627
|
'gpt-4-vision',
|
|
553
628
|
'llava',
|
|
@@ -600,6 +675,18 @@ export enum InfiniteCollections {
|
|
|
600
675
|
SHARED_LINKS = 'sharedLinks',
|
|
601
676
|
}
|
|
602
677
|
|
|
678
|
+
/**
|
|
679
|
+
* Enum for time intervals
|
|
680
|
+
*/
|
|
681
|
+
export enum Time {
|
|
682
|
+
THIRTY_MINUTES = 1800000,
|
|
683
|
+
TEN_MINUTES = 600000,
|
|
684
|
+
FIVE_MINUTES = 300000,
|
|
685
|
+
TWO_MINUTES = 120000,
|
|
686
|
+
ONE_MINUTE = 60000,
|
|
687
|
+
THIRTY_SECONDS = 30000,
|
|
688
|
+
}
|
|
689
|
+
|
|
603
690
|
/**
|
|
604
691
|
* Enum for cache keys.
|
|
605
692
|
*/
|
|
@@ -670,6 +757,10 @@ export enum CacheKeys {
|
|
|
670
757
|
* Key for the cached audio run Ids.
|
|
671
758
|
*/
|
|
672
759
|
AUDIO_RUNS = 'audioRuns',
|
|
760
|
+
/**
|
|
761
|
+
* Key for in-progress messages.
|
|
762
|
+
*/
|
|
763
|
+
MESSAGES = 'messages',
|
|
673
764
|
}
|
|
674
765
|
|
|
675
766
|
/**
|
|
@@ -785,9 +876,9 @@ export enum SettingsTabValues {
|
|
|
785
876
|
*/
|
|
786
877
|
GENERAL = 'general',
|
|
787
878
|
/**
|
|
788
|
-
* Tab for
|
|
879
|
+
* Tab for Chat Settings
|
|
789
880
|
*/
|
|
790
|
-
|
|
881
|
+
CHAT = 'chat',
|
|
791
882
|
/**
|
|
792
883
|
* Tab for Speech Settings
|
|
793
884
|
*/
|
|
@@ -806,12 +897,42 @@ export enum SettingsTabValues {
|
|
|
806
897
|
ACCOUNT = 'account',
|
|
807
898
|
}
|
|
808
899
|
|
|
900
|
+
export enum STTProviders {
|
|
901
|
+
/**
|
|
902
|
+
* Provider for OpenAI STT
|
|
903
|
+
*/
|
|
904
|
+
OPENAI = 'openai',
|
|
905
|
+
/**
|
|
906
|
+
* Provider for Microsoft Azure STT
|
|
907
|
+
*/
|
|
908
|
+
AZURE_OPENAI = 'azureOpenAI',
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
export enum TTSProviders {
|
|
912
|
+
/**
|
|
913
|
+
* Provider for OpenAI TTS
|
|
914
|
+
*/
|
|
915
|
+
OPENAI = 'openai',
|
|
916
|
+
/**
|
|
917
|
+
* Provider for Microsoft Azure OpenAI TTS
|
|
918
|
+
*/
|
|
919
|
+
AZURE_OPENAI = 'azureOpenAI',
|
|
920
|
+
/**
|
|
921
|
+
* Provider for ElevenLabs TTS
|
|
922
|
+
*/
|
|
923
|
+
ELEVENLABS = 'elevenlabs',
|
|
924
|
+
/**
|
|
925
|
+
* Provider for LocalAI TTS
|
|
926
|
+
*/
|
|
927
|
+
LOCALAI = 'localai',
|
|
928
|
+
}
|
|
929
|
+
|
|
809
930
|
/** Enum for app-wide constants */
|
|
810
931
|
export enum Constants {
|
|
811
932
|
/** Key for the app's version. */
|
|
812
933
|
VERSION = 'v0.7.4-rc1',
|
|
813
934
|
/** Key for the Custom Config's version (librechat.yaml). */
|
|
814
|
-
CONFIG_VERSION = '1.1.
|
|
935
|
+
CONFIG_VERSION = '1.1.5',
|
|
815
936
|
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
|
816
937
|
NO_PARENT = '00000000-0000-0000-0000-000000000000',
|
|
817
938
|
/** Standard value for the initial conversationId before a request is sent */
|
|
@@ -822,6 +943,10 @@ export enum Constants {
|
|
|
822
943
|
CURRENT_MODEL = 'current_model',
|
|
823
944
|
/** Common divider for text values */
|
|
824
945
|
COMMON_DIVIDER = '__',
|
|
946
|
+
/** Max length for commands */
|
|
947
|
+
COMMANDS_MAX_LENGTH = 56,
|
|
948
|
+
/** Default Stream Rate (ms) */
|
|
949
|
+
DEFAULT_STREAM_RATE = 1,
|
|
825
950
|
}
|
|
826
951
|
|
|
827
952
|
export enum LocalStorageKeys {
|
package/src/data-service.ts
CHANGED
|
@@ -355,6 +355,10 @@ export const getVoices = (): Promise<f.VoiceResponse> => {
|
|
|
355
355
|
return request.get(endpoints.textToSpeechVoices());
|
|
356
356
|
};
|
|
357
357
|
|
|
358
|
+
export const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse> => {
|
|
359
|
+
return request.get(endpoints.getCustomConfigSpeech());
|
|
360
|
+
};
|
|
361
|
+
|
|
358
362
|
/* actions */
|
|
359
363
|
|
|
360
364
|
export const updateAction = (data: m.UpdateActionVariables): Promise<m.UpdateActionResponse> => {
|
|
@@ -475,6 +479,10 @@ export function getPrompts(filter: t.TPromptsWithFilterRequest): Promise<t.TProm
|
|
|
475
479
|
return request.get(endpoints.getPromptsWithFilters(filter));
|
|
476
480
|
}
|
|
477
481
|
|
|
482
|
+
export function getAllPromptGroups(): Promise<q.AllPromptGroupsResponse> {
|
|
483
|
+
return request.get(endpoints.getAllPromptGroups());
|
|
484
|
+
}
|
|
485
|
+
|
|
478
486
|
export function getPromptGroups(
|
|
479
487
|
filter: t.TPromptGroupsWithFilterRequest,
|
|
480
488
|
): Promise<t.PromptGroupListResponse> {
|
package/src/keys.ts
CHANGED
|
@@ -27,9 +27,11 @@ export enum QueryKeys {
|
|
|
27
27
|
assistantDocs = 'assistantDocs',
|
|
28
28
|
fileDownload = 'fileDownload',
|
|
29
29
|
voices = 'voices',
|
|
30
|
+
customConfigSpeech = 'customConfigSpeech',
|
|
30
31
|
prompts = 'prompts',
|
|
31
32
|
prompt = 'prompt',
|
|
32
33
|
promptGroups = 'promptGroups',
|
|
34
|
+
allPromptGroups = 'allPromptGroups',
|
|
33
35
|
promptGroup = 'promptGroup',
|
|
34
36
|
categories = 'categories',
|
|
35
37
|
randomPrompts = 'randomPrompts',
|
|
@@ -422,3 +422,18 @@ export const useGetStartupConfig = (
|
|
|
422
422
|
},
|
|
423
423
|
);
|
|
424
424
|
};
|
|
425
|
+
|
|
426
|
+
export const useGetCustomConfigSpeechQuery = (
|
|
427
|
+
config?: UseQueryOptions<t.TCustomConfigSpeechResponse>,
|
|
428
|
+
): QueryObserverResult<t.TCustomConfigSpeechResponse> => {
|
|
429
|
+
return useQuery<t.TCustomConfigSpeechResponse>(
|
|
430
|
+
[QueryKeys.customConfigSpeech],
|
|
431
|
+
() => dataService.getCustomConfigSpeech(),
|
|
432
|
+
{
|
|
433
|
+
refetchOnWindowFocus: false,
|
|
434
|
+
refetchOnReconnect: false,
|
|
435
|
+
refetchOnMount: false,
|
|
436
|
+
...config,
|
|
437
|
+
},
|
|
438
|
+
);
|
|
439
|
+
};
|
package/src/schemas.ts
CHANGED
package/src/types/queries.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InfiniteData } from '@tanstack/react-query';
|
|
2
2
|
import type { TMessage, TConversation, TSharedLink } from '../schemas';
|
|
3
|
+
import type * as t from '../types';
|
|
3
4
|
export type Conversation = {
|
|
4
5
|
id: string;
|
|
5
6
|
createdAt: number;
|
|
@@ -54,3 +55,16 @@ export type SharedLinkListResponse = {
|
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
export type SharedLinkListData = InfiniteData<SharedLinkListResponse>;
|
|
58
|
+
|
|
59
|
+
export type AllPromptGroupsFilterRequest = {
|
|
60
|
+
category: string;
|
|
61
|
+
pageNumber: string;
|
|
62
|
+
pageSize: string | number;
|
|
63
|
+
before?: string | null;
|
|
64
|
+
after?: string | null;
|
|
65
|
+
order?: 'asc' | 'desc';
|
|
66
|
+
name?: string;
|
|
67
|
+
author?: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type AllPromptGroupsResponse = t.TPromptGroup[];
|
package/src/types.ts
CHANGED
|
@@ -351,6 +351,7 @@ export type TPrompt = {
|
|
|
351
351
|
export type TPromptGroup = {
|
|
352
352
|
name: string;
|
|
353
353
|
numberOfGenerations?: number;
|
|
354
|
+
command?: string;
|
|
354
355
|
oneliner?: string;
|
|
355
356
|
category?: string;
|
|
356
357
|
projectIds?: string[];
|
|
@@ -365,7 +366,7 @@ export type TPromptGroup = {
|
|
|
365
366
|
|
|
366
367
|
export type TCreatePrompt = {
|
|
367
368
|
prompt: Pick<TPrompt, 'prompt' | 'type'> & { groupId?: string };
|
|
368
|
-
group?: { name: string; category?: string; oneliner?: string };
|
|
369
|
+
group?: { name: string; category?: string; oneliner?: string; command?: string };
|
|
369
370
|
};
|
|
370
371
|
|
|
371
372
|
export type TCreatePromptRecord = TCreatePrompt & Pick<TPromptGroup, 'author' | 'authorName'>;
|
|
@@ -385,6 +386,7 @@ export type TPromptGroupsWithFilterRequest = {
|
|
|
385
386
|
after?: string | null;
|
|
386
387
|
order?: 'asc' | 'desc';
|
|
387
388
|
name?: string;
|
|
389
|
+
author?: string;
|
|
388
390
|
};
|
|
389
391
|
|
|
390
392
|
export type PromptGroupListResponse = {
|
|
@@ -461,3 +463,5 @@ export type TGetRandomPromptsRequest = {
|
|
|
461
463
|
limit: number;
|
|
462
464
|
skip: number;
|
|
463
465
|
};
|
|
466
|
+
|
|
467
|
+
export type TCustomConfigSpeechResponse = { [key: string]: string };
|