mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 00:17:31 +00:00
variable name
This commit is contained in:
@@ -3,7 +3,7 @@ import { auth } from './system.js';
|
||||
|
||||
export const useAppRoute = (app) => {
|
||||
// 获取AI助手列表
|
||||
app.get('/models', auth(), async (req, res) => {
|
||||
app.get('/apps', auth(), async (req, res) => {
|
||||
try {
|
||||
const start = parseInt(req.query._start) || 0;
|
||||
const end = parseInt(req.query._end) || 20;
|
||||
@@ -25,27 +25,27 @@ export const useAppRoute = (app) => {
|
||||
const models = [];
|
||||
|
||||
for (const modelRaw of modelsRaw) {
|
||||
const model = modelRaw.toObject();
|
||||
const app = modelRaw.toObject();
|
||||
|
||||
// 获取与模型关联的知识库名称
|
||||
const kbNames = [];
|
||||
for (const kbId of model.chat.relatedKbs) {
|
||||
for (const kbId of app.chat.relatedKbs) {
|
||||
const kb = await Kb.findById(kbId);
|
||||
kbNames.push(kb.name);
|
||||
}
|
||||
|
||||
const orderedModel = {
|
||||
id: model._id.toString(),
|
||||
userId: model.userId,
|
||||
name: model.name,
|
||||
intro: model.intro,
|
||||
model: model.chat?.chatModel,
|
||||
id: app._id.toString(),
|
||||
userId: app.userId,
|
||||
name: app.name,
|
||||
intro: app.intro,
|
||||
app: app.chat?.chatModel,
|
||||
relatedKbs: kbNames, // 将relatedKbs的id转换为相应的Kb名称
|
||||
systemPrompt: model.chat?.systemPrompt || '',
|
||||
temperature: model.chat?.temperature || 0,
|
||||
'share.topNum': model.share?.topNum || 0,
|
||||
'share.isShare': model.share?.isShare || false,
|
||||
'share.collection': model.share?.collection || 0
|
||||
systemPrompt: app.chat?.systemPrompt || '',
|
||||
temperature: app.chat?.temperature || 0,
|
||||
'share.topNum': app.share?.topNum || 0,
|
||||
'share.isShare': app.share?.isShare || false,
|
||||
'share.collection': app.share?.collection || 0
|
||||
};
|
||||
|
||||
models.push(orderedModel);
|
||||
@@ -61,7 +61,7 @@ export const useAppRoute = (app) => {
|
||||
});
|
||||
|
||||
// 修改 app 信息
|
||||
app.put('/models/:id', auth(), async (req, res) => {
|
||||
app.put('/apps/:id', auth(), async (req, res) => {
|
||||
try {
|
||||
const _id = req.params.id;
|
||||
|
||||
|
@@ -104,7 +104,7 @@ const SystemSchema = new mongoose.Schema({
|
||||
}
|
||||
});
|
||||
|
||||
export const App = mongoose.models['model'] || mongoose.model('model', appSchema);
|
||||
export const App = mongoose.models['app'] || mongoose.model('app', appSchema);
|
||||
export const Kb = mongoose.models['kb'] || mongoose.model('kb', kbSchema);
|
||||
export const User = mongoose.models['user'] || mongoose.model('user', userSchema);
|
||||
export const Pay = mongoose.models['pay'] || mongoose.model('pay', paySchema);
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
HTTPClient
|
||||
} from 'tushan';
|
||||
import { authProvider } from './auth';
|
||||
import { userFields, payFields, kbFields, ModelFields, SystemFields } from './fields';
|
||||
import { userFields, payFields, kbFields, AppFields, SystemFields } from './fields';
|
||||
import { Dashboard } from './Dashboard';
|
||||
import { IconUser, IconApps, IconBook, IconStamp } from 'tushan/icon';
|
||||
import { i18nZhTranslation } from 'tushan/client/i18n/resources/zh';
|
||||
@@ -69,7 +69,7 @@ function App() {
|
||||
}
|
||||
/>
|
||||
<Resource
|
||||
name="models"
|
||||
name="apps"
|
||||
icon={<IconApps />}
|
||||
label="应用"
|
||||
list={
|
||||
@@ -82,7 +82,7 @@ function App() {
|
||||
label: 'name'
|
||||
})
|
||||
]}
|
||||
fields={ModelFields}
|
||||
fields={AppFields}
|
||||
action={{ detail: true, edit: true }}
|
||||
/>
|
||||
}
|
||||
|
@@ -24,11 +24,11 @@ export const kbFields = [
|
||||
createTextField('tags', { label: 'Tags' })
|
||||
];
|
||||
|
||||
export const ModelFields = [
|
||||
export const AppFields = [
|
||||
createTextField('id', { label: 'ID' }),
|
||||
createTextField('userId', { label: '所属用户', list: { hidden: true }, edit: { hidden: true } }),
|
||||
createTextField('name', { label: '名字' }),
|
||||
createTextField('model', { label: '模型', edit: { hidden: true } }),
|
||||
createTextField('app', { label: '应用', edit: { hidden: true } }),
|
||||
createTextField('share.collection', { label: '收藏数', list: { sort: true } }),
|
||||
createTextField('share.topNum', { label: '置顶等级', list: { sort: true } }),
|
||||
createTextField('share.isShare', { label: '是否分享(true,false)' }),
|
||||
|
Reference in New Issue
Block a user