Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
6c72c203
authored
Jul 12, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variable name
parent
eb68b35d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
20 deletions
+20
-20
admin/service/route/app.js
+14
-14
admin/service/schema.js
+1
-1
admin/src/App.tsx
+3
-3
admin/src/fields.ts
+2
-2
No files found.
admin/service/route/app.js
View file @
6c72c203
...
@@ -3,7 +3,7 @@ import { auth } from './system.js';
...
@@ -3,7 +3,7 @@ import { auth } from './system.js';
export
const
useAppRoute
=
(
app
)
=>
{
export
const
useAppRoute
=
(
app
)
=>
{
// 获取AI助手列表
// 获取AI助手列表
app
.
get
(
'/
model
s'
,
auth
(),
async
(
req
,
res
)
=>
{
app
.
get
(
'/
app
s'
,
auth
(),
async
(
req
,
res
)
=>
{
try
{
try
{
const
start
=
parseInt
(
req
.
query
.
_start
)
||
0
;
const
start
=
parseInt
(
req
.
query
.
_start
)
||
0
;
const
end
=
parseInt
(
req
.
query
.
_end
)
||
20
;
const
end
=
parseInt
(
req
.
query
.
_end
)
||
20
;
...
@@ -25,27 +25,27 @@ export const useAppRoute = (app) => {
...
@@ -25,27 +25,27 @@ export const useAppRoute = (app) => {
const
models
=
[];
const
models
=
[];
for
(
const
modelRaw
of
modelsRaw
)
{
for
(
const
modelRaw
of
modelsRaw
)
{
const
model
=
modelRaw
.
toObject
();
const
app
=
modelRaw
.
toObject
();
// 获取与模型关联的知识库名称
// 获取与模型关联的知识库名称
const
kbNames
=
[];
const
kbNames
=
[];
for
(
const
kbId
of
model
.
chat
.
relatedKbs
)
{
for
(
const
kbId
of
app
.
chat
.
relatedKbs
)
{
const
kb
=
await
Kb
.
findById
(
kbId
);
const
kb
=
await
Kb
.
findById
(
kbId
);
kbNames
.
push
(
kb
.
name
);
kbNames
.
push
(
kb
.
name
);
}
}
const
orderedModel
=
{
const
orderedModel
=
{
id
:
model
.
_id
.
toString
(),
id
:
app
.
_id
.
toString
(),
userId
:
model
.
userId
,
userId
:
app
.
userId
,
name
:
model
.
name
,
name
:
app
.
name
,
intro
:
model
.
intro
,
intro
:
app
.
intro
,
model
:
model
.
chat
?.
chatModel
,
app
:
app
.
chat
?.
chatModel
,
relatedKbs
:
kbNames
,
// 将relatedKbs的id转换为相应的Kb名称
relatedKbs
:
kbNames
,
// 将relatedKbs的id转换为相应的Kb名称
systemPrompt
:
model
.
chat
?.
systemPrompt
||
''
,
systemPrompt
:
app
.
chat
?.
systemPrompt
||
''
,
temperature
:
model
.
chat
?.
temperature
||
0
,
temperature
:
app
.
chat
?.
temperature
||
0
,
'share.topNum'
:
model
.
share
?.
topNum
||
0
,
'share.topNum'
:
app
.
share
?.
topNum
||
0
,
'share.isShare'
:
model
.
share
?.
isShare
||
false
,
'share.isShare'
:
app
.
share
?.
isShare
||
false
,
'share.collection'
:
model
.
share
?.
collection
||
0
'share.collection'
:
app
.
share
?.
collection
||
0
};
};
models
.
push
(
orderedModel
);
models
.
push
(
orderedModel
);
...
@@ -61,7 +61,7 @@ export const useAppRoute = (app) => {
...
@@ -61,7 +61,7 @@ export const useAppRoute = (app) => {
});
});
// 修改 app 信息
// 修改 app 信息
app
.
put
(
'/
model
s/:id'
,
auth
(),
async
(
req
,
res
)
=>
{
app
.
put
(
'/
app
s/:id'
,
auth
(),
async
(
req
,
res
)
=>
{
try
{
try
{
const
_id
=
req
.
params
.
id
;
const
_id
=
req
.
params
.
id
;
...
...
admin/service/schema.js
View file @
6c72c203
...
@@ -104,7 +104,7 @@ const SystemSchema = new mongoose.Schema({
...
@@ -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
Kb
=
mongoose
.
models
[
'kb'
]
||
mongoose
.
model
(
'kb'
,
kbSchema
);
export
const
User
=
mongoose
.
models
[
'user'
]
||
mongoose
.
model
(
'user'
,
userSchema
);
export
const
User
=
mongoose
.
models
[
'user'
]
||
mongoose
.
model
(
'user'
,
userSchema
);
export
const
Pay
=
mongoose
.
models
[
'pay'
]
||
mongoose
.
model
(
'pay'
,
paySchema
);
export
const
Pay
=
mongoose
.
models
[
'pay'
]
||
mongoose
.
model
(
'pay'
,
paySchema
);
...
...
admin/src/App.tsx
View file @
6c72c203
...
@@ -9,7 +9,7 @@ import {
...
@@ -9,7 +9,7 @@ import {
HTTPClient
HTTPClient
}
from
'tushan'
;
}
from
'tushan'
;
import
{
authProvider
}
from
'./auth'
;
import
{
authProvider
}
from
'./auth'
;
import
{
userFields
,
payFields
,
kbFields
,
Model
Fields
,
SystemFields
}
from
'./fields'
;
import
{
userFields
,
payFields
,
kbFields
,
App
Fields
,
SystemFields
}
from
'./fields'
;
import
{
Dashboard
}
from
'./Dashboard'
;
import
{
Dashboard
}
from
'./Dashboard'
;
import
{
IconUser
,
IconApps
,
IconBook
,
IconStamp
}
from
'tushan/icon'
;
import
{
IconUser
,
IconApps
,
IconBook
,
IconStamp
}
from
'tushan/icon'
;
import
{
i18nZhTranslation
}
from
'tushan/client/i18n/resources/zh'
;
import
{
i18nZhTranslation
}
from
'tushan/client/i18n/resources/zh'
;
...
@@ -69,7 +69,7 @@ function App() {
...
@@ -69,7 +69,7 @@ function App() {
}
}
/>
/>
<
Resource
<
Resource
name=
"
model
s"
name=
"
app
s"
icon=
{
<
IconApps
/>
}
icon=
{
<
IconApps
/>
}
label=
"应用"
label=
"应用"
list=
{
list=
{
...
@@ -82,7 +82,7 @@ function App() {
...
@@ -82,7 +82,7 @@ function App() {
label
:
'name'
label
:
'name'
})
})
]
}
]
}
fields=
{
Model
Fields
}
fields=
{
App
Fields
}
action=
{
{
detail
:
true
,
edit
:
true
}
}
action=
{
{
detail
:
true
,
edit
:
true
}
}
/>
/>
}
}
...
...
admin/src/fields.ts
View file @
6c72c203
...
@@ -24,11 +24,11 @@ export const kbFields = [
...
@@ -24,11 +24,11 @@ export const kbFields = [
createTextField
(
'tags'
,
{
label
:
'Tags'
})
createTextField
(
'tags'
,
{
label
:
'Tags'
})
];
];
export
const
Model
Fields
=
[
export
const
App
Fields
=
[
createTextField
(
'id'
,
{
label
:
'ID'
}),
createTextField
(
'id'
,
{
label
:
'ID'
}),
createTextField
(
'userId'
,
{
label
:
'所属用户'
,
list
:
{
hidden
:
true
},
edit
:
{
hidden
:
true
}
}),
createTextField
(
'userId'
,
{
label
:
'所属用户'
,
list
:
{
hidden
:
true
},
edit
:
{
hidden
:
true
}
}),
createTextField
(
'name'
,
{
label
:
'名字'
}),
createTextField
(
'name'
,
{
label
:
'名字'
}),
createTextField
(
'
model'
,
{
label
:
'模型
'
,
edit
:
{
hidden
:
true
}
}),
createTextField
(
'
app'
,
{
label
:
'应用
'
,
edit
:
{
hidden
:
true
}
}),
createTextField
(
'share.collection'
,
{
label
:
'收藏数'
,
list
:
{
sort
:
true
}
}),
createTextField
(
'share.collection'
,
{
label
:
'收藏数'
,
list
:
{
sort
:
true
}
}),
createTextField
(
'share.topNum'
,
{
label
:
'置顶等级'
,
list
:
{
sort
:
true
}
}),
createTextField
(
'share.topNum'
,
{
label
:
'置顶等级'
,
list
:
{
sort
:
true
}
}),
createTextField
(
'share.isShare'
,
{
label
:
'是否分享(true,false)'
}),
createTextField
(
'share.isShare'
,
{
label
:
'是否分享(true,false)'
}),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment