File tree Expand file tree Collapse file tree 8 files changed +70
-21
lines changed Expand file tree Collapse file tree 8 files changed +70
-21
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ export const splitText2Chunks = (props: {
151
151
const maxLen = splitTexts . length > 1 ? stepReges [ step ] . maxLen : chunkLen ;
152
152
const minChunkLen = chunkLen * 0.7 ;
153
153
const miniChunkLen = 30 ;
154
+ // console.log(splitTexts, stepReges[step].reg);
154
155
155
156
const chunks : string [ ] = [ ] ;
156
157
for ( let i = 0 ; i < splitTexts . length ; i ++ ) {
Original file line number Diff line number Diff line change
1
+ export enum SystemConfigsTypeEnum {
2
+ fastgpt = 'fastgpt' ,
3
+ fastgptPro = 'fastgptPro'
4
+ }
5
+
6
+ export const SystemConfigsTypeMap = {
7
+ [ SystemConfigsTypeEnum . fastgpt ] : {
8
+ label : 'fastgpt'
9
+ } ,
10
+ [ SystemConfigsTypeEnum . fastgptPro ] : {
11
+ label : 'fastgptPro'
12
+ }
13
+ } ;
Original file line number Diff line number Diff line change
1
+ import { SystemConfigsTypeEnum } from "./constants" ;
2
+
3
+ export type SystemConfigsType = {
4
+ _id : string ;
5
+ type : `${SystemConfigsTypeEnum } `;
6
+ value : Record < string , any > ;
7
+ createTime : Date ;
8
+ } ;
Original file line number Diff line number Diff line change
1
+ import { SystemConfigsType } from '@fastgpt/global/common/system/config/type' ;
2
+ import { connectionMongo , type Model } from '../../../common/mongo' ;
3
+ import { SystemConfigsTypeMap } from '@fastgpt/global/common/system/config/constants' ;
4
+
5
+ const { Schema, model, models } = connectionMongo ;
6
+
7
+ const collectionName = 'systemConfigs' ;
8
+ const systemConfigSchema = new Schema ( {
9
+ type : {
10
+ type : String ,
11
+ required : true ,
12
+ enum : Object . keys ( SystemConfigsTypeMap )
13
+ } ,
14
+ value : {
15
+ type : Object ,
16
+ required : true
17
+ } ,
18
+ createTime : {
19
+ type : Date ,
20
+ default : ( ) => new Date ( )
21
+ }
22
+ } )
23
+
24
+ try {
25
+ systemConfigSchema . index ( { createTime : - 1 } , { expireAfterSeconds : 90 * 24 * 60 * 60 } ) ;
26
+ } catch ( error ) {
27
+ console . log ( error ) ;
28
+ }
29
+
30
+ export const MongoSystemConfigs : Model < SystemConfigsType > =
31
+ models [ collectionName ] || model ( collectionName , systemConfigSchema ) ;
32
+ MongoSystemConfigs . syncIndexes ( ) ;
Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ export async function parseHeaderCert({
151
151
authType : AuthUserTypeEnum . root
152
152
} ;
153
153
}
154
+ // apikey: abandon
154
155
if ( authApiKey && apikey ) {
155
156
// apikey
156
157
const parseResult = await authOpenApiKey ( { apikey } ) ;
@@ -164,20 +165,8 @@ export async function parseHeaderCert({
164
165
} ;
165
166
}
166
167
167
- return {
168
- uid : '' ,
169
- teamId : '' ,
170
- tmbId : '' ,
171
- appId : '' ,
172
- openApiKey : '' ,
173
- authType : AuthUserTypeEnum . token
174
- } ;
175
- } ) ( ) ;
176
-
177
- // not rootUser and no uid, reject request
178
- if ( ! rootkey && ! uid && ! teamId && ! tmbId ) {
179
168
return Promise . reject ( ERROR_ENUM . unAuthorization ) ;
180
- }
169
+ } ) ( ) ;
181
170
182
171
return {
183
172
userId : String ( uid ) ,
Original file line number Diff line number Diff line change @@ -296,7 +296,7 @@ const CodeLight = ({
296
296
} ) => {
297
297
const { copyData } = useCopyData ( ) ;
298
298
299
- if ( ! inline && match ) {
299
+ if ( ! inline ) {
300
300
return (
301
301
< Box my = { 3 } borderRadius = { 'md' } overflow = { 'overlay' } backgroundColor = { '#222' } >
302
302
< Flex
Original file line number Diff line number Diff line change 308
308
}
309
309
.markdown code ,
310
310
.markdown tt {
311
- border : 1px solid #eaeaea ;
312
- border-radius : 3px 3px 3px 3px ;
311
+ border : 1px solid #dee0e2 ;
312
+ background-color : #f4f6f8 ;
313
+ border-radius : 3px ;
313
314
margin : 0 2px ;
314
315
padding : 0 5px ;
315
316
}
Original file line number Diff line number Diff line change 1
1
export const Prompt_AgentQA = {
2
- description : `我会给你一段文本,学习它们,并整理学习成果,要求为:
3
- 1. 提出问题并给出每个问题的答案。
4
- 2. 每个答案都要详细完整,给出相关原文描述,答案可以包含普通文字、链接、代码、表格、公示、媒体链接等 markdown 元素。
5
- 3. 最多提出 30 个问题。
2
+ description : `<context></context> 标记中是一段文本,学习它们,并整理学习成果。
3
+
4
+ 学习要求:
5
+ - 提出问题并给出每个问题的答案。
6
+ - 答案需详细完整,给出相关原文描述。答案可以包含普通文字、链接、代码、表格、公示、媒体链接等 markdown 元素。
7
+ - 最多提出 30 个问题。
6
8
` ,
7
9
fixedText : `最后,你需要按下面的格式返回多个问题和答案:
8
10
Q1: 问题。
11
13
A2:
12
14
……
13
15
14
- 我的文本:"""{{text}}"""`
16
+ <context>
17
+ {{text}}
18
+ <context/>
19
+ `
15
20
} ;
16
21
17
22
export const Prompt_ExtractJson = `你可以从 "对话记录" 中提取指定信息,并返回一个 JSON 对象,JSON 对象要求:
You can’t perform that action at this time.
0 commit comments