Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
23a584fa
Commit
23a584fa
authored
Jul 15, 2023
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: switch set max token tip
parent
8083df00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
index.tsx
web/app/components/app/configuration/config-model/index.tsx
+6
-3
common.en.ts
web/i18n/lang/common.en.ts
+1
-1
common.zh.ts
web/i18n/lang/common.zh.ts
+1
-1
No files found.
web/app/components/app/configuration/config-model/index.tsx
View file @
23a584fa
...
...
@@ -13,6 +13,7 @@ import { AppType, ProviderType } from '@/types/app'
import
{
TONE_LIST
}
from
'@/config'
import
Toast
from
'@/app/components/base/toast'
import
{
AlertTriangle
}
from
'@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
import
{
formatNumber
}
from
'@/utils/format'
export
type
IConifgModelProps
=
{
mode
:
string
...
...
@@ -72,6 +73,7 @@ const ConifgModel: FC<IConifgModelProps> = ({
const
[
isShowConfig
,
{
setFalse
:
hideConfig
,
toggle
:
toogleShowConfig
}]
=
useBoolean
(
false
)
const
[
maxTokenSettingTipVisible
,
setMaxTokenSettingTipVisible
]
=
useState
(
false
)
const
configContentRef
=
React
.
useRef
(
null
)
const
currModel
=
options
.
find
(
item
=>
item
.
id
===
modelId
)
useClickAway
(()
=>
{
hideConfig
()
},
configContentRef
)
...
...
@@ -134,14 +136,15 @@ const ConifgModel: FC<IConifgModelProps> = ({
onShowUseGPT4Confirm
()
return
}
if
(
id
!==
'gpt-4'
&&
completionParams
.
max_tokens
>
4000
)
{
const
nextSelectModelMaxToken
=
getMaxToken
(
id
)
if
(
completionParams
.
max_tokens
>
nextSelectModelMaxToken
)
{
Toast
.
notify
({
type
:
'warning'
,
message
:
t
(
'common.model.params.setToCurrentModelMaxTokenTip'
),
message
:
t
(
'common.model.params.setToCurrentModelMaxTokenTip'
,
{
maxToken
:
formatNumber
(
nextSelectModelMaxToken
)
}
),
})
onCompletionParamsChange
({
...
completionParams
,
max_tokens
:
4000
,
max_tokens
:
nextSelectModelMaxToken
,
})
}
setModelId
(
id
,
provider
)
...
...
web/i18n/lang/common.en.ts
View file @
23a584fa
...
...
@@ -54,7 +54,7 @@ const translation = {
maxTokenTip
:
'Max tokens depending on the model. Prompt and completion share this limit. One token is roughly 1 English character.'
,
maxTokenSettingTip
:
'Your max token setting is high, potentially limiting space for prompts, queries, and data. Consider setting it below 2/3.'
,
setToCurrentModelMaxTokenTip
:
'Max token is updated to the maximum token of the current model
4,000
.'
,
setToCurrentModelMaxTokenTip
:
'Max token is updated to the maximum token of the current model
{{maxToken}}
.'
,
},
tone
:
{
Creative
:
'Creative'
,
...
...
web/i18n/lang/common.zh.ts
View file @
23a584fa
...
...
@@ -54,7 +54,7 @@ const translation = {
maxTokenTip
:
'生成的最大令牌数取决于模型。提示和完成共享令牌数限制。一个令牌约等于 1 个英文或 半个中文字符。'
,
maxTokenSettingTip
:
'您设置的最大 tokens 数较大,可能会导致 prompt、用户问题、数据集内容没有 token 空间进行处理,建议设置到 2/3 以下。'
,
setToCurrentModelMaxTokenTip
:
'最大令牌数更新为当前模型最大的令牌数
4,000
。'
,
setToCurrentModelMaxTokenTip
:
'最大令牌数更新为当前模型最大的令牌数
{{maxToken}}
。'
,
},
tone
:
{
Creative
:
'创意'
,
...
...
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