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
90406fce
authored
Aug 07, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: default message
parent
89036f8a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
19 deletions
+29
-19
client/data/config.json
+6
-11
client/src/service/moduleDispatch/chat/oneapi.ts
+21
-8
client/src/types/model.d.ts
+2
-0
No files found.
client/data/config.json
View file @
90406fce
...
...
@@ -22,7 +22,8 @@
"contextMaxToken"
:
4000
,
"quoteMaxToken"
:
2000
,
"maxTemperature"
:
1.2
,
"price"
:
1.5
"price"
:
1.5
,
"defaultSystem"
:
""
},
{
"model"
:
"gpt-3.5-turbo-16k"
,
...
...
@@ -30,15 +31,8 @@
"contextMaxToken"
:
16000
,
"quoteMaxToken"
:
8000
,
"maxTemperature"
:
1.2
,
"price"
:
3
},
{
"model"
:
"ERNIE-Bot"
,
"name"
:
"文心一言"
,
"contextMaxToken"
:
3000
,
"quoteMaxToken"
:
1500
,
"maxTemperature"
:
1
,
"price"
:
1.2
"price"
:
3
,
"defaultSystem"
:
""
},
{
"model"
:
"gpt-4"
,
...
...
@@ -46,7 +40,8 @@
"contextMaxToken"
:
8000
,
"quoteMaxToken"
:
4000
,
"maxTemperature"
:
1.2
,
"price"
:
45
"price"
:
45
,
"defaultSystem"
:
""
}
],
"QAModels"
:
[
...
...
client/src/service/moduleDispatch/chat/oneapi.ts
View file @
90406fce
...
...
@@ -16,6 +16,7 @@ import { countModelPrice } from '@/service/events/pushBill';
import
{
ChatModelItemType
}
from
'@/types/model'
;
import
{
UserModelSchema
}
from
'@/types/mongoSchema'
;
import
{
textCensor
}
from
'@/service/api/plugins'
;
import
{
ChatCompletionRequestMessageRoleEnum
}
from
'openai'
;
export
type
ChatProps
=
{
res
:
NextApiResponse
;
...
...
@@ -66,13 +67,15 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
model
:
modelConstantsData
});
await
textCensor
({
text
:
`
${
systemPrompt
}
${
quotePrompt
}
${
limitPrompt
}
${
userChatInput
}
`
});
if
(
modelConstantsData
.
censor
)
{
await
textCensor
({
text
:
`
${
systemPrompt
}
${
quotePrompt
}
${
limitPrompt
}
${
userChatInput
}
`
});
}
const
{
messages
,
filterMessages
}
=
getChatMessages
({
model
:
modelConstantsData
,
...
...
@@ -98,7 +101,17 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
model
,
temperature
,
max_tokens
,
messages
,
messages
:
[
...(
modelConstantsData
.
defaultSystem
?
[
{
role
:
ChatCompletionRequestMessageRoleEnum
.
System
,
content
:
modelConstantsData
.
defaultSystem
}
]
:
[]),
...
messages
],
// frequency_penalty: 0.5, // 越大,重复内容越少
// presence_penalty: -0.5, // 越大,越容易出现新内容
stream
...
...
client/src/types/model.d.ts
View file @
90406fce
...
...
@@ -5,6 +5,8 @@ export type ChatModelItemType = {
quoteMaxToken
:
number
;
maxTemperature
:
number
;
price
:
number
;
censor
?:
boolean
;
defaultSystem
?:
string
;
};
export
type
QAModelItemType
=
{
model
:
string
;
...
...
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