mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 12:20:34 +00:00

* rebuild embedding queue * dataset menu * feat: rebuild data api * feat: ui change embedding model * dataset ui * feat: rebuild index ui * rename collection
37 lines
827 B
TypeScript
37 lines
827 B
TypeScript
import { connectionMongo, type Model } from '../../../common/mongo';
|
|
const { Schema, model, models } = connectionMongo;
|
|
import { TTSBufferSchemaType } from './type.d';
|
|
|
|
export const collectionName = 'buffer_tts';
|
|
|
|
const TTSBufferSchema = new Schema({
|
|
bufferId: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
text: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
buffer: {
|
|
type: Buffer,
|
|
required: true
|
|
},
|
|
createTime: {
|
|
type: Date,
|
|
default: () => new Date()
|
|
}
|
|
});
|
|
|
|
try {
|
|
TTSBufferSchema.index({ bufferId: 1 });
|
|
// 24 hour
|
|
TTSBufferSchema.index({ createTime: 1 }, { expireAfterSeconds: 24 * 60 * 60 });
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
|
|
export const MongoTTSBuffer: Model<TTSBufferSchemaType> =
|
|
models[collectionName] || model(collectionName, TTSBufferSchema);
|
|
MongoTTSBuffer.syncIndexes();
|