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
d4603058
authored
Apr 06, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 文案优化
parent
144bed5a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
9 deletions
+13
-9
src/constants/common.ts
+2
-2
src/pages/api/chat/chatGpt.ts
+1
-0
src/pages/api/chat/vectorGpt.ts
+1
-1
src/pages/model/detail/components/ModelDataCard.tsx
+2
-2
src/pages/model/detail/index.tsx
+1
-1
src/service/events/generateAbstract.ts
+2
-1
src/service/events/generateQA.ts
+3
-1
src/service/utils/tools.ts
+1
-1
No files found.
src/constants/common.ts
View file @
d4603058
...
...
@@ -60,9 +60,9 @@ export const chatProblem = `
`
;
export
const
versionIntro
=
`
## Fast GPT V2.3
* 数据集导出功能,可用于知识库分享。
## Fast GPT V2.4
* 优化文件拆分功能,可自定义提示词。
* 优化文件拆分和索引生成的速度。
* 定制知识库:创建模型时可以选择【知识库】模型, 可以手动导入知识点或者直接导入一个文件自动学习。
`
;
...
...
src/pages/api/chat/chatGpt.ts
View file @
d4603058
...
...
@@ -119,6 +119,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
try
{
const
json
=
JSON
.
parse
(
data
);
const
content
:
string
=
json
?.
choices
?.[
0
].
delta
.
content
||
''
;
// 空内容不要。首行换行符不要
if
(
!
content
||
(
responseContent
===
''
&&
content
===
'\n'
))
return
;
responseContent
+=
content
;
...
...
src/pages/api/chat/vectorGpt.ts
View file @
d4603058
...
...
@@ -110,7 +110,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
prompts
.
unshift
({
obj
:
'SYSTEM'
,
value
:
`
${
model
.
systemPrompt
}
知识库内容是最新的
,
知识库内容为: "
${
systemPrompt
}
"`
value
:
`
${
model
.
systemPrompt
}
知识库内容是最新的
,
知识库内容为: "
${
systemPrompt
}
"`
});
// 控制在 tokens 数量,防止超出
...
...
src/pages/model/detail/components/ModelDataCard.tsx
View file @
d4603058
...
...
@@ -148,8 +148,8 @@ const ModelDataCard = ({ model }: { model: ModelSchema }) => {
>
手动输入
</
MenuItem
>
<
MenuItem
onClick=
{
onOpenSelectFileModal
}
>
文件
导入
</
MenuItem
>
<
MenuItem
onClick=
{
onOpenSelectUrlModal
}
>
网站
地址导入
</
MenuItem
>
<
MenuItem
onClick=
{
onOpenSelectFileModal
}
>
文件
QA拆分
</
MenuItem
>
<
MenuItem
onClick=
{
onOpenSelectUrlModal
}
>
网站
内容QA拆分
</
MenuItem
>
<
MenuItem
onClick=
{
onOpenSelectJsonModal
}
>
JSON导入
</
MenuItem
>
</
MenuList
>
</
Menu
>
...
...
src/pages/model/detail/index.tsx
View file @
d4603058
...
...
@@ -37,7 +37,7 @@ const ModelDetail = ({ modelId }: { modelId: string }) => {
setLoading
(
true
);
try
{
const
res
=
await
getModelById
(
modelId
);
console
.
log
(
res
);
//
console.log(res);
res
.
security
.
expiredTime
/=
60
*
60
*
1000
;
setModel
(
res
);
formHooks
.
reset
(
res
);
...
...
src/service/events/generateAbstract.ts
View file @
d4603058
...
...
@@ -105,7 +105,8 @@ export async function generateAbstract(next = false): Promise<any> {
isPay
:
!
userApiKey
&&
splitContents
.
length
>
0
,
userId
:
dataItem
.
userId
,
type
:
'abstract'
,
text
:
systemPrompt
.
content
+
dataItem
.
text
+
rawContent
text
:
systemPrompt
.
content
+
dataItem
.
text
+
rawContent
,
tokenLen
:
0
});
}
catch
(
error
:
any
)
{
console
.
log
(
'error: 生成摘要错误'
,
dataItem
?.
_id
);
...
...
src/service/events/generateQA.ts
View file @
d4603058
...
...
@@ -79,8 +79,10 @@ export async function generateQA(next = false): Promise<any> {
.
createChatCompletion
(
{
model
:
ChatModelNameEnum
.
GPT35
,
temperature
:
0.
8
,
temperature
:
0.
7
,
n
:
1
,
frequency_penalty
:
1
,
// 越大,重复内容越少
presence_penalty
:
-
1
,
// 越大,越容易出现新内容
messages
:
[
systemPrompt
,
{
...
...
src/service/utils/tools.ts
View file @
d4603058
...
...
@@ -93,5 +93,5 @@ export const systemPromptFilter = (prompts: string[], maxTokens: number) => {
}
}
return
splitText
;
return
splitText
.
slice
(
0
,
splitText
.
length
-
1
)
;
};
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