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
bf45f08e
Unverified
Commit
bf45f08e
authored
Aug 15, 2023
by
Joel
Committed by
GitHub
Aug 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: handle provider name capitalization (#855)
parent
2c77a74c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
index.tsx
web/app/components/app/overview/apikey-info-panel/index.tsx
+8
-2
app-overview.zh.ts
web/i18n/lang/app-overview.zh.ts
+1
-1
No files found.
web/app/components/app/overview/apikey-info-panel/index.tsx
View file @
bf45f08e
...
@@ -3,6 +3,7 @@ import type { FC } from 'react'
...
@@ -3,6 +3,7 @@ import type { FC } from 'react'
import
React
,
{
useState
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
cn
from
'classnames'
import
cn
from
'classnames'
import
{
useContext
}
from
'use-context-selector'
import
Progress
from
'./progress'
import
Progress
from
'./progress'
import
Button
from
'@/app/components/base/button'
import
Button
from
'@/app/components/base/button'
import
{
LinkExternal02
,
XClose
}
from
'@/app/components/base/icons/src/vender/line/general'
import
{
LinkExternal02
,
XClose
}
from
'@/app/components/base/icons/src/vender/line/general'
...
@@ -10,9 +11,13 @@ import AccountSetting from '@/app/components/header/account-setting'
...
@@ -10,9 +11,13 @@ import AccountSetting from '@/app/components/header/account-setting'
import
{
IS_CE_EDITION
}
from
'@/config'
import
{
IS_CE_EDITION
}
from
'@/config'
import
{
useProviderContext
}
from
'@/context/provider-context'
import
{
useProviderContext
}
from
'@/context/provider-context'
import
{
formatNumber
}
from
'@/utils/format'
import
{
formatNumber
}
from
'@/utils/format'
import
I18n
from
'@/context/i18n'
import
ProviderConfig
from
'@/app/components/header/account-setting/model-page/configs'
const
APIKeyInfoPanel
:
FC
=
()
=>
{
const
APIKeyInfoPanel
:
FC
=
()
=>
{
const
isCloud
=
!
IS_CE_EDITION
const
isCloud
=
!
IS_CE_EDITION
const
{
locale
}
=
useContext
(
I18n
)
const
{
textGenerationModelList
}
=
useProviderContext
()
const
{
textGenerationModelList
}
=
useProviderContext
()
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
...
@@ -36,7 +41,8 @@ const APIKeyInfoPanel: FC = () => {
...
@@ -36,7 +41,8 @@ const APIKeyInfoPanel: FC = () => {
// first show in trail and not used exhausted, else find the exhausted
// first show in trail and not used exhausted, else find the exhausted
const
[
used
,
total
,
unit
,
providerName
]
=
(()
=>
{
const
[
used
,
total
,
unit
,
providerName
]
=
(()
=>
{
if
(
!
textGenerationModelList
||
!
isCloud
)
if
(
!
textGenerationModelList
||
!
isCloud
)
return
[
0
,
0
,
''
]
return
[
0
,
0
,
''
,
''
]
let
used
=
0
let
used
=
0
let
total
=
0
let
total
=
0
let
unit
=
'times'
let
unit
=
'times'
...
@@ -69,7 +75,7 @@ const APIKeyInfoPanel: FC = () => {
...
@@ -69,7 +75,7 @@ const APIKeyInfoPanel: FC = () => {
{
isCloud
&&
<
em
-
emoji
id=
{
exhausted
?
'🤔'
:
'😀'
}
/>
}
{
isCloud
&&
<
em
-
emoji
id=
{
exhausted
?
'🤔'
:
'😀'
}
/>
}
{
isCloud
{
isCloud
?
(
?
(
<
div
>
{
t
(
`appOverview.apiKeyInfo.cloud.${exhausted ? 'exhausted' : 'trial'}.title`
,
{
providerName
})
}
</
div
>
<
div
>
{
t
(
`appOverview.apiKeyInfo.cloud.${exhausted ? 'exhausted' : 'trial'}.title`
,
{
providerName
:
(
ProviderConfig
as
any
)[
providerName
as
string
]?.
selector
?.
name
[
locale
]
||
providerName
})
}
</
div
>
)
)
:
(
:
(
<
div
>
<
div
>
...
...
web/i18n/lang/app-overview.zh.ts
View file @
bf45f08e
...
@@ -8,7 +8,7 @@ const translation = {
...
@@ -8,7 +8,7 @@ const translation = {
apiKeyInfo
:
{
apiKeyInfo
:
{
cloud
:
{
cloud
:
{
trial
:
{
trial
:
{
title
:
'您正在使用 {{providerName}} 试用配额。'
,
title
:
'您正在使用 {{providerName}}
的
试用配额。'
,
description
:
'试用配额仅供您测试使用。 在试用配额用完之前,请自行设置模型提供商或购买额外配额。'
,
description
:
'试用配额仅供您测试使用。 在试用配额用完之前,请自行设置模型提供商或购买额外配额。'
,
},
},
exhausted
:
{
exhausted
:
{
...
...
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