@fonoster/common 0.8.26 → 0.8.28
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/assistants/LanguageModelProvider.d.ts +6 -0
- package/dist/assistants/LanguageModelProvider.js +27 -0
- package/dist/assistants/assistantSchema.d.ts +411 -0
- package/dist/assistants/assistantSchema.js +29 -0
- package/dist/assistants/conversationSettingsSchema.d.ts +98 -0
- package/dist/assistants/conversationSettingsSchema.js +113 -0
- package/dist/assistants/index.d.ts +5 -0
- package/dist/assistants/index.js +39 -0
- package/dist/assistants/languageModelConfigSchema.d.ts +198 -0
- package/dist/assistants/languageModelConfigSchema.js +89 -0
- package/dist/assistants/tools/AllowedOperations.d.ts +6 -0
- package/dist/assistants/tools/AllowedOperations.js +27 -0
- package/dist/assistants/tools/index.d.ts +1 -0
- package/dist/assistants/tools/index.js +35 -0
- package/dist/assistants/tools/propertySchema.d.ts +23 -0
- package/dist/assistants/tools/propertySchema.js +34 -0
- package/dist/assistants/tools/toolSchema.d.ts +113 -0
- package/dist/assistants/tools/toolSchema.js +87 -0
- package/dist/errors/PrismaErrorEnum.d.ts +1 -2
- package/dist/errors/PrismaErrorEnum.js +0 -1
- package/dist/errors/handleError.js +1 -5
- package/dist/identity/roles.js +4 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/protos/applications.proto +6 -4
- package/dist/utils/findIntegrationsCredentials.d.ts +5 -0
- package/dist/utils/findIntegrationsCredentials.js +25 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/validators/calls.d.ts +2 -2
- package/dist/validators/hostOrHostPortSchema.d.ts +1 -1
- package/dist/validators/hostOrHostPortSchema.js +1 -4
- package/dist/validators/identity.d.ts +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LanguageModelProvider = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
var LanguageModelProvider;
|
|
23
|
+
(function (LanguageModelProvider) {
|
|
24
|
+
LanguageModelProvider["OPENAI"] = "openai";
|
|
25
|
+
LanguageModelProvider["GROQ"] = "groq";
|
|
26
|
+
LanguageModelProvider["OLLAMA"] = "ollama";
|
|
27
|
+
})(LanguageModelProvider || (exports.LanguageModelProvider = LanguageModelProvider = {}));
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const assistantSchema: z.ZodObject<{
|
|
3
|
+
conversationSettings: z.ZodObject<{
|
|
4
|
+
firstMessage: z.ZodOptional<z.ZodString>;
|
|
5
|
+
systemTemplate: z.ZodString;
|
|
6
|
+
goodbyeMessage: z.ZodString;
|
|
7
|
+
systemErrorMessage: z.ZodString;
|
|
8
|
+
initialDtmf: z.ZodOptional<z.ZodString>;
|
|
9
|
+
maxSpeechWaitTimeout: z.ZodNumber;
|
|
10
|
+
transferOptions: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
phoneNumber: z.ZodString;
|
|
12
|
+
message: z.ZodString;
|
|
13
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
message?: string;
|
|
16
|
+
phoneNumber?: string;
|
|
17
|
+
timeout?: number;
|
|
18
|
+
}, {
|
|
19
|
+
message?: string;
|
|
20
|
+
phoneNumber?: string;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
}>>;
|
|
23
|
+
idleOptions: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
message: z.ZodString;
|
|
25
|
+
timeout: z.ZodNumber;
|
|
26
|
+
maxTimeoutCount: z.ZodNumber;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
message?: string;
|
|
29
|
+
timeout?: number;
|
|
30
|
+
maxTimeoutCount?: number;
|
|
31
|
+
}, {
|
|
32
|
+
message?: string;
|
|
33
|
+
timeout?: number;
|
|
34
|
+
maxTimeoutCount?: number;
|
|
35
|
+
}>>;
|
|
36
|
+
vad: z.ZodObject<{
|
|
37
|
+
pathToModel: z.ZodOptional<z.ZodString>;
|
|
38
|
+
activationThreshold: z.ZodNumber;
|
|
39
|
+
deactivationThreshold: z.ZodNumber;
|
|
40
|
+
debounceFrames: z.ZodNumber;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
pathToModel?: string;
|
|
43
|
+
activationThreshold?: number;
|
|
44
|
+
deactivationThreshold?: number;
|
|
45
|
+
debounceFrames?: number;
|
|
46
|
+
}, {
|
|
47
|
+
pathToModel?: string;
|
|
48
|
+
activationThreshold?: number;
|
|
49
|
+
deactivationThreshold?: number;
|
|
50
|
+
debounceFrames?: number;
|
|
51
|
+
}>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
firstMessage?: string;
|
|
54
|
+
systemTemplate?: string;
|
|
55
|
+
goodbyeMessage?: string;
|
|
56
|
+
systemErrorMessage?: string;
|
|
57
|
+
initialDtmf?: string;
|
|
58
|
+
maxSpeechWaitTimeout?: number;
|
|
59
|
+
transferOptions?: {
|
|
60
|
+
message?: string;
|
|
61
|
+
phoneNumber?: string;
|
|
62
|
+
timeout?: number;
|
|
63
|
+
};
|
|
64
|
+
idleOptions?: {
|
|
65
|
+
message?: string;
|
|
66
|
+
timeout?: number;
|
|
67
|
+
maxTimeoutCount?: number;
|
|
68
|
+
};
|
|
69
|
+
vad?: {
|
|
70
|
+
pathToModel?: string;
|
|
71
|
+
activationThreshold?: number;
|
|
72
|
+
deactivationThreshold?: number;
|
|
73
|
+
debounceFrames?: number;
|
|
74
|
+
};
|
|
75
|
+
}, {
|
|
76
|
+
firstMessage?: string;
|
|
77
|
+
systemTemplate?: string;
|
|
78
|
+
goodbyeMessage?: string;
|
|
79
|
+
systemErrorMessage?: string;
|
|
80
|
+
initialDtmf?: string;
|
|
81
|
+
maxSpeechWaitTimeout?: number;
|
|
82
|
+
transferOptions?: {
|
|
83
|
+
message?: string;
|
|
84
|
+
phoneNumber?: string;
|
|
85
|
+
timeout?: number;
|
|
86
|
+
};
|
|
87
|
+
idleOptions?: {
|
|
88
|
+
message?: string;
|
|
89
|
+
timeout?: number;
|
|
90
|
+
maxTimeoutCount?: number;
|
|
91
|
+
};
|
|
92
|
+
vad?: {
|
|
93
|
+
pathToModel?: string;
|
|
94
|
+
activationThreshold?: number;
|
|
95
|
+
deactivationThreshold?: number;
|
|
96
|
+
debounceFrames?: number;
|
|
97
|
+
};
|
|
98
|
+
}>;
|
|
99
|
+
languageModel: z.ZodObject<{
|
|
100
|
+
provider: z.ZodNativeEnum<typeof import("./LanguageModelProvider").LanguageModelProvider>;
|
|
101
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
102
|
+
model: z.ZodString;
|
|
103
|
+
temperature: z.ZodNumber;
|
|
104
|
+
maxTokens: z.ZodNumber;
|
|
105
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
106
|
+
knowledgeBase: z.ZodArray<z.ZodObject<{
|
|
107
|
+
type: z.ZodEnum<["s3"]>;
|
|
108
|
+
title: z.ZodString;
|
|
109
|
+
document: z.ZodString;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
type?: "s3";
|
|
112
|
+
title?: string;
|
|
113
|
+
document?: string;
|
|
114
|
+
}, {
|
|
115
|
+
type?: "s3";
|
|
116
|
+
title?: string;
|
|
117
|
+
document?: string;
|
|
118
|
+
}>, "many">;
|
|
119
|
+
tools: z.ZodArray<z.ZodObject<{
|
|
120
|
+
name: z.ZodString;
|
|
121
|
+
description: z.ZodString;
|
|
122
|
+
parameters: z.ZodObject<{
|
|
123
|
+
type: z.ZodEnum<["object", "array"]>;
|
|
124
|
+
properties: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
|
|
125
|
+
type: z.ZodString;
|
|
126
|
+
format: z.ZodOptional<z.ZodString>;
|
|
127
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
type?: string;
|
|
130
|
+
format?: string;
|
|
131
|
+
pattern?: string;
|
|
132
|
+
}, {
|
|
133
|
+
type?: string;
|
|
134
|
+
format?: string;
|
|
135
|
+
pattern?: string;
|
|
136
|
+
}>, {
|
|
137
|
+
type?: string;
|
|
138
|
+
format?: string;
|
|
139
|
+
pattern?: string;
|
|
140
|
+
}, {
|
|
141
|
+
type?: string;
|
|
142
|
+
format?: string;
|
|
143
|
+
pattern?: string;
|
|
144
|
+
}>>;
|
|
145
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
type?: "object" | "array";
|
|
148
|
+
properties?: Record<string, {
|
|
149
|
+
type?: string;
|
|
150
|
+
format?: string;
|
|
151
|
+
pattern?: string;
|
|
152
|
+
}>;
|
|
153
|
+
required?: string[];
|
|
154
|
+
}, {
|
|
155
|
+
type?: "object" | "array";
|
|
156
|
+
properties?: Record<string, {
|
|
157
|
+
type?: string;
|
|
158
|
+
format?: string;
|
|
159
|
+
pattern?: string;
|
|
160
|
+
}>;
|
|
161
|
+
required?: string[];
|
|
162
|
+
}>;
|
|
163
|
+
requestStartMessage: z.ZodOptional<z.ZodString>;
|
|
164
|
+
operation: z.ZodEffects<z.ZodObject<{
|
|
165
|
+
type: z.ZodNativeEnum<typeof import("./tools/AllowedOperations").AllowedOperations>;
|
|
166
|
+
url: z.ZodOptional<z.ZodString>;
|
|
167
|
+
waitForResponse: z.ZodOptional<z.ZodBoolean>;
|
|
168
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
171
|
+
url?: string;
|
|
172
|
+
waitForResponse?: boolean;
|
|
173
|
+
headers?: Record<string, string>;
|
|
174
|
+
}, {
|
|
175
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
176
|
+
url?: string;
|
|
177
|
+
waitForResponse?: boolean;
|
|
178
|
+
headers?: Record<string, string>;
|
|
179
|
+
}>, {
|
|
180
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
181
|
+
url?: string;
|
|
182
|
+
waitForResponse?: boolean;
|
|
183
|
+
headers?: Record<string, string>;
|
|
184
|
+
}, {
|
|
185
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
186
|
+
url?: string;
|
|
187
|
+
waitForResponse?: boolean;
|
|
188
|
+
headers?: Record<string, string>;
|
|
189
|
+
}>;
|
|
190
|
+
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
name?: string;
|
|
192
|
+
description?: string;
|
|
193
|
+
parameters?: {
|
|
194
|
+
type?: "object" | "array";
|
|
195
|
+
properties?: Record<string, {
|
|
196
|
+
type?: string;
|
|
197
|
+
format?: string;
|
|
198
|
+
pattern?: string;
|
|
199
|
+
}>;
|
|
200
|
+
required?: string[];
|
|
201
|
+
};
|
|
202
|
+
requestStartMessage?: string;
|
|
203
|
+
operation?: {
|
|
204
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
205
|
+
url?: string;
|
|
206
|
+
waitForResponse?: boolean;
|
|
207
|
+
headers?: Record<string, string>;
|
|
208
|
+
};
|
|
209
|
+
}, {
|
|
210
|
+
name?: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
parameters?: {
|
|
213
|
+
type?: "object" | "array";
|
|
214
|
+
properties?: Record<string, {
|
|
215
|
+
type?: string;
|
|
216
|
+
format?: string;
|
|
217
|
+
pattern?: string;
|
|
218
|
+
}>;
|
|
219
|
+
required?: string[];
|
|
220
|
+
};
|
|
221
|
+
requestStartMessage?: string;
|
|
222
|
+
operation?: {
|
|
223
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
224
|
+
url?: string;
|
|
225
|
+
waitForResponse?: boolean;
|
|
226
|
+
headers?: Record<string, string>;
|
|
227
|
+
};
|
|
228
|
+
}>, "many">;
|
|
229
|
+
}, "strip", z.ZodTypeAny, {
|
|
230
|
+
provider?: import("./LanguageModelProvider").LanguageModelProvider;
|
|
231
|
+
apiKey?: string;
|
|
232
|
+
model?: string;
|
|
233
|
+
temperature?: number;
|
|
234
|
+
maxTokens?: number;
|
|
235
|
+
baseUrl?: string;
|
|
236
|
+
knowledgeBase?: {
|
|
237
|
+
type?: "s3";
|
|
238
|
+
title?: string;
|
|
239
|
+
document?: string;
|
|
240
|
+
}[];
|
|
241
|
+
tools?: {
|
|
242
|
+
name?: string;
|
|
243
|
+
description?: string;
|
|
244
|
+
parameters?: {
|
|
245
|
+
type?: "object" | "array";
|
|
246
|
+
properties?: Record<string, {
|
|
247
|
+
type?: string;
|
|
248
|
+
format?: string;
|
|
249
|
+
pattern?: string;
|
|
250
|
+
}>;
|
|
251
|
+
required?: string[];
|
|
252
|
+
};
|
|
253
|
+
requestStartMessage?: string;
|
|
254
|
+
operation?: {
|
|
255
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
256
|
+
url?: string;
|
|
257
|
+
waitForResponse?: boolean;
|
|
258
|
+
headers?: Record<string, string>;
|
|
259
|
+
};
|
|
260
|
+
}[];
|
|
261
|
+
}, {
|
|
262
|
+
provider?: import("./LanguageModelProvider").LanguageModelProvider;
|
|
263
|
+
apiKey?: string;
|
|
264
|
+
model?: string;
|
|
265
|
+
temperature?: number;
|
|
266
|
+
maxTokens?: number;
|
|
267
|
+
baseUrl?: string;
|
|
268
|
+
knowledgeBase?: {
|
|
269
|
+
type?: "s3";
|
|
270
|
+
title?: string;
|
|
271
|
+
document?: string;
|
|
272
|
+
}[];
|
|
273
|
+
tools?: {
|
|
274
|
+
name?: string;
|
|
275
|
+
description?: string;
|
|
276
|
+
parameters?: {
|
|
277
|
+
type?: "object" | "array";
|
|
278
|
+
properties?: Record<string, {
|
|
279
|
+
type?: string;
|
|
280
|
+
format?: string;
|
|
281
|
+
pattern?: string;
|
|
282
|
+
}>;
|
|
283
|
+
required?: string[];
|
|
284
|
+
};
|
|
285
|
+
requestStartMessage?: string;
|
|
286
|
+
operation?: {
|
|
287
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
288
|
+
url?: string;
|
|
289
|
+
waitForResponse?: boolean;
|
|
290
|
+
headers?: Record<string, string>;
|
|
291
|
+
};
|
|
292
|
+
}[];
|
|
293
|
+
}>;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
conversationSettings?: {
|
|
296
|
+
firstMessage?: string;
|
|
297
|
+
systemTemplate?: string;
|
|
298
|
+
goodbyeMessage?: string;
|
|
299
|
+
systemErrorMessage?: string;
|
|
300
|
+
initialDtmf?: string;
|
|
301
|
+
maxSpeechWaitTimeout?: number;
|
|
302
|
+
transferOptions?: {
|
|
303
|
+
message?: string;
|
|
304
|
+
phoneNumber?: string;
|
|
305
|
+
timeout?: number;
|
|
306
|
+
};
|
|
307
|
+
idleOptions?: {
|
|
308
|
+
message?: string;
|
|
309
|
+
timeout?: number;
|
|
310
|
+
maxTimeoutCount?: number;
|
|
311
|
+
};
|
|
312
|
+
vad?: {
|
|
313
|
+
pathToModel?: string;
|
|
314
|
+
activationThreshold?: number;
|
|
315
|
+
deactivationThreshold?: number;
|
|
316
|
+
debounceFrames?: number;
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
languageModel?: {
|
|
320
|
+
provider?: import("./LanguageModelProvider").LanguageModelProvider;
|
|
321
|
+
apiKey?: string;
|
|
322
|
+
model?: string;
|
|
323
|
+
temperature?: number;
|
|
324
|
+
maxTokens?: number;
|
|
325
|
+
baseUrl?: string;
|
|
326
|
+
knowledgeBase?: {
|
|
327
|
+
type?: "s3";
|
|
328
|
+
title?: string;
|
|
329
|
+
document?: string;
|
|
330
|
+
}[];
|
|
331
|
+
tools?: {
|
|
332
|
+
name?: string;
|
|
333
|
+
description?: string;
|
|
334
|
+
parameters?: {
|
|
335
|
+
type?: "object" | "array";
|
|
336
|
+
properties?: Record<string, {
|
|
337
|
+
type?: string;
|
|
338
|
+
format?: string;
|
|
339
|
+
pattern?: string;
|
|
340
|
+
}>;
|
|
341
|
+
required?: string[];
|
|
342
|
+
};
|
|
343
|
+
requestStartMessage?: string;
|
|
344
|
+
operation?: {
|
|
345
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
346
|
+
url?: string;
|
|
347
|
+
waitForResponse?: boolean;
|
|
348
|
+
headers?: Record<string, string>;
|
|
349
|
+
};
|
|
350
|
+
}[];
|
|
351
|
+
};
|
|
352
|
+
}, {
|
|
353
|
+
conversationSettings?: {
|
|
354
|
+
firstMessage?: string;
|
|
355
|
+
systemTemplate?: string;
|
|
356
|
+
goodbyeMessage?: string;
|
|
357
|
+
systemErrorMessage?: string;
|
|
358
|
+
initialDtmf?: string;
|
|
359
|
+
maxSpeechWaitTimeout?: number;
|
|
360
|
+
transferOptions?: {
|
|
361
|
+
message?: string;
|
|
362
|
+
phoneNumber?: string;
|
|
363
|
+
timeout?: number;
|
|
364
|
+
};
|
|
365
|
+
idleOptions?: {
|
|
366
|
+
message?: string;
|
|
367
|
+
timeout?: number;
|
|
368
|
+
maxTimeoutCount?: number;
|
|
369
|
+
};
|
|
370
|
+
vad?: {
|
|
371
|
+
pathToModel?: string;
|
|
372
|
+
activationThreshold?: number;
|
|
373
|
+
deactivationThreshold?: number;
|
|
374
|
+
debounceFrames?: number;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
languageModel?: {
|
|
378
|
+
provider?: import("./LanguageModelProvider").LanguageModelProvider;
|
|
379
|
+
apiKey?: string;
|
|
380
|
+
model?: string;
|
|
381
|
+
temperature?: number;
|
|
382
|
+
maxTokens?: number;
|
|
383
|
+
baseUrl?: string;
|
|
384
|
+
knowledgeBase?: {
|
|
385
|
+
type?: "s3";
|
|
386
|
+
title?: string;
|
|
387
|
+
document?: string;
|
|
388
|
+
}[];
|
|
389
|
+
tools?: {
|
|
390
|
+
name?: string;
|
|
391
|
+
description?: string;
|
|
392
|
+
parameters?: {
|
|
393
|
+
type?: "object" | "array";
|
|
394
|
+
properties?: Record<string, {
|
|
395
|
+
type?: string;
|
|
396
|
+
format?: string;
|
|
397
|
+
pattern?: string;
|
|
398
|
+
}>;
|
|
399
|
+
required?: string[];
|
|
400
|
+
};
|
|
401
|
+
requestStartMessage?: string;
|
|
402
|
+
operation?: {
|
|
403
|
+
type?: import("./tools/AllowedOperations").AllowedOperations;
|
|
404
|
+
url?: string;
|
|
405
|
+
waitForResponse?: boolean;
|
|
406
|
+
headers?: Record<string, string>;
|
|
407
|
+
};
|
|
408
|
+
}[];
|
|
409
|
+
};
|
|
410
|
+
}>;
|
|
411
|
+
export { assistantSchema };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assistantSchema = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const zod_1 = require("zod");
|
|
23
|
+
const conversationSettingsSchema_1 = require("./conversationSettingsSchema");
|
|
24
|
+
const languageModelConfigSchema_1 = require("./languageModelConfigSchema");
|
|
25
|
+
const assistantSchema = zod_1.z.object({
|
|
26
|
+
conversationSettings: conversationSettingsSchema_1.conversationSettingsSchema,
|
|
27
|
+
languageModel: languageModelConfigSchema_1.languageModelConfigSchema
|
|
28
|
+
});
|
|
29
|
+
exports.assistantSchema = assistantSchema;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const conversationSettingsSchema: z.ZodObject<{
|
|
3
|
+
firstMessage: z.ZodOptional<z.ZodString>;
|
|
4
|
+
systemTemplate: z.ZodString;
|
|
5
|
+
goodbyeMessage: z.ZodString;
|
|
6
|
+
systemErrorMessage: z.ZodString;
|
|
7
|
+
initialDtmf: z.ZodOptional<z.ZodString>;
|
|
8
|
+
maxSpeechWaitTimeout: z.ZodNumber;
|
|
9
|
+
transferOptions: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
phoneNumber: z.ZodString;
|
|
11
|
+
message: z.ZodString;
|
|
12
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
message?: string;
|
|
15
|
+
phoneNumber?: string;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
}, {
|
|
18
|
+
message?: string;
|
|
19
|
+
phoneNumber?: string;
|
|
20
|
+
timeout?: number;
|
|
21
|
+
}>>;
|
|
22
|
+
idleOptions: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
message: z.ZodString;
|
|
24
|
+
timeout: z.ZodNumber;
|
|
25
|
+
maxTimeoutCount: z.ZodNumber;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
message?: string;
|
|
28
|
+
timeout?: number;
|
|
29
|
+
maxTimeoutCount?: number;
|
|
30
|
+
}, {
|
|
31
|
+
message?: string;
|
|
32
|
+
timeout?: number;
|
|
33
|
+
maxTimeoutCount?: number;
|
|
34
|
+
}>>;
|
|
35
|
+
vad: z.ZodObject<{
|
|
36
|
+
pathToModel: z.ZodOptional<z.ZodString>;
|
|
37
|
+
activationThreshold: z.ZodNumber;
|
|
38
|
+
deactivationThreshold: z.ZodNumber;
|
|
39
|
+
debounceFrames: z.ZodNumber;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
pathToModel?: string;
|
|
42
|
+
activationThreshold?: number;
|
|
43
|
+
deactivationThreshold?: number;
|
|
44
|
+
debounceFrames?: number;
|
|
45
|
+
}, {
|
|
46
|
+
pathToModel?: string;
|
|
47
|
+
activationThreshold?: number;
|
|
48
|
+
deactivationThreshold?: number;
|
|
49
|
+
debounceFrames?: number;
|
|
50
|
+
}>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
firstMessage?: string;
|
|
53
|
+
systemTemplate?: string;
|
|
54
|
+
goodbyeMessage?: string;
|
|
55
|
+
systemErrorMessage?: string;
|
|
56
|
+
initialDtmf?: string;
|
|
57
|
+
maxSpeechWaitTimeout?: number;
|
|
58
|
+
transferOptions?: {
|
|
59
|
+
message?: string;
|
|
60
|
+
phoneNumber?: string;
|
|
61
|
+
timeout?: number;
|
|
62
|
+
};
|
|
63
|
+
idleOptions?: {
|
|
64
|
+
message?: string;
|
|
65
|
+
timeout?: number;
|
|
66
|
+
maxTimeoutCount?: number;
|
|
67
|
+
};
|
|
68
|
+
vad?: {
|
|
69
|
+
pathToModel?: string;
|
|
70
|
+
activationThreshold?: number;
|
|
71
|
+
deactivationThreshold?: number;
|
|
72
|
+
debounceFrames?: number;
|
|
73
|
+
};
|
|
74
|
+
}, {
|
|
75
|
+
firstMessage?: string;
|
|
76
|
+
systemTemplate?: string;
|
|
77
|
+
goodbyeMessage?: string;
|
|
78
|
+
systemErrorMessage?: string;
|
|
79
|
+
initialDtmf?: string;
|
|
80
|
+
maxSpeechWaitTimeout?: number;
|
|
81
|
+
transferOptions?: {
|
|
82
|
+
message?: string;
|
|
83
|
+
phoneNumber?: string;
|
|
84
|
+
timeout?: number;
|
|
85
|
+
};
|
|
86
|
+
idleOptions?: {
|
|
87
|
+
message?: string;
|
|
88
|
+
timeout?: number;
|
|
89
|
+
maxTimeoutCount?: number;
|
|
90
|
+
};
|
|
91
|
+
vad?: {
|
|
92
|
+
pathToModel?: string;
|
|
93
|
+
activationThreshold?: number;
|
|
94
|
+
deactivationThreshold?: number;
|
|
95
|
+
debounceFrames?: number;
|
|
96
|
+
};
|
|
97
|
+
}>;
|
|
98
|
+
export { conversationSettingsSchema };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.conversationSettingsSchema = void 0;
|
|
37
|
+
/*
|
|
38
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
39
|
+
* http://github.com/fonoster/fonoster
|
|
40
|
+
*
|
|
41
|
+
* This file is part of Fonoster
|
|
42
|
+
*
|
|
43
|
+
* Licensed under the MIT License (the "License");
|
|
44
|
+
* you may not use this file except in compliance with
|
|
45
|
+
* the License. You may obtain a copy of the License at
|
|
46
|
+
*
|
|
47
|
+
* https://opensource.org/licenses/MIT
|
|
48
|
+
*
|
|
49
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
50
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
51
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
52
|
+
* See the License for the specific language governing permissions and
|
|
53
|
+
* limitations under the License.
|
|
54
|
+
*/
|
|
55
|
+
const zod_1 = require("zod");
|
|
56
|
+
const Messages = __importStar(require("../messages"));
|
|
57
|
+
const NUMBER_BETWEEN_0_AND_1 = "Must be a number between 0 and 1";
|
|
58
|
+
const conversationSettingsSchema = zod_1.z.object({
|
|
59
|
+
firstMessage: zod_1.z.string().optional(),
|
|
60
|
+
systemTemplate: zod_1.z.string(),
|
|
61
|
+
goodbyeMessage: zod_1.z.string(),
|
|
62
|
+
systemErrorMessage: zod_1.z.string(),
|
|
63
|
+
initialDtmf: zod_1.z
|
|
64
|
+
.string()
|
|
65
|
+
.regex(/^[0-9*#]+$/, { message: Messages.VALID_DTMF })
|
|
66
|
+
.optional(),
|
|
67
|
+
maxSpeechWaitTimeout: zod_1.z
|
|
68
|
+
.number()
|
|
69
|
+
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
70
|
+
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE }),
|
|
71
|
+
transferOptions: zod_1.z
|
|
72
|
+
.object({
|
|
73
|
+
phoneNumber: zod_1.z.string(),
|
|
74
|
+
message: zod_1.z.string(),
|
|
75
|
+
timeout: zod_1.z
|
|
76
|
+
.number()
|
|
77
|
+
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
78
|
+
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
79
|
+
.optional()
|
|
80
|
+
})
|
|
81
|
+
.optional(),
|
|
82
|
+
idleOptions: zod_1.z
|
|
83
|
+
.object({
|
|
84
|
+
message: zod_1.z.string(),
|
|
85
|
+
timeout: zod_1.z
|
|
86
|
+
.number()
|
|
87
|
+
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
88
|
+
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE }),
|
|
89
|
+
maxTimeoutCount: zod_1.z
|
|
90
|
+
.number()
|
|
91
|
+
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
92
|
+
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
93
|
+
})
|
|
94
|
+
.optional(),
|
|
95
|
+
vad: zod_1.z.object({
|
|
96
|
+
pathToModel: zod_1.z.string().optional(),
|
|
97
|
+
activationThreshold: zod_1.z
|
|
98
|
+
.number()
|
|
99
|
+
.max(1)
|
|
100
|
+
.min(0)
|
|
101
|
+
.positive({ message: NUMBER_BETWEEN_0_AND_1 }),
|
|
102
|
+
deactivationThreshold: zod_1.z
|
|
103
|
+
.number()
|
|
104
|
+
.max(1)
|
|
105
|
+
.min(0)
|
|
106
|
+
.positive({ message: NUMBER_BETWEEN_0_AND_1 }),
|
|
107
|
+
debounceFrames: zod_1.z
|
|
108
|
+
.number()
|
|
109
|
+
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
110
|
+
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
exports.conversationSettingsSchema = conversationSettingsSchema;
|