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
99f7e4f2
Unverified
Commit
99f7e4f2
authored
May 25, 2023
by
zxhlyh
Committed by
GitHub
May 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: provider token validate (#195)
parent
659c3e7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
index.tsx
...r/account-setting/provider-page/openai-provider/index.tsx
+0
-3
index.tsx
...der/account-setting/provider-page/provider-item/index.tsx
+3
-3
No files found.
web/app/components/header/account-setting/provider-page/openai-provider/index.tsx
View file @
99f7e4f2
...
@@ -65,9 +65,6 @@ const OpenaiProvider = ({
...
@@ -65,9 +65,6 @@ const OpenaiProvider = ({
if
(
validating
)
{
if
(
validating
)
{
return
<
ValidatingTip
/>
return
<
ValidatingTip
/>
}
}
if
(
validatedStatus
?.
status
===
ValidatedStatus
.
Success
)
{
return
<
ValidatedExceedOnOpenaiTip
/>
}
if
(
validatedStatus
?.
status
===
ValidatedStatus
.
Error
)
{
if
(
validatedStatus
?.
status
===
ValidatedStatus
.
Error
)
{
return
<
ValidatedErrorOnOpenaiTip
errorMessage=
{
validatedStatus
.
message
??
''
}
/>
return
<
ValidatedErrorOnOpenaiTip
errorMessage=
{
validatedStatus
.
message
??
''
}
/>
}
}
...
...
web/app/components/header/account-setting/provider-page/provider-item/index.tsx
View file @
99f7e4f2
...
@@ -8,7 +8,7 @@ import type { Provider, ProviderAzureToken } from '@/models/common'
...
@@ -8,7 +8,7 @@ import type { Provider, ProviderAzureToken } from '@/models/common'
import
{
ProviderName
}
from
'@/models/common'
import
{
ProviderName
}
from
'@/models/common'
import
OpenaiProvider
from
'../openai-provider'
import
OpenaiProvider
from
'../openai-provider'
import
AzureProvider
from
'../azure-provider'
import
AzureProvider
from
'../azure-provider'
import
{
ValidatedStatus
}
from
'../provider-input/useValidateToken'
import
{
ValidatedStatus
,
ValidatedStatusState
}
from
'../provider-input/useValidateToken'
import
{
updateProviderAIKey
}
from
'@/service/common'
import
{
updateProviderAIKey
}
from
'@/service/common'
import
{
ToastContext
}
from
'@/app/components/base/toast'
import
{
ToastContext
}
from
'@/app/components/base/toast'
...
@@ -29,7 +29,7 @@ const ProviderItem = ({
...
@@ -29,7 +29,7 @@ const ProviderItem = ({
onSave
onSave
}:
IProviderItemProps
)
=>
{
}:
IProviderItemProps
)
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
[
validatedStatus
,
setValidatedStatus
]
=
useState
<
ValidatedStatus
>
()
const
[
validatedStatus
,
setValidatedStatus
]
=
useState
<
ValidatedStatus
State
>
()
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
{
notify
}
=
useContext
(
ToastContext
)
const
{
notify
}
=
useContext
(
ToastContext
)
const
[
token
,
setToken
]
=
useState
<
ProviderAzureToken
|
string
>
(
const
[
token
,
setToken
]
=
useState
<
ProviderAzureToken
|
string
>
(
...
@@ -55,7 +55,7 @@ const ProviderItem = ({
...
@@ -55,7 +55,7 @@ const ProviderItem = ({
}
}
const
handleUpdateToken
=
async
()
=>
{
const
handleUpdateToken
=
async
()
=>
{
if
(
loading
)
return
if
(
loading
)
return
if
(
validatedStatus
===
ValidatedStatus
.
Success
)
{
if
(
validatedStatus
?.
status
===
ValidatedStatus
.
Success
)
{
try
{
try
{
setLoading
(
true
)
setLoading
(
true
)
await
updateProviderAIKey
({
url
:
`/workspaces/current/providers/
${
provider
.
provider_name
}
/token`
,
body
:
{
token
}
})
await
updateProviderAIKey
({
url
:
`/workspaces/current/providers/
${
provider
.
provider_name
}
/token`
,
body
:
{
token
}
})
...
...
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