mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-30 10:28:42 +00:00
myapps
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Schema, model, models, Model as MongoModel } from 'mongoose';
|
||||
import { AppSchema as ModelType } from '@/types/mongoSchema';
|
||||
import { Schema, model, models, Model } from 'mongoose';
|
||||
import { AppSchema as AppType } from '@/types/mongoSchema';
|
||||
import { ChatModelMap, OpenAiChatEnum } from '@/constants/model';
|
||||
|
||||
const AppSchema = new Schema({
|
||||
@@ -105,4 +105,4 @@ try {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
export const Model: MongoModel<ModelType> = models['model'] || model('model', AppSchema);
|
||||
export const App: Model<AppType> = models['model'] || model('model', AppSchema);
|
18
client/src/service/models/installApp.ts
Normal file
18
client/src/service/models/installApp.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Schema, model, models, Model } from 'mongoose';
|
||||
import { ChatSchema as ChatType } from '@/types/mongoSchema';
|
||||
import { ChatRoleMap } from '@/constants/chat';
|
||||
|
||||
const InstallAppSchema = new Schema({
|
||||
userId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'user',
|
||||
required: true
|
||||
},
|
||||
modelId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'model',
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
export const InstallApp: Model<ChatType> = models['installApp'] || model('chat', InstallAppSchema);
|
@@ -55,7 +55,7 @@ export async function connectToDatabase(): Promise<void> {
|
||||
|
||||
export * from './models/authCode';
|
||||
export * from './models/chat';
|
||||
export * from './models/model';
|
||||
export * from './models/app';
|
||||
export * from './models/user';
|
||||
export * from './models/bill';
|
||||
export * from './models/pay';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import type { NextApiRequest } from 'next';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import Cookie from 'cookie';
|
||||
import { Chat, Model, OpenApi, User, ShareChat, KB } from '../mongo';
|
||||
import { Chat, App, OpenApi, User, ShareChat, KB } from '../mongo';
|
||||
import type { AppSchema } from '@/types/mongoSchema';
|
||||
import type { ChatItemType } from '@/types/chat';
|
||||
import mongoose from 'mongoose';
|
||||
@@ -218,7 +218,7 @@ export const authApp = async ({
|
||||
reserveDetail?: boolean; // focus reserve detail
|
||||
}) => {
|
||||
// 获取 model 数据
|
||||
const app = await Model.findById<AppSchema>(appId);
|
||||
const app = await App.findById<AppSchema>(appId);
|
||||
if (!app) {
|
||||
return Promise.reject('模型不存在');
|
||||
}
|
||||
|
Reference in New Issue
Block a user