@drax/ai-back 3.43.0 → 3.45.0
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/controllers/TTSVoiceController.js +18 -0
- package/dist/factory/services/TTSVoiceServiceFactory.js +28 -0
- package/dist/index.js +14 -4
- package/dist/interfaces/ITTSVoice.js +1 -0
- package/dist/interfaces/ITTSVoiceRepository.js +1 -0
- package/dist/models/TTSVoiceModel.js +25 -0
- package/dist/permissions/TTSVoicePermissions.js +10 -0
- package/dist/repository/mongo/TTSVoiceMongoRepository.js +13 -0
- package/dist/repository/sqlite/TTSVoiceSqliteRepository.js +27 -0
- package/dist/routes/TTSVoiceRoutes.js +21 -0
- package/dist/schemas/TTSVoiceSchema.js +19 -0
- package/dist/services/TTSVoiceService.js +9 -0
- package/dist/tools/BuildContextTool.js +267 -0
- package/package.json +3 -3
- package/src/controllers/TTSVoiceController.ts +27 -0
- package/src/factory/services/TTSVoiceServiceFactory.ts +36 -0
- package/src/index.ts +30 -0
- package/src/interfaces/ITTSVoice.ts +20 -0
- package/src/interfaces/ITTSVoiceRepository.ts +8 -0
- package/src/models/TTSVoiceModel.ts +37 -0
- package/src/permissions/TTSVoicePermissions.ts +12 -0
- package/src/repository/mongo/TTSVoiceMongoRepository.ts +19 -0
- package/src/repository/sqlite/TTSVoiceSqliteRepository.ts +33 -0
- package/src/routes/TTSVoiceRoutes.ts +26 -0
- package/src/schemas/TTSVoiceSchema.ts +23 -0
- package/src/services/TTSVoiceService.ts +16 -0
- package/src/tools/BuildContextTool.ts +388 -0
- package/test/BuildContextTool.test.ts +183 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types/controllers/TTSVoiceController.d.ts +8 -0
- package/types/controllers/TTSVoiceController.d.ts.map +1 -0
- package/types/factory/services/TTSVoiceServiceFactory.d.ts +8 -0
- package/types/factory/services/TTSVoiceServiceFactory.d.ts.map +1 -0
- package/types/index.d.ts +14 -2
- package/types/index.d.ts.map +1 -1
- package/types/interfaces/ITTSVoice.d.ts +16 -0
- package/types/interfaces/ITTSVoice.d.ts.map +1 -0
- package/types/interfaces/ITTSVoiceRepository.d.ts +6 -0
- package/types/interfaces/ITTSVoiceRepository.d.ts.map +1 -0
- package/types/models/TTSVoiceModel.d.ts +15 -0
- package/types/models/TTSVoiceModel.d.ts.map +1 -0
- package/types/permissions/TTSVoicePermissions.d.ts +10 -0
- package/types/permissions/TTSVoicePermissions.d.ts.map +1 -0
- package/types/repository/mongo/TTSVoiceMongoRepository.d.ts +9 -0
- package/types/repository/mongo/TTSVoiceMongoRepository.d.ts.map +1 -0
- package/types/repository/sqlite/TTSVoiceSqliteRepository.d.ts +23 -0
- package/types/repository/sqlite/TTSVoiceSqliteRepository.d.ts.map +1 -0
- package/types/routes/TTSVoiceRoutes.d.ts +4 -0
- package/types/routes/TTSVoiceRoutes.d.ts.map +1 -0
- package/types/schemas/TTSVoiceSchema.d.ts +36 -0
- package/types/schemas/TTSVoiceSchema.d.ts.map +1 -0
- package/types/services/TTSVoiceService.d.ts +10 -0
- package/types/services/TTSVoiceService.d.ts.map +1 -0
- package/types/tools/BuildContextTool.d.ts +33 -0
- package/types/tools/BuildContextTool.d.ts.map +1 -0
package/src/index.ts
CHANGED
|
@@ -4,10 +4,14 @@ import {OllamaAiConfig} from "./config/OllamaAiConfig.js";
|
|
|
4
4
|
import {DeepSeekConfig} from "./config/DeepSeekConfig.js";
|
|
5
5
|
import {ElevenLabsTTSConfig} from "./config/ElevenLabsTTSConfig.js";
|
|
6
6
|
import {AILogSchema, AILogBaseSchema} from "./schemas/AILogSchema.js";
|
|
7
|
+
import {TTSVoiceSchema, TTSVoiceBaseSchema, TTSVoiceProviderSchema} from "./schemas/TTSVoiceSchema.js";
|
|
7
8
|
import {TTSRequestSchema, TTSVoiceSettingsSchema} from "./schemas/TTSRequestSchema.js";
|
|
8
9
|
import AILogModel from "./models/AILogModel.js";
|
|
10
|
+
import TTSVoiceModel from "./models/TTSVoiceModel.js";
|
|
9
11
|
import AILogMongoRepository from "./repository/mongo/AILogMongoRepository.js";
|
|
10
12
|
import AILogSqliteRepository from "./repository/sqlite/AILogSqliteRepository.js";
|
|
13
|
+
import TTSVoiceMongoRepository from "./repository/mongo/TTSVoiceMongoRepository.js";
|
|
14
|
+
import TTSVoiceSqliteRepository from "./repository/sqlite/TTSVoiceSqliteRepository.js";
|
|
11
15
|
import {OpenAiProviderFactory} from "./factory/ai/OpenAiProviderFactory.js";
|
|
12
16
|
import {GoogleAiProviderFactory} from "./factory/ai/GoogleAiProviderFactory.js";
|
|
13
17
|
import {OllamaAiProviderFactory} from "./factory/ai/OllamaAiProviderFactory.js";
|
|
@@ -18,6 +22,7 @@ import {TTSProviderFactory} from "./factory/tts/TTSProviderFactory.js";
|
|
|
18
22
|
import type {TTSProviderInfo} from "./factory/tts/TTSProviderFactory.js";
|
|
19
23
|
import {DraxAgentFactory} from "./factory/DraxAgentFactory.js";
|
|
20
24
|
import AILogServiceFactory from "./factory/services/AILogServiceFactory.js";
|
|
25
|
+
import TTSVoiceServiceFactory from "./factory/services/TTSVoiceServiceFactory.js";
|
|
21
26
|
import {OpenAiProvider} from "./providers/ai/OpenAiProvider.js";
|
|
22
27
|
import {GoogleAiProvider} from "./providers/ai/GoogleAiProvider.js";
|
|
23
28
|
import {OllamaAiProvider} from "./providers/ai/OllamaAiProvider.js";
|
|
@@ -26,6 +31,7 @@ import {ElevenLabsTTSProvider} from "./providers/tts/ElevenLabsTTSProvider.js";
|
|
|
26
31
|
import {BuilderTool} from "./tools/BuilderTool.js";
|
|
27
32
|
import {KnowledgeService} from "./services/KnowledgeService.js";
|
|
28
33
|
import {AILogService} from "./services/AILogService.js";
|
|
34
|
+
import {TTSVoiceService} from "./services/TTSVoiceService.js";
|
|
29
35
|
import {TTSGenericService} from "./services/TTSGenericService.js";
|
|
30
36
|
import {PromptAudioService} from "./services/PromptAudioService.js";
|
|
31
37
|
import AILogPermissions from "./permissions/AILogPermissions.js";
|
|
@@ -33,19 +39,24 @@ import AgentPermissions from "./permissions/AgentPermissions.js";
|
|
|
33
39
|
import AgentSessionPermissions from "./permissions/AgentSessionPermissions.js";
|
|
34
40
|
import AIPermissions from "./permissions/AIPermissions.js";
|
|
35
41
|
import TTSPermissions from "./permissions/TTSPermissions.js";
|
|
42
|
+
import TTSVoicePermissions from "./permissions/TTSVoicePermissions.js";
|
|
36
43
|
import AILogController from "./controllers/AILogController.js";
|
|
37
44
|
import AICrudController from "./controllers/AICrudController.js";
|
|
38
45
|
import AIGenericController from "./controllers/AIGenericController.js";
|
|
39
46
|
import TTSGenericController from "./controllers/TTSGenericController.js";
|
|
47
|
+
import TTSVoiceController from "./controllers/TTSVoiceController.js";
|
|
40
48
|
import DraxAgentController from "./controllers/DraxAgentController.js";
|
|
41
49
|
import AgentSessionController from "./controllers/AgentSessionController.js";
|
|
42
50
|
import AILogRoutes from "./routes/AILogRoutes.js";
|
|
43
51
|
import AIRoutes from "./routes/AIRoutes.js";
|
|
44
52
|
import TTSRoutes from "./routes/TTSRoutes.js";
|
|
53
|
+
import TTSVoiceRoutes from "./routes/TTSVoiceRoutes.js";
|
|
45
54
|
import DraxAgentRoutes from "./routes/DraxAgentRoutes.js";
|
|
46
55
|
import AgentSessionRoutes from "./routes/AgentSessionRoutes.js";
|
|
47
56
|
import {DraxAgent} from "./agents/DraxAgent.js";
|
|
57
|
+
import {BuildContextTool} from "./tools/BuildContextTool.js";
|
|
48
58
|
import type {IAILogRepository} from "./interfaces/IAILogRepository.js";
|
|
59
|
+
import type {ITTSVoiceRepository} from "./interfaces/ITTSVoiceRepository.js";
|
|
49
60
|
import type {
|
|
50
61
|
IAIProvider,
|
|
51
62
|
IPromptContentPart,
|
|
@@ -80,6 +91,10 @@ import type {
|
|
|
80
91
|
ToolBuilderOptions,
|
|
81
92
|
ToolBuilderService
|
|
82
93
|
} from "./interfaces/IBuilderTool.js";
|
|
94
|
+
import type {
|
|
95
|
+
BuildContextToolContext,
|
|
96
|
+
BuildContextToolOptions,
|
|
97
|
+
} from "./tools/BuildContextTool.js";
|
|
83
98
|
import type {
|
|
84
99
|
DraxAgentControllerOptions
|
|
85
100
|
} from "./interfaces/IDraxAgentController.js";
|
|
@@ -102,6 +117,7 @@ import type {
|
|
|
102
117
|
export type {
|
|
103
118
|
|
|
104
119
|
IAILogRepository,
|
|
120
|
+
ITTSVoiceRepository,
|
|
105
121
|
IAIProvider,
|
|
106
122
|
IPromptParams,
|
|
107
123
|
IPromptMessage,
|
|
@@ -127,6 +143,8 @@ export type {
|
|
|
127
143
|
ToolBuilderMethod,
|
|
128
144
|
ToolBuilderOptions,
|
|
129
145
|
ToolBuilderService,
|
|
146
|
+
BuildContextToolContext,
|
|
147
|
+
BuildContextToolOptions,
|
|
130
148
|
DraxAgentControllerOptions,
|
|
131
149
|
DraxAgentFastifyRoutesOptions,
|
|
132
150
|
DraxAgentConfig,
|
|
@@ -149,11 +167,17 @@ export {
|
|
|
149
167
|
ElevenLabsTTSConfig,
|
|
150
168
|
AILogSchema,
|
|
151
169
|
AILogBaseSchema,
|
|
170
|
+
TTSVoiceSchema,
|
|
171
|
+
TTSVoiceBaseSchema,
|
|
172
|
+
TTSVoiceProviderSchema,
|
|
152
173
|
TTSRequestSchema,
|
|
153
174
|
TTSVoiceSettingsSchema,
|
|
154
175
|
AILogModel,
|
|
176
|
+
TTSVoiceModel,
|
|
155
177
|
AILogMongoRepository,
|
|
156
178
|
AILogSqliteRepository,
|
|
179
|
+
TTSVoiceMongoRepository,
|
|
180
|
+
TTSVoiceSqliteRepository,
|
|
157
181
|
OpenAiProviderFactory,
|
|
158
182
|
GoogleAiProviderFactory,
|
|
159
183
|
OllamaAiProviderFactory,
|
|
@@ -163,15 +187,18 @@ export {
|
|
|
163
187
|
TTSProviderFactory,
|
|
164
188
|
DraxAgentFactory,
|
|
165
189
|
AILogServiceFactory,
|
|
190
|
+
TTSVoiceServiceFactory,
|
|
166
191
|
OpenAiProvider,
|
|
167
192
|
GoogleAiProvider,
|
|
168
193
|
OllamaAiProvider,
|
|
169
194
|
DeepSeekAiProvider,
|
|
170
195
|
ElevenLabsTTSProvider,
|
|
171
196
|
BuilderTool,
|
|
197
|
+
BuildContextTool,
|
|
172
198
|
//Service
|
|
173
199
|
KnowledgeService,
|
|
174
200
|
AILogService,
|
|
201
|
+
TTSVoiceService,
|
|
175
202
|
TTSGenericService,
|
|
176
203
|
PromptAudioService,
|
|
177
204
|
//Permissions
|
|
@@ -179,18 +206,21 @@ export {
|
|
|
179
206
|
AgentPermissions,
|
|
180
207
|
AIPermissions,
|
|
181
208
|
TTSPermissions,
|
|
209
|
+
TTSVoicePermissions,
|
|
182
210
|
AgentSessionPermissions,
|
|
183
211
|
//Controllers
|
|
184
212
|
AILogController,
|
|
185
213
|
AICrudController,
|
|
186
214
|
AIGenericController,
|
|
187
215
|
TTSGenericController,
|
|
216
|
+
TTSVoiceController,
|
|
188
217
|
DraxAgentController,
|
|
189
218
|
AgentSessionController,
|
|
190
219
|
DraxAgent,
|
|
191
220
|
AILogRoutes,
|
|
192
221
|
AIRoutes,
|
|
193
222
|
TTSRoutes,
|
|
223
|
+
TTSVoiceRoutes,
|
|
194
224
|
DraxAgentRoutes,
|
|
195
225
|
AgentSessionRoutes
|
|
196
226
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface ITTSVoiceBase {
|
|
2
|
+
name: string
|
|
3
|
+
ttsProvider: 'ElevenLabs'
|
|
4
|
+
voiceId: string
|
|
5
|
+
model?: string
|
|
6
|
+
languageCode?: string
|
|
7
|
+
tenant?: any
|
|
8
|
+
user?: any
|
|
9
|
+
createdAt?: Date
|
|
10
|
+
updatedAt?: Date
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ITTSVoice extends ITTSVoiceBase {
|
|
14
|
+
_id: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type {
|
|
18
|
+
ITTSVoiceBase,
|
|
19
|
+
ITTSVoice,
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {mongoose} from '@drax/common-back';
|
|
2
|
+
import {PaginateModel} from "mongoose";
|
|
3
|
+
import uniqueValidator from 'mongoose-unique-validator';
|
|
4
|
+
import mongoosePaginate from 'mongoose-paginate-v2'
|
|
5
|
+
import type {ITTSVoice} from '../interfaces/ITTSVoice'
|
|
6
|
+
|
|
7
|
+
const TTSVoiceSchema = new mongoose.Schema<ITTSVoice>({
|
|
8
|
+
name: {type: String, required: true, index: true, unique: false},
|
|
9
|
+
ttsProvider: {type: String, enum: ['ElevenLabs'], required: true, index: true, unique: false},
|
|
10
|
+
voiceId: {type: String, required: true, index: true, unique: false},
|
|
11
|
+
model: {type: String, required: false, index: true, unique: false},
|
|
12
|
+
languageCode: {type: String, required: false, index: true, unique: false},
|
|
13
|
+
tenant: {type: mongoose.Schema.Types.ObjectId, ref: 'Tenant', required: false, index: true, unique: false},
|
|
14
|
+
user: {type: mongoose.Schema.Types.ObjectId, ref: 'User', required: false, index: true, unique: false}
|
|
15
|
+
}, {timestamps: true});
|
|
16
|
+
|
|
17
|
+
TTSVoiceSchema.index({ttsProvider: 1, voiceId: 1, tenant: 1}, {unique: true, sparse: true});
|
|
18
|
+
TTSVoiceSchema.plugin(uniqueValidator, {message: 'validation.unique'});
|
|
19
|
+
TTSVoiceSchema.plugin(mongoosePaginate);
|
|
20
|
+
|
|
21
|
+
TTSVoiceSchema.virtual("id").get(function () {
|
|
22
|
+
return this._id.toString();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
TTSVoiceSchema.set('toJSON', {getters: true, virtuals: true});
|
|
26
|
+
TTSVoiceSchema.set('toObject', {getters: true, virtuals: true});
|
|
27
|
+
|
|
28
|
+
const MODEL_NAME = 'TTSVoice';
|
|
29
|
+
const COLLECTION_NAME = 'TTSVoice';
|
|
30
|
+
const TTSVoiceModel = mongoose.model<ITTSVoice, PaginateModel<ITTSVoice>>(MODEL_NAME, TTSVoiceSchema, COLLECTION_NAME);
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
TTSVoiceSchema,
|
|
34
|
+
TTSVoiceModel
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default TTSVoiceModel
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {AbstractMongoRepository} from "@drax/crud-back";
|
|
2
|
+
import {TTSVoiceModel} from "../../models/TTSVoiceModel.js";
|
|
3
|
+
import type {ITTSVoiceRepository} from '../../interfaces/ITTSVoiceRepository'
|
|
4
|
+
import type {ITTSVoice, ITTSVoiceBase} from "../../interfaces/ITTSVoice";
|
|
5
|
+
|
|
6
|
+
class TTSVoiceMongoRepository extends AbstractMongoRepository<ITTSVoice, ITTSVoiceBase, ITTSVoiceBase> implements ITTSVoiceRepository {
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this._model = TTSVoiceModel;
|
|
11
|
+
this._searchFields = ['name', 'ttsProvider', 'voiceId', 'model', 'languageCode'];
|
|
12
|
+
this._populateFields = ['tenant', 'user'];
|
|
13
|
+
this._lean = true
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default TTSVoiceMongoRepository
|
|
19
|
+
export {TTSVoiceMongoRepository}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {AbstractSqliteRepository} from "@drax/crud-back";
|
|
2
|
+
import type {ITTSVoiceRepository} from '../../interfaces/ITTSVoiceRepository'
|
|
3
|
+
import type {ITTSVoice, ITTSVoiceBase} from "../../interfaces/ITTSVoice";
|
|
4
|
+
import {SqliteTableField} from "@drax/common-back";
|
|
5
|
+
|
|
6
|
+
class TTSVoiceSqliteRepository extends AbstractSqliteRepository<ITTSVoice, ITTSVoiceBase, ITTSVoiceBase> implements ITTSVoiceRepository {
|
|
7
|
+
|
|
8
|
+
protected db: any;
|
|
9
|
+
protected tableName: string = 'TTSVoice';
|
|
10
|
+
protected dataBaseFile: string;
|
|
11
|
+
protected searchFields: string[] = ['name', 'ttsProvider', 'voiceId', 'model', 'languageCode'];
|
|
12
|
+
protected booleanFields: string[] = [];
|
|
13
|
+
protected jsonFields: string[] = [];
|
|
14
|
+
protected identifier: string = '_id';
|
|
15
|
+
protected populateFields = [
|
|
16
|
+
{field: 'tenant', table: 'tenant', identifier: '_id'},
|
|
17
|
+
{field: 'user', table: 'user', identifier: '_id'}
|
|
18
|
+
]
|
|
19
|
+
protected verbose: boolean = false;
|
|
20
|
+
protected tableFields: SqliteTableField[] = [
|
|
21
|
+
{name: "name", type: "TEXT", unique: false, primary: false},
|
|
22
|
+
{name: "ttsProvider", type: "TEXT", unique: false, primary: false},
|
|
23
|
+
{name: "voiceId", type: "TEXT", unique: false, primary: false},
|
|
24
|
+
{name: "model", type: "TEXT", unique: false, primary: false},
|
|
25
|
+
{name: "languageCode", type: "TEXT", unique: false, primary: false},
|
|
26
|
+
{name: "tenant", type: "TEXT", unique: false, primary: false},
|
|
27
|
+
{name: "user", type: "TEXT", unique: false, primary: false}
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default TTSVoiceSqliteRepository
|
|
33
|
+
export {TTSVoiceSqliteRepository}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import TTSVoiceController from "../controllers/TTSVoiceController.js";
|
|
2
|
+
import {CrudSchemaBuilder} from "@drax/crud-back";
|
|
3
|
+
import {TTSVoiceSchema, TTSVoiceBaseSchema} from '../schemas/TTSVoiceSchema.js'
|
|
4
|
+
|
|
5
|
+
async function TTSVoiceRoutes(fastify, options) {
|
|
6
|
+
|
|
7
|
+
const controller: TTSVoiceController = new TTSVoiceController()
|
|
8
|
+
const schemas = new CrudSchemaBuilder(TTSVoiceSchema, TTSVoiceBaseSchema, TTSVoiceBaseSchema, 'TTSVoice', 'openapi-3.0', ['ai']);
|
|
9
|
+
|
|
10
|
+
fastify.get('/api/ttsvoice', {schema: schemas.paginateSchema}, (req, rep) => controller.paginate(req, rep))
|
|
11
|
+
fastify.get('/api/ttsvoice/find', {schema: schemas.findSchema}, (req, rep) => controller.find(req, rep))
|
|
12
|
+
fastify.get('/api/ttsvoice/search', {schema: schemas.searchSchema}, (req, rep) => controller.search(req, rep))
|
|
13
|
+
fastify.get('/api/ttsvoice/:id', {schema: schemas.findByIdSchema}, (req, rep) => controller.findById(req, rep))
|
|
14
|
+
fastify.get('/api/ttsvoice/find-one', {schema: schemas.findOneSchema}, (req, rep) => controller.findOne(req, rep))
|
|
15
|
+
fastify.get('/api/ttsvoice/group-by', {schema: schemas.groupBySchema}, (req, rep) => controller.groupBy(req, rep))
|
|
16
|
+
fastify.post('/api/ttsvoice', {schema: schemas.createSchema}, (req, rep) => controller.create(req, rep))
|
|
17
|
+
fastify.put('/api/ttsvoice/:id', {schema: schemas.updateSchema}, (req, rep) => controller.update(req, rep))
|
|
18
|
+
fastify.patch('/api/ttsvoice/:id', {schema: schemas.updateSchema}, (req, rep) => controller.updatePartial(req, rep))
|
|
19
|
+
fastify.delete('/api/ttsvoice/:id', {schema: schemas.deleteSchema}, (req, rep) => controller.delete(req, rep))
|
|
20
|
+
fastify.get('/api/ttsvoice/export', (req, rep) => controller.export(req, rep))
|
|
21
|
+
fastify.post('/api/ttsvoice/import', (req, rep) => controller.import(req, rep))
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default TTSVoiceRoutes;
|
|
26
|
+
export {TTSVoiceRoutes}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {z} from 'zod';
|
|
2
|
+
|
|
3
|
+
const TTSVoiceProviderSchema = z.enum(['ElevenLabs']);
|
|
4
|
+
|
|
5
|
+
const TTSVoiceBaseSchema = z.object({
|
|
6
|
+
name: z.string().min(1, 'validation.required'),
|
|
7
|
+
ttsProvider: TTSVoiceProviderSchema,
|
|
8
|
+
voiceId: z.string().min(1, 'validation.required'),
|
|
9
|
+
model: z.string().optional().nullable(),
|
|
10
|
+
languageCode: z.string().optional().nullable(),
|
|
11
|
+
tenant: z.coerce.string().optional().nullable(),
|
|
12
|
+
user: z.coerce.string().optional().nullable()
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const TTSVoiceSchema = TTSVoiceBaseSchema
|
|
16
|
+
.extend({
|
|
17
|
+
_id: z.coerce.string(),
|
|
18
|
+
tenant: z.object({_id: z.coerce.string(), name: z.string().optional()}).nullable().optional(),
|
|
19
|
+
user: z.object({_id: z.coerce.string(), username: z.string().optional()}).nullable().optional()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export default TTSVoiceSchema;
|
|
23
|
+
export {TTSVoiceSchema, TTSVoiceBaseSchema, TTSVoiceProviderSchema}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type {ITTSVoiceRepository} from "../interfaces/ITTSVoiceRepository";
|
|
2
|
+
import type {ITTSVoiceBase, ITTSVoice} from "../interfaces/ITTSVoice";
|
|
3
|
+
import {AbstractService} from "@drax/crud-back";
|
|
4
|
+
import type {ZodObject, ZodRawShape} from "zod";
|
|
5
|
+
|
|
6
|
+
class TTSVoiceService extends AbstractService<ITTSVoice, ITTSVoiceBase, ITTSVoiceBase> {
|
|
7
|
+
|
|
8
|
+
constructor(TTSVoiceRepository: ITTSVoiceRepository, baseSchema?: ZodObject<ZodRawShape>, fullSchema?: ZodObject<ZodRawShape>) {
|
|
9
|
+
super(TTSVoiceRepository, baseSchema, fullSchema);
|
|
10
|
+
this._validateOutput = true
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default TTSVoiceService
|
|
16
|
+
export {TTSVoiceService}
|