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
5e054007
Unverified
Commit
5e054007
authored
Aug 22, 2023
by
bowen
Committed by
GitHub
Aug 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: perfect type definition (#940)
parent
b346bd9b
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
97 additions
and
70 deletions
+97
-70
cardView.tsx
...yout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx
+2
-1
index.tsx
web/app/components/app/chat/answer/index.tsx
+1
-1
index.tsx
web/app/components/app/chat/index.tsx
+3
-3
input-type-icon.tsx
...mponents/app/configuration/config-var/input-type-icon.tsx
+10
-10
index.tsx
...ents/app/configuration/dataset-config/card-item/index.tsx
+2
-7
appCard.tsx
web/app/components/app/overview/appCard.tsx
+5
-4
index.tsx
web/app/components/app/overview/settings/index.tsx
+6
-2
index.tsx
web/app/components/app/text-generate/item/index.tsx
+2
-2
index.tsx
web/app/components/base/portal-to-follow-elem/index.tsx
+15
-15
index.tsx
web/app/components/base/radio/component/radio/index.tsx
+1
-1
index.tsx
web/app/components/datasets/settings/form/index.tsx
+2
-1
secret-key-modal.tsx
web/app/components/develop/secret-key/secret-key-modal.tsx
+1
-1
index.tsx
web/app/components/explore/app-list/index.tsx
+4
-2
index.tsx
web/app/components/explore/create-app-modal/index.tsx
+7
-3
index.tsx
...nents/explore/universal-chat/config-view/detail/index.tsx
+2
-1
index.tsx
...ents/explore/universal-chat/config-view/summary/index.tsx
+2
-1
index.tsx
web/app/components/explore/universal-chat/config/index.tsx
+3
-2
index.tsx
...ts/explore/universal-chat/config/plugins-config/index.tsx
+2
-1
Card.tsx
...nts/header/account-setting/model-page/model-item/Card.tsx
+2
-2
index.tsx
...eader/account-setting/model-page/model-selector/index.tsx
+14
-3
index.tsx
...p/components/header/account-setting/plugin-page/index.tsx
+1
-1
index.tsx
web/app/components/share/chat/index.tsx
+1
-1
content.tsx
web/app/components/share/text-generation/result/content.tsx
+1
-1
index.tsx
web/app/components/share/text-generation/result/index.tsx
+1
-1
normalForm.tsx
web/app/signin/normalForm.tsx
+7
-3
No files found.
web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView.tsx
View file @
5e054007
...
@@ -17,6 +17,7 @@ import type { App } from '@/types/app'
...
@@ -17,6 +17,7 @@ import type { App } from '@/types/app'
import
type
{
UpdateAppSiteCodeResponse
}
from
'@/models/app'
import
type
{
UpdateAppSiteCodeResponse
}
from
'@/models/app'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
NEED_REFRESH_APP_LIST_KEY
}
from
'@/config'
import
{
NEED_REFRESH_APP_LIST_KEY
}
from
'@/config'
import
type
{
IAppCardProps
}
from
'@/app/components/app/overview/appCard'
export
type
ICardViewProps
=
{
export
type
ICardViewProps
=
{
appId
:
string
appId
:
string
...
@@ -68,7 +69,7 @@ const CardView: FC<ICardViewProps> = ({ appId }) => {
...
@@ -68,7 +69,7 @@ const CardView: FC<ICardViewProps> = ({ appId }) => {
handleError
(
err
)
handleError
(
err
)
}
}
const
onSaveSiteConfig
=
async
(
params
:
any
)
=>
{
const
onSaveSiteConfig
:
IAppCardProps
[
'onSaveSiteConfig'
]
=
async
(
params
)
=>
{
const
[
err
]
=
await
asyncRunSafe
<
App
>
(
const
[
err
]
=
await
asyncRunSafe
<
App
>
(
updateAppSiteConfig
({
updateAppSiteConfig
({
url
:
`/apps/
${
appId
}
/site`
,
url
:
`/apps/
${
appId
}
/site`
,
...
...
web/app/components/app/chat/answer/index.tsx
View file @
5e054007
...
@@ -225,7 +225,7 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
...
@@ -225,7 +225,7 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
setLoading
(
true
)
setLoading
(
true
)
const
res
=
await
onSubmitAnnotation
?.(
id
,
inputValue
)
const
res
=
await
onSubmitAnnotation
?.(
id
,
inputValue
)
if
(
res
)
if
(
res
)
setAnnotation
({
...
annotation
,
content
:
inputValue
}
as
any
)
setAnnotation
({
...
annotation
,
content
:
inputValue
}
as
Annotation
)
setLoading
(
false
)
setLoading
(
false
)
setShowEdit
(
false
)
setShowEdit
(
false
)
}
}
>
{
t
(
'common.operation.confirm'
)
}
</
Button
>
}
}
>
{
t
(
'common.operation.confirm'
)
}
</
Button
>
...
...
web/app/components/app/chat/index.tsx
View file @
5e054007
...
@@ -81,7 +81,7 @@ const Chat: FC<IChatProps> = ({
...
@@ -81,7 +81,7 @@ const Chat: FC<IChatProps> = ({
const
isUseInputMethod
=
useRef
(
false
)
const
isUseInputMethod
=
useRef
(
false
)
const
[
query
,
setQuery
]
=
React
.
useState
(
''
)
const
[
query
,
setQuery
]
=
React
.
useState
(
''
)
const
handleContentChange
=
(
e
:
any
)
=>
{
const
handleContentChange
=
(
e
:
React
.
ChangeEvent
<
HTMLTextAreaElement
>
)
=>
{
const
value
=
e
.
target
.
value
const
value
=
e
.
target
.
value
setQuery
(
value
)
setQuery
(
value
)
}
}
...
@@ -111,7 +111,7 @@ const Chat: FC<IChatProps> = ({
...
@@ -111,7 +111,7 @@ const Chat: FC<IChatProps> = ({
setQuery
(
''
)
setQuery
(
''
)
}
}
const
handleKeyUp
=
(
e
:
any
)
=>
{
const
handleKeyUp
=
(
e
:
React
.
KeyboardEvent
<
HTMLTextAreaElement
>
)
=>
{
if
(
e
.
code
===
'Enter'
)
{
if
(
e
.
code
===
'Enter'
)
{
e
.
preventDefault
()
e
.
preventDefault
()
// prevent send message when using input method enter
// prevent send message when using input method enter
...
@@ -120,7 +120,7 @@ const Chat: FC<IChatProps> = ({
...
@@ -120,7 +120,7 @@ const Chat: FC<IChatProps> = ({
}
}
}
}
const
handleKeyDown
=
(
e
:
any
)
=>
{
const
handleKeyDown
=
(
e
:
React
.
KeyboardEvent
<
HTMLTextAreaElement
>
)
=>
{
isUseInputMethod
.
current
=
e
.
nativeEvent
.
isComposing
isUseInputMethod
.
current
=
e
.
nativeEvent
.
isComposing
if
(
e
.
code
===
'Enter'
&&
!
e
.
shiftKey
)
{
if
(
e
.
code
===
'Enter'
&&
!
e
.
shiftKey
)
{
setQuery
(
query
.
replace
(
/
\n
$/
,
''
))
setQuery
(
query
.
replace
(
/
\n
$/
,
''
))
...
...
web/app/components/app/configuration/config-var/input-type-icon.tsx
View file @
5e054007
'use client'
'use client'
import
React
,
{
FC
,
ReactNode
}
from
'react'
import
React
from
'react'
import
{
ReactElement
}
from
'react-markdown/lib/react-markdown
'
import
type
{
FC
}
from
'react
'
export
interface
IInputTypeIconProps
{
type
IInputTypeIconProps
=
{
type
:
string
type
:
'string'
|
'select'
}
}
const
IconMap
=
(
type
:
string
)
=>
{
const
IconMap
=
(
type
:
IInputTypeIconProps
[
'type'
]
)
=>
{
const
icons
:
Record
<
string
,
ReactNode
>
=
{
const
icons
=
{
'string'
:
(
string
:
(
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
fillRule=
"evenodd"
clipRule=
"evenodd"
d=
"M3.52593 0.166672H8.47411C8.94367 0.166665 9.33123 0.166659 9.64692 0.192452C9.97481 0.219242 10.2762 0.276738 10.5593 0.420991C10.9984 0.644695 11.3553 1.00165 11.579 1.44069C11.7233 1.72381 11.7808 2.02522 11.8076 2.35311C11.8334 2.6688 11.8334 3.05634 11.8334 3.5259V8.47411C11.8334 8.94367 11.8334 9.33121 11.8076 9.6469C11.7808 9.97479 11.7233 10.2762 11.579 10.5593C11.3553 10.9984 10.9984 11.3553 10.5593 11.579C10.2762 11.7233 9.97481 11.7808 9.64692 11.8076C9.33123 11.8334 8.94369 11.8333 8.47413 11.8333H3.52592C3.05636 11.8333 2.66882 11.8334 2.35312 11.8076C2.02523 11.7808 1.72382 11.7233 1.44071 11.579C1.00167 11.3553 0.644711 10.9984 0.421006 10.5593C0.276753 10.2762 0.219257 9.97479 0.192468 9.6469C0.166674 9.33121 0.16668 8.94366 0.166687 8.4741V3.52591C0.16668 3.05635 0.166674 2.6688 0.192468 2.35311C0.219257 2.02522 0.276753 1.72381 0.421006 1.44069C0.644711 1.00165 1.00167 0.644695 1.44071 0.420991C1.72382 0.276738 2.02523 0.219242 2.35312 0.192452C2.66882 0.166659 3.05637 0.166665 3.52593 0.166672ZM3.08335 3.08334C3.08335 2.76117 3.34452 2.50001 3.66669 2.50001H8.33335C8.65552 2.50001 8.91669 2.76117 8.91669 3.08334C8.91669 3.4055 8.65552 3.66667 8.33335 3.66667H6.58335V8.91667C6.58335 9.23884 6.32219 9.5 6.00002 9.5C5.67785 9.5 5.41669 9.23884 5.41669 8.91667V3.66667H3.66669C3.34452 3.66667 3.08335 3.4055 3.08335 3.08334Z"
fill=
"#98A2B3"
/>
<
path
fillRule=
"evenodd"
clipRule=
"evenodd"
d=
"M3.52593 0.166672H8.47411C8.94367 0.166665 9.33123 0.166659 9.64692 0.192452C9.97481 0.219242 10.2762 0.276738 10.5593 0.420991C10.9984 0.644695 11.3553 1.00165 11.579 1.44069C11.7233 1.72381 11.7808 2.02522 11.8076 2.35311C11.8334 2.6688 11.8334 3.05634 11.8334 3.5259V8.47411C11.8334 8.94367 11.8334 9.33121 11.8076 9.6469C11.7808 9.97479 11.7233 10.2762 11.579 10.5593C11.3553 10.9984 10.9984 11.3553 10.5593 11.579C10.2762 11.7233 9.97481 11.7808 9.64692 11.8076C9.33123 11.8334 8.94369 11.8333 8.47413 11.8333H3.52592C3.05636 11.8333 2.66882 11.8334 2.35312 11.8076C2.02523 11.7808 1.72382 11.7233 1.44071 11.579C1.00167 11.3553 0.644711 10.9984 0.421006 10.5593C0.276753 10.2762 0.219257 9.97479 0.192468 9.6469C0.166674 9.33121 0.16668 8.94366 0.166687 8.4741V3.52591C0.16668 3.05635 0.166674 2.6688 0.192468 2.35311C0.219257 2.02522 0.276753 1.72381 0.421006 1.44069C0.644711 1.00165 1.00167 0.644695 1.44071 0.420991C1.72382 0.276738 2.02523 0.219242 2.35312 0.192452C2.66882 0.166659 3.05637 0.166665 3.52593 0.166672ZM3.08335 3.08334C3.08335 2.76117 3.34452 2.50001 3.66669 2.50001H8.33335C8.65552 2.50001 8.91669 2.76117 8.91669 3.08334C8.91669 3.4055 8.65552 3.66667 8.33335 3.66667H6.58335V8.91667C6.58335 9.23884 6.32219 9.5 6.00002 9.5C5.67785 9.5 5.41669 9.23884 5.41669 8.91667V3.66667H3.66669C3.34452 3.66667 3.08335 3.4055 3.08335 3.08334Z"
fill=
"#98A2B3"
/>
</
svg
>
</
svg
>
),
),
'select'
:
(
select
:
(
<
svg
width=
"14"
height=
"14"
viewBox=
"0 0 14 14"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
svg
width=
"14"
height=
"14"
viewBox=
"0 0 14 14"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
fillRule=
"evenodd"
clipRule=
"evenodd"
d=
"M7.48913 4.08334H3.01083C2.70334 4.08333 2.43804 4.08333 2.21955 4.10118C1.98893 4.12002 1.75955 4.16162 1.53883 4.27408C1.20955 4.44186 0.941831 4.70958 0.774053 5.03886C0.66159 5.25958 0.619989 5.48896 0.601147 5.71958C0.583295 5.93807 0.583304 6.20334 0.583313 6.51084V10.9892C0.583304 11.2967 0.583295 11.5619 0.601147 11.7804C0.619989 12.0111 0.66159 12.2404 0.774053 12.4612C0.941831 12.7904 1.20955 13.0582 1.53883 13.2259C1.75955 13.3384 1.98893 13.38 2.21955 13.3988C2.43803 13.4167 2.70329 13.4167 3.01077 13.4167H7.48912C7.7966 13.4167 8.06193 13.4167 8.28041 13.3988C8.51103 13.38 8.74041 13.3384 8.96113 13.2259C9.29041 13.0582 9.55813 12.7904 9.72591 12.4612C9.83837 12.2404 9.87997 12.0111 9.89882 11.7804C9.91667 11.5619 9.91666 11.2967 9.91665 10.9892V6.51087C9.91666 6.20336 9.91667 5.93808 9.89882 5.71958C9.87997 5.48896 9.83837 5.25958 9.72591 5.03886C9.55813 4.70958 9.29041 4.44186 8.96113 4.27408C8.74041 4.16162 8.51103 4.12002 8.28041 4.10118C8.06192 4.08333 7.79663 4.08333 7.48913 4.08334ZM7.70413 7.70416C7.93193 7.47635 7.93193 7.107 7.70413 6.8792C7.47632 6.65139 7.10697 6.65139 6.87917 6.8792L4.66665 9.09172L3.91246 8.33753C3.68465 8.10973 3.31531 8.10973 3.0875 8.33753C2.8597 8.56534 2.8597 8.93468 3.0875 9.16249L4.25417 10.3292C4.48197 10.557 4.85132 10.557 5.07913 10.3292L7.70413 7.70416Z"
fill=
"#98A2B3"
/>
<
path
fillRule=
"evenodd"
clipRule=
"evenodd"
d=
"M7.48913 4.08334H3.01083C2.70334 4.08333 2.43804 4.08333 2.21955 4.10118C1.98893 4.12002 1.75955 4.16162 1.53883 4.27408C1.20955 4.44186 0.941831 4.70958 0.774053 5.03886C0.66159 5.25958 0.619989 5.48896 0.601147 5.71958C0.583295 5.93807 0.583304 6.20334 0.583313 6.51084V10.9892C0.583304 11.2967 0.583295 11.5619 0.601147 11.7804C0.619989 12.0111 0.66159 12.2404 0.774053 12.4612C0.941831 12.7904 1.20955 13.0582 1.53883 13.2259C1.75955 13.3384 1.98893 13.38 2.21955 13.3988C2.43803 13.4167 2.70329 13.4167 3.01077 13.4167H7.48912C7.7966 13.4167 8.06193 13.4167 8.28041 13.3988C8.51103 13.38 8.74041 13.3384 8.96113 13.2259C9.29041 13.0582 9.55813 12.7904 9.72591 12.4612C9.83837 12.2404 9.87997 12.0111 9.89882 11.7804C9.91667 11.5619 9.91666 11.2967 9.91665 10.9892V6.51087C9.91666 6.20336 9.91667 5.93808 9.89882 5.71958C9.87997 5.48896 9.83837 5.25958 9.72591 5.03886C9.55813 4.70958 9.29041 4.44186 8.96113 4.27408C8.74041 4.16162 8.51103 4.12002 8.28041 4.10118C8.06192 4.08333 7.79663 4.08333 7.48913 4.08334ZM7.70413 7.70416C7.93193 7.47635 7.93193 7.107 7.70413 6.8792C7.47632 6.65139 7.10697 6.65139 6.87917 6.8792L4.66665 9.09172L3.91246 8.33753C3.68465 8.10973 3.31531 8.10973 3.0875 8.33753C2.8597 8.56534 2.8597 8.93468 3.0875 9.16249L4.25417 10.3292C4.48197 10.557 4.85132 10.557 5.07913 10.3292L7.70413 7.70416Z"
fill=
"#98A2B3"
/>
<
path
d=
"M10.9891 0.583344H6.51083C6.20334 0.583334 5.93804 0.583326 5.71955 0.601177C5.48893 0.620019 5.25955 0.66162 5.03883 0.774084C4.70955 0.941862 4.44183 1.20958 4.27405 1.53886C4.16159 1.75958 4.11999 1.98896 4.10115 2.21958C4.08514 2.41545 4.08349 2.64892 4.08333 2.91669L7.51382 2.91668C7.79886 2.91662 8.10791 2.91654 8.37541 2.9384C8.67818 2.96314 9.07818 3.02436 9.49078 3.23459C10.0396 3.51422 10.4858 3.96041 10.7654 4.50922C10.9756 4.92182 11.0369 5.32182 11.0616 5.62459C11.0835 5.8921 11.0834 6.20115 11.0833 6.48619L11.0833 9.91666C11.3511 9.9165 11.5845 9.91485 11.7804 9.89885C12.011 9.88 12.2404 9.8384 12.4611 9.72594C12.7904 9.55816 13.0581 9.29045 13.2259 8.96116C13.3384 8.74044 13.38 8.51106 13.3988 8.28044C13.4167 8.06196 13.4167 7.7967 13.4166 7.48922V3.01087C13.4167 2.70339 13.4167 2.43807 13.3988 2.21958C13.38 1.98896 13.3384 1.75958 13.2259 1.53886C13.0581 1.20958 12.7904 0.941862 12.4611 0.774084C12.2404 0.66162 12.011 0.620019 11.7804 0.601177C11.5619 0.583326 11.2966 0.583334 10.9891 0.583344Z"
fill=
"#98A2B3"
/>
<
path
d=
"M10.9891 0.583344H6.51083C6.20334 0.583334 5.93804 0.583326 5.71955 0.601177C5.48893 0.620019 5.25955 0.66162 5.03883 0.774084C4.70955 0.941862 4.44183 1.20958 4.27405 1.53886C4.16159 1.75958 4.11999 1.98896 4.10115 2.21958C4.08514 2.41545 4.08349 2.64892 4.08333 2.91669L7.51382 2.91668C7.79886 2.91662 8.10791 2.91654 8.37541 2.9384C8.67818 2.96314 9.07818 3.02436 9.49078 3.23459C10.0396 3.51422 10.4858 3.96041 10.7654 4.50922C10.9756 4.92182 11.0369 5.32182 11.0616 5.62459C11.0835 5.8921 11.0834 6.20115 11.0833 6.48619L11.0833 9.91666C11.3511 9.9165 11.5845 9.91485 11.7804 9.89885C12.011 9.88 12.2404 9.8384 12.4611 9.72594C12.7904 9.55816 13.0581 9.29045 13.2259 8.96116C13.3384 8.74044 13.38 8.51106 13.3988 8.28044C13.4167 8.06196 13.4167 7.7967 13.4166 7.48922V3.01087C13.4167 2.70339 13.4167 2.43807 13.3988 2.21958C13.38 1.98896 13.3384 1.75958 13.2259 1.53886C13.0581 1.20958 12.7904 0.941862 12.4611 0.774084C12.2404 0.66162 12.011 0.620019 11.7804 0.601177C11.5619 0.583326 11.2966 0.583334 10.9891 0.583344Z"
fill=
"#98A2B3"
/>
...
@@ -21,11 +21,11 @@ const IconMap = (type: string) => {
...
@@ -21,11 +21,11 @@ const IconMap = (type: string) => {
),
),
}
}
return
icons
[
type
]
as
any
return
icons
[
type
]
}
}
const
InputTypeIcon
:
FC
<
IInputTypeIconProps
>
=
({
const
InputTypeIcon
:
FC
<
IInputTypeIconProps
>
=
({
type
type
,
})
=>
{
})
=>
{
const
Icon
=
IconMap
(
type
)
const
Icon
=
IconMap
(
type
)
return
Icon
return
Icon
...
...
web/app/components/app/configuration/dataset-config/card-item/index.tsx
View file @
5e054007
...
@@ -6,22 +6,17 @@ import { useTranslation } from 'react-i18next'
...
@@ -6,22 +6,17 @@ import { useTranslation } from 'react-i18next'
import
TypeIcon
from
'../type-icon'
import
TypeIcon
from
'../type-icon'
import
RemoveIcon
from
'../../base/icons/remove-icon'
import
RemoveIcon
from
'../../base/icons/remove-icon'
import
s
from
'./style.module.css'
import
s
from
'./style.module.css'
import
type
{
DataSet
}
from
'@/models/datasets'
import
{
formatNumber
}
from
'@/utils/format'
import
{
formatNumber
}
from
'@/utils/format'
import
Tooltip
from
'@/app/components/base/tooltip'
import
Tooltip
from
'@/app/components/base/tooltip'
export
type
ICardItemProps
=
{
export
type
ICardItemProps
=
{
className
?:
string
className
?:
string
config
:
any
config
:
DataSet
onRemove
:
(
id
:
string
)
=>
void
onRemove
:
(
id
:
string
)
=>
void
readonly
?:
boolean
readonly
?:
boolean
}
}
// const RemoveIcon = ({ className, onClick }: { className: string, onClick: () => void }) => (
// <svg className={className} onClick={onClick} width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
// <path d="M10 6H14M6 8H18M16.6667 8L16.1991 15.0129C16.129 16.065 16.0939 16.5911 15.8667 16.99C15.6666 17.3412 15.3648 17.6235 15.0011 17.7998C14.588 18 14.0607 18 13.0062 18H10.9938C9.93927 18 9.41202 18 8.99889 17.7998C8.63517 17.6235 8.33339 17.3412 8.13332 16.99C7.90607 16.5911 7.871 16.065 7.80086 15.0129L7.33333 8M10.6667 11V14.3333M13.3333 11V14.3333" stroke="#667085" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
// </svg>
// )
const
CardItem
:
FC
<
ICardItemProps
>
=
({
const
CardItem
:
FC
<
ICardItemProps
>
=
({
className
,
className
,
config
,
config
,
...
...
web/app/components/app/overview/appCard.tsx
View file @
5e054007
...
@@ -13,6 +13,7 @@ import SettingsModal from './settings'
...
@@ -13,6 +13,7 @@ import SettingsModal from './settings'
import
EmbeddedModal
from
'./embedded'
import
EmbeddedModal
from
'./embedded'
import
CustomizeModal
from
'./customize'
import
CustomizeModal
from
'./customize'
import
style
from
'./style.module.css'
import
style
from
'./style.module.css'
import
type
{
ConfigParams
}
from
'./settings'
import
Tooltip
from
'@/app/components/base/tooltip'
import
Tooltip
from
'@/app/components/base/tooltip'
import
AppBasic
from
'@/app/components/app-sidebar/basic'
import
AppBasic
from
'@/app/components/app-sidebar/basic'
import
{
asyncRunSafe
,
randomString
}
from
'@/utils'
import
{
asyncRunSafe
,
randomString
}
from
'@/utils'
...
@@ -31,9 +32,9 @@ export type IAppCardProps = {
...
@@ -31,9 +32,9 @@ export type IAppCardProps = {
appInfo
:
AppDetailResponse
appInfo
:
AppDetailResponse
cardType
?:
'api'
|
'webapp'
cardType
?:
'api'
|
'webapp'
customBgColor
?:
string
customBgColor
?:
string
onChangeStatus
:
(
val
:
boolean
)
=>
Promise
<
any
>
onChangeStatus
:
(
val
:
boolean
)
=>
Promise
<
void
>
onSaveSiteConfig
?:
(
params
:
any
)
=>
Promise
<
any
>
onSaveSiteConfig
?:
(
params
:
ConfigParams
)
=>
Promise
<
void
>
onGenerateCode
?:
()
=>
Promise
<
any
>
onGenerateCode
?:
()
=>
Promise
<
void
>
}
}
const
EmbedIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
=
''
})
=>
{
const
EmbedIcon
:
FC
<
{
className
?:
string
}
>
=
({
className
=
''
})
=>
{
...
@@ -193,7 +194,7 @@ function AppCard({
...
@@ -193,7 +194,7 @@ function AppCard({
</
div
>
</
div
>
<
div
className=
{
'pt-2 flex flex-row items-center'
}
>
<
div
className=
{
'pt-2 flex flex-row items-center'
}
>
{
!
isApp
&&
<
SecretKeyButton
className=
'flex-shrink-0 !h-8 bg-white mr-2'
textCls=
'!text-gray-700 font-medium'
iconCls=
'stroke-[1.2px]'
appId=
{
appInfo
.
id
}
/>
}
{
!
isApp
&&
<
SecretKeyButton
className=
'flex-shrink-0 !h-8 bg-white mr-2'
textCls=
'!text-gray-700 font-medium'
iconCls=
'stroke-[1.2px]'
appId=
{
appInfo
.
id
}
/>
}
{
OPERATIONS_MAP
[
cardType
].
map
((
op
:
any
)
=>
{
{
OPERATIONS_MAP
[
cardType
].
map
((
op
)
=>
{
const
disabled
const
disabled
=
op
.
opName
===
t
(
'appOverview.overview.appInfo.settings.entry'
)
=
op
.
opName
===
t
(
'appOverview.overview.appInfo.settings.entry'
)
?
false
?
false
...
...
web/app/components/app/overview/settings/index.tsx
View file @
5e054007
...
@@ -18,7 +18,7 @@ export type ISettingsModalProps = {
...
@@ -18,7 +18,7 @@ export type ISettingsModalProps = {
isShow
:
boolean
isShow
:
boolean
defaultValue
?:
string
defaultValue
?:
string
onClose
:
()
=>
void
onClose
:
()
=>
void
onSave
?:
(
params
:
ConfigParams
)
=>
Promise
<
any
>
onSave
?:
(
params
:
ConfigParams
)
=>
Promise
<
void
>
}
}
export
type
ConfigParams
=
{
export
type
ConfigParams
=
{
...
@@ -26,6 +26,10 @@ export type ConfigParams = {
...
@@ -26,6 +26,10 @@ export type ConfigParams = {
description
:
string
description
:
string
default_language
:
string
default_language
:
string
prompt_public
:
boolean
prompt_public
:
boolean
copyright
:
string
privacy_policy
:
string
icon
:
string
icon_background
:
string
}
}
const
LANGUAGE_MAP
:
Record
<
Language
,
string
>
=
{
const
LANGUAGE_MAP
:
Record
<
Language
,
string
>
=
{
...
@@ -82,7 +86,7 @@ const SettingsModal: FC<ISettingsModalProps> = ({
...
@@ -82,7 +86,7 @@ const SettingsModal: FC<ISettingsModalProps> = ({
}
}
const
onChange
=
(
field
:
string
)
=>
{
const
onChange
=
(
field
:
string
)
=>
{
return
(
e
:
any
)
=>
{
return
(
e
:
React
.
ChangeEvent
<
HTMLInputElement
|
HTMLTextAreaElement
>
)
=>
{
setInputInfo
(
item
=>
({
...
item
,
[
field
]:
e
.
target
.
value
}))
setInputInfo
(
item
=>
({
...
item
,
[
field
]:
e
.
target
.
value
}))
}
}
}
}
...
...
web/app/components/app/text-generate/item/index.tsx
View file @
5e054007
...
@@ -10,7 +10,7 @@ import { HashtagIcon } from '@heroicons/react/24/solid'
...
@@ -10,7 +10,7 @@ import { HashtagIcon } from '@heroicons/react/24/solid'
import
{
Markdown
}
from
'@/app/components/base/markdown'
import
{
Markdown
}
from
'@/app/components/base/markdown'
import
Loading
from
'@/app/components/base/loading'
import
Loading
from
'@/app/components/base/loading'
import
Toast
from
'@/app/components/base/toast'
import
Toast
from
'@/app/components/base/toast'
import
type
{
Feedbacktype
}
from
'@/app/components/app/chat'
import
type
{
Feedbacktype
}
from
'@/app/components/app/chat
/type
'
import
{
fetchMoreLikeThis
,
updateFeedback
}
from
'@/service/share'
import
{
fetchMoreLikeThis
,
updateFeedback
}
from
'@/service/share'
const
MAX_DEPTH
=
3
const
MAX_DEPTH
=
3
...
@@ -136,7 +136,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
...
@@ -136,7 +136,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
}
}
const
mainStyle
=
(()
=>
{
const
mainStyle
=
(()
=>
{
const
res
:
any
=
!
isTop
const
res
:
React
.
CSSProperties
=
!
isTop
?
{
?
{
background
:
depth
%
2
===
0
?
'linear-gradient(90.07deg, #F9FAFB 0.05%, rgba(249, 250, 251, 0) 99.93%)'
:
'#fff'
,
background
:
depth
%
2
===
0
?
'linear-gradient(90.07deg, #F9FAFB 0.05%, rgba(249, 250, 251, 0) 99.93%)'
:
'#fff'
,
}
}
...
...
web/app/components/base/portal-to-follow-elem/index.tsx
View file @
5e054007
'use client'
'use client'
import
{
useBoolean
}
from
'ahooks'
import
{
useBoolean
}
from
'ahooks'
import
React
,
{
FC
,
useEffect
,
useState
,
useRef
}
from
'react'
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
import
type
{
FC
}
from
'react'
import
{
createRoot
}
from
'react-dom/client'
import
{
createRoot
}
from
'react-dom/client'
export
interface
IPortalToFollowElementProps
{
type
IPortalToFollowElementProps
=
{
portalElem
:
React
.
ReactNode
portalElem
:
React
.
ReactNode
children
:
React
.
ReactNode
children
:
React
.
ReactNode
controlShow
?:
number
controlShow
?:
number
...
@@ -14,44 +15,42 @@ const PortalToFollowElement: FC<IPortalToFollowElementProps> = ({
...
@@ -14,44 +15,42 @@ const PortalToFollowElement: FC<IPortalToFollowElementProps> = ({
portalElem
,
portalElem
,
children
,
children
,
controlShow
,
controlShow
,
controlHide
controlHide
,
})
=>
{
})
=>
{
const
[
isShowContent
,
{
setTrue
:
showContent
,
setFalse
:
hideContent
,
toggle
:
toggleContent
}]
=
useBoolean
(
false
)
const
[
isShowContent
,
{
setTrue
:
showContent
,
setFalse
:
hideContent
,
toggle
:
toggleContent
}]
=
useBoolean
(
false
)
const
[
wrapElem
,
setWrapElem
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
const
[
wrapElem
,
setWrapElem
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
controlShow
)
{
if
(
controlShow
)
showContent
()
showContent
()
}
},
[
controlShow
])
},
[
controlShow
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
controlHide
)
{
if
(
controlHide
)
hideContent
()
hideContent
()
}
},
[
controlHide
])
},
[
controlHide
])
// todo use click outside hidden
// todo use click outside hidden
const
triggerElemRef
=
useRef
<
HTMLElement
>
(
null
)
const
triggerElemRef
=
useRef
<
HTML
Div
Element
>
(
null
)
const
calLoc
=
()
=>
{
const
calLoc
=
()
=>
{
const
triggerElem
=
triggerElemRef
.
current
const
triggerElem
=
triggerElemRef
.
current
if
(
!
triggerElem
)
{
if
(
!
triggerElem
)
{
return
{
return
{
display
:
'none'
display
:
'none'
,
}
}
}
}
const
{
const
{
left
:
triggerLeft
,
left
:
triggerLeft
,
top
:
triggerTop
,
top
:
triggerTop
,
height
height
,
}
=
triggerElem
.
getBoundingClientRect
()
;
}
=
triggerElem
.
getBoundingClientRect
()
return
{
return
{
position
:
'fixed'
,
position
:
'fixed'
,
left
:
triggerLeft
,
left
:
triggerLeft
,
top
:
triggerTop
+
height
,
top
:
triggerTop
+
height
,
zIndex
:
999
zIndex
:
999
,
}
}
}
}
...
@@ -63,19 +62,20 @@ const PortalToFollowElement: FC<IPortalToFollowElementProps> = ({
...
@@ -63,19 +62,20 @@ const PortalToFollowElement: FC<IPortalToFollowElementProps> = ({
root
.
render
(
root
.
render
(
<
div
style=
{
style
as
React
.
CSSProperties
}
>
<
div
style=
{
style
as
React
.
CSSProperties
}
>
{
portalElem
}
{
portalElem
}
</
div
>
</
div
>
,
)
)
document
.
body
.
appendChild
(
holder
)
document
.
body
.
appendChild
(
holder
)
setWrapElem
(
holder
)
setWrapElem
(
holder
)
console
.
log
(
holder
)
console
.
log
(
holder
)
}
else
{
}
else
{
wrapElem
?.
remove
?.()
wrapElem
?.
remove
?.()
setWrapElem
(
null
)
setWrapElem
(
null
)
}
}
},
[
isShowContent
])
},
[
isShowContent
])
return
(
return
(
<
div
ref=
{
triggerElemRef
as
any
}
onClick=
{
toggleContent
}
>
<
div
ref=
{
triggerElemRef
as
React
.
RefObject
<
HTMLDivElement
>
}
onClick=
{
toggleContent
}
>
{
children
}
{
children
}
</
div
>
</
div
>
)
)
...
...
web/app/components/base/radio/component/radio/index.tsx
View file @
5e054007
...
@@ -26,7 +26,7 @@ export default function Radio({
...
@@ -26,7 +26,7 @@ export default function Radio({
}:
IRadioProps
):
JSX
.
Element
{
}:
IRadioProps
):
JSX
.
Element
{
const
groupContext
=
useContext
(
RadioGroupContext
)
const
groupContext
=
useContext
(
RadioGroupContext
)
const
labelId
=
useId
()
const
labelId
=
useId
()
const
handleChange
=
(
e
:
any
)
=>
{
const
handleChange
=
(
e
:
IRadioProps
[
'value'
]
)
=>
{
if
(
disabled
)
if
(
disabled
)
return
return
...
...
web/app/components/datasets/settings/form/index.tsx
View file @
5e054007
'use client'
'use client'
import
{
useEffect
,
useState
}
from
'react'
import
{
useEffect
,
useState
}
from
'react'
import
type
{
Dispatch
}
from
'react'
import
useSWR
from
'swr'
import
useSWR
from
'swr'
import
{
useContext
}
from
'use-context-selector'
import
{
useContext
}
from
'use-context-selector'
import
{
BookOpenIcon
}
from
'@heroicons/react/24/outline'
import
{
BookOpenIcon
}
from
'@heroicons/react/24/outline'
...
@@ -24,7 +25,7 @@ const labelClass = `
...
@@ -24,7 +25,7 @@ const labelClass = `
const
inputClass
=
`
const
inputClass
=
`
w-[480px] px-3 bg-gray-100 text-sm text-gray-800 rounded-lg outline-none appearance-none
w-[480px] px-3 bg-gray-100 text-sm text-gray-800 rounded-lg outline-none appearance-none
`
`
const
useInitialValue
=
(
depend
:
any
,
dispatch
:
any
)
=>
{
const
useInitialValue
:
<
T
>
(
depend
:
T
,
dispatch
:
Dispatch
<
T
>
)
=>
void
=
(
depend
,
dispatch
)
=>
{
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
depend
)
dispatch
(
depend
)
},
[
depend
])
},
[
depend
])
...
...
web/app/components/develop/secret-key/secret-key-modal.tsx
View file @
5e054007
...
@@ -79,7 +79,7 @@ const SecretKeyModal = ({
...
@@ -79,7 +79,7 @@ const SecretKeyModal = ({
return
`
${
token
.
slice
(
0
,
3
)}
...
${
token
.
slice
(
-
20
)}
`
return
`
${
token
.
slice
(
0
,
3
)}
...
${
token
.
slice
(
-
20
)}
`
}
}
const
formatDate
=
(
timestamp
:
any
)
=>
{
const
formatDate
=
(
timestamp
:
string
)
=>
{
if
(
locale
===
'en'
)
if
(
locale
===
'en'
)
return
new
Intl
.
DateTimeFormat
(
'en-US'
,
{
year
:
'numeric'
,
month
:
'long'
,
day
:
'numeric'
}).
format
((
+
timestamp
)
*
1000
)
return
new
Intl
.
DateTimeFormat
(
'en-US'
,
{
year
:
'numeric'
,
month
:
'long'
,
day
:
'numeric'
}).
format
((
+
timestamp
)
*
1000
)
else
else
...
...
web/app/components/explore/app-list/index.tsx
View file @
5e054007
...
@@ -13,8 +13,10 @@ import AppCard from '@/app/components/explore/app-card'
...
@@ -13,8 +13,10 @@ import AppCard from '@/app/components/explore/app-card'
import
{
fetchAppDetail
,
fetchAppList
,
installApp
}
from
'@/service/explore'
import
{
fetchAppDetail
,
fetchAppList
,
installApp
}
from
'@/service/explore'
import
{
createApp
}
from
'@/service/apps'
import
{
createApp
}
from
'@/service/apps'
import
CreateAppModal
from
'@/app/components/explore/create-app-modal'
import
CreateAppModal
from
'@/app/components/explore/create-app-modal'
import
type
{
CreateAppModalProps
}
from
'@/app/components/explore/create-app-modal'
import
Loading
from
'@/app/components/base/loading'
import
Loading
from
'@/app/components/base/loading'
import
{
NEED_REFRESH_APP_LIST_KEY
}
from
'@/config'
import
{
NEED_REFRESH_APP_LIST_KEY
}
from
'@/config'
import
{
type
AppMode
}
from
'@/types/app'
const
Apps
:
FC
=
()
=>
{
const
Apps
:
FC
=
()
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
...
@@ -50,7 +52,7 @@ const Apps: FC = () => {
...
@@ -50,7 +52,7 @@ const Apps: FC = () => {
const
[
currApp
,
setCurrApp
]
=
React
.
useState
<
App
|
null
>
(
null
)
const
[
currApp
,
setCurrApp
]
=
React
.
useState
<
App
|
null
>
(
null
)
const
[
isShowCreateModal
,
setIsShowCreateModal
]
=
React
.
useState
(
false
)
const
[
isShowCreateModal
,
setIsShowCreateModal
]
=
React
.
useState
(
false
)
const
onCreate
=
async
({
name
,
icon
,
icon_background
}:
any
)
=>
{
const
onCreate
:
CreateAppModalProps
[
'onConfirm'
]
=
async
({
name
,
icon
,
icon_background
}
)
=>
{
const
{
app_model_config
:
model_config
}
=
await
fetchAppDetail
(
currApp
?.
app
.
id
as
string
)
const
{
app_model_config
:
model_config
}
=
await
fetchAppDetail
(
currApp
?.
app
.
id
as
string
)
try
{
try
{
...
@@ -58,7 +60,7 @@ const Apps: FC = () => {
...
@@ -58,7 +60,7 @@ const Apps: FC = () => {
name
,
name
,
icon
,
icon
,
icon_background
,
icon_background
,
mode
:
currApp
?.
app
.
mode
as
any
,
mode
:
currApp
?.
app
.
mode
as
AppMode
,
config
:
model_config
,
config
:
model_config
,
})
})
setIsShowCreateModal
(
false
)
setIsShowCreateModal
(
false
)
...
...
web/app/components/explore/create-app-modal/index.tsx
View file @
5e054007
...
@@ -9,10 +9,14 @@ import Toast from '@/app/components/base/toast'
...
@@ -9,10 +9,14 @@ import Toast from '@/app/components/base/toast'
import
AppIcon
from
'@/app/components/base/app-icon'
import
AppIcon
from
'@/app/components/base/app-icon'
import
EmojiPicker
from
'@/app/components/base/emoji-picker'
import
EmojiPicker
from
'@/app/components/base/emoji-picker'
type
I
Props
=
{
export
type
CreateAppModal
Props
=
{
appName
:
string
appName
:
string
show
:
boolean
show
:
boolean
onConfirm
:
(
info
:
any
)
=>
void
onConfirm
:
(
info
:
{
name
:
string
icon
:
string
icon_background
:
string
})
=>
Promise
<
void
>
onHide
:
()
=>
void
onHide
:
()
=>
void
}
}
...
@@ -21,7 +25,7 @@ const CreateAppModal = ({
...
@@ -21,7 +25,7 @@ const CreateAppModal = ({
show
=
false
,
show
=
false
,
onConfirm
,
onConfirm
,
onHide
,
onHide
,
}:
I
Props
)
=>
{
}:
CreateAppModal
Props
)
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
[
name
,
setName
]
=
React
.
useState
(
''
)
const
[
name
,
setName
]
=
React
.
useState
(
''
)
...
...
web/app/components/explore/universal-chat/config-view/detail/index.tsx
View file @
5e054007
...
@@ -6,12 +6,13 @@ import { useTranslation } from 'react-i18next'
...
@@ -6,12 +6,13 @@ import { useTranslation } from 'react-i18next'
import
s
from
'./style.module.css'
import
s
from
'./style.module.css'
import
Config
from
'@/app/components/explore/universal-chat/config'
import
Config
from
'@/app/components/explore/universal-chat/config'
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
type
{
DataSet
}
from
'@/models/datasets'
type
Props
=
{
type
Props
=
{
modelId
:
string
modelId
:
string
providerName
:
ProviderEnum
providerName
:
ProviderEnum
plugins
:
Record
<
string
,
boolean
>
plugins
:
Record
<
string
,
boolean
>
dataSets
:
any
[]
dataSets
:
DataSet
[]
}
}
const
ConfigViewPanel
:
FC
<
Props
>
=
({
const
ConfigViewPanel
:
FC
<
Props
>
=
({
modelId
,
modelId
,
...
...
web/app/components/explore/universal-chat/config-view/summary/index.tsx
View file @
5e054007
...
@@ -10,12 +10,13 @@ import ConfigDetail from '@/app/components/explore/universal-chat/config-view/de
...
@@ -10,12 +10,13 @@ import ConfigDetail from '@/app/components/explore/universal-chat/config-view/de
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
ModelName
from
'@/app/components/app/configuration/config-model/model-name'
import
ModelName
from
'@/app/components/app/configuration/config-model/model-name'
import
{
useProviderContext
}
from
'@/context/provider-context'
import
{
useProviderContext
}
from
'@/context/provider-context'
import
type
{
DataSet
}
from
'@/models/datasets'
export
type
ISummaryProps
=
{
export
type
ISummaryProps
=
{
modelId
:
string
modelId
:
string
providerName
:
ProviderEnum
providerName
:
ProviderEnum
plugins
:
Record
<
string
,
boolean
>
plugins
:
Record
<
string
,
boolean
>
dataSets
:
any
[]
dataSets
:
DataSet
[]
}
}
const
getColorInfo
=
(
modelId
:
string
)
=>
{
const
getColorInfo
=
(
modelId
:
string
)
=>
{
...
...
web/app/components/explore/universal-chat/config/index.tsx
View file @
5e054007
...
@@ -5,6 +5,7 @@ import ModelConfig from './model-config'
...
@@ -5,6 +5,7 @@ import ModelConfig from './model-config'
import
DataConfig
from
'./data-config'
import
DataConfig
from
'./data-config'
import
PluginConfig
from
'./plugins-config'
import
PluginConfig
from
'./plugins-config'
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
type
{
DataSet
}
from
'@/models/datasets'
export
type
IConfigProps
=
{
export
type
IConfigProps
=
{
className
?:
string
className
?:
string
...
@@ -14,8 +15,8 @@ export type IConfigProps = {
...
@@ -14,8 +15,8 @@ export type IConfigProps = {
onModelChange
?:
(
modelId
:
string
,
providerName
:
ProviderEnum
)
=>
void
onModelChange
?:
(
modelId
:
string
,
providerName
:
ProviderEnum
)
=>
void
plugins
:
Record
<
string
,
boolean
>
plugins
:
Record
<
string
,
boolean
>
onPluginChange
?:
(
key
:
string
,
value
:
boolean
)
=>
void
onPluginChange
?:
(
key
:
string
,
value
:
boolean
)
=>
void
dataSets
:
any
[]
dataSets
:
DataSet
[]
onDataSetsChange
?:
(
contexts
:
any
[])
=>
void
onDataSetsChange
?:
(
contexts
:
DataSet
[])
=>
void
}
}
const
Config
:
FC
<
IConfigProps
>
=
({
const
Config
:
FC
<
IConfigProps
>
=
({
...
...
web/app/components/explore/universal-chat/config/plugins-config/index.tsx
View file @
5e054007
...
@@ -19,7 +19,8 @@ const plugins = [
...
@@ -19,7 +19,8 @@ const plugins = [
{
key
:
'google_search'
,
icon
:
<
Google
/>
},
{
key
:
'google_search'
,
icon
:
<
Google
/>
},
{
key
:
'web_reader'
,
icon
:
<
WebReader
/>
},
{
key
:
'web_reader'
,
icon
:
<
WebReader
/>
},
{
key
:
'wikipedia'
,
icon
:
<
Wikipedia
/>
},
{
key
:
'wikipedia'
,
icon
:
<
Wikipedia
/>
},
]
]
as
const
const
Plugins
:
FC
<
IPluginsProps
>
=
({
const
Plugins
:
FC
<
IPluginsProps
>
=
({
readonly
,
readonly
,
config
,
config
,
...
...
web/app/components/header/account-setting/model-page/model-item/Card.tsx
View file @
5e054007
...
@@ -8,7 +8,7 @@ import Button from '@/app/components/base/button'
...
@@ -8,7 +8,7 @@ import Button from '@/app/components/base/button'
type
CardProps
=
{
type
CardProps
=
{
providerType
:
ProviderEnum
providerType
:
ProviderEnum
models
:
any
[]
models
:
Model
[]
onOpenModal
:
(
v
:
any
)
=>
void
onOpenModal
:
(
v
:
any
)
=>
void
onOperate
:
(
v
:
Record
<
string
,
any
>
)
=>
void
onOperate
:
(
v
:
Record
<
string
,
any
>
)
=>
void
}
}
...
@@ -33,7 +33,7 @@ const Card: FC<CardProps> = ({
...
@@ -33,7 +33,7 @@ const Card: FC<CardProps> = ({
return
(
return
(
<
div
className=
'px-3 pb-3'
>
<
div
className=
'px-3 pb-3'
>
{
{
models
.
map
(
(
model
:
Model
)
=>
(
models
.
map
(
model
=>
(
<
div
key=
{
`${model.model_name}-${model.model_type}`
}
className=
'flex mb-1 px-3 py-2 bg-white rounded-lg shadow-xs last:mb-0'
>
<
div
key=
{
`${model.model_name}-${model.model_type}`
}
className=
'flex mb-1 px-3 py-2 bg-white rounded-lg shadow-xs last:mb-0'
>
<
div
className=
'grow'
>
<
div
className=
'grow'
>
<
div
className=
'flex items-center mb-0.5 h-[18px] text-[13px] font-medium text-gray-700'
>
<
div
className=
'flex items-center mb-0.5 h-[18px] text-[13px] font-medium text-gray-700'
>
...
...
web/app/components/header/account-setting/model-page/model-selector/index.tsx
View file @
5e054007
...
@@ -15,6 +15,7 @@ import ModelIcon from '@/app/components/app/configuration/config-model/model-ico
...
@@ -15,6 +15,7 @@ import ModelIcon from '@/app/components/app/configuration/config-model/model-ico
import
ModelName
,
{
supportI18nModelName
}
from
'@/app/components/app/configuration/config-model/model-name'
import
ModelName
,
{
supportI18nModelName
}
from
'@/app/components/app/configuration/config-model/model-name'
import
ProviderName
from
'@/app/components/app/configuration/config-model/provider-name'
import
ProviderName
from
'@/app/components/app/configuration/config-model/provider-name'
import
{
useProviderContext
}
from
'@/context/provider-context'
import
{
useProviderContext
}
from
'@/context/provider-context'
type
Props
=
{
type
Props
=
{
value
:
{
value
:
{
providerName
:
ProviderEnum
providerName
:
ProviderEnum
...
@@ -28,6 +29,16 @@ type Props = {
...
@@ -28,6 +29,16 @@ type Props = {
triggerIconSmall
?:
boolean
triggerIconSmall
?:
boolean
}
}
type
ModelOption
=
{
type
:
'model'
value
:
string
providerName
:
ProviderEnum
modelDisplayName
:
string
}
|
{
type
:
'provider'
value
:
ProviderEnum
}
const
ModelSelector
:
FC
<
Props
>
=
({
const
ModelSelector
:
FC
<
Props
>
=
({
value
,
value
,
modelType
,
modelType
,
...
@@ -69,9 +80,9 @@ const ModelSelector: FC<Props> = ({
...
@@ -69,9 +80,9 @@ const ModelSelector: FC<Props> = ({
const
hasRemoved
=
value
&&
!
modelList
.
find
(({
model_name
})
=>
model_name
===
value
.
modelName
)
const
hasRemoved
=
value
&&
!
modelList
.
find
(({
model_name
})
=>
model_name
===
value
.
modelName
)
const
modelOptions
:
any
[]
=
(()
=>
{
const
modelOptions
:
ModelOption
[]
=
(()
=>
{
const
providers
=
_
.
uniq
(
filteredModelList
.
map
(
item
=>
item
.
model_provider
.
provider_name
))
const
providers
=
_
.
uniq
(
filteredModelList
.
map
(
item
=>
item
.
model_provider
.
provider_name
))
const
res
:
any
[]
=
[]
const
res
:
ModelOption
[]
=
[]
providers
.
forEach
((
providerName
)
=>
{
providers
.
forEach
((
providerName
)
=>
{
res
.
push
({
res
.
push
({
type
:
'provider'
,
type
:
'provider'
,
...
@@ -162,7 +173,7 @@ const ModelSelector: FC<Props> = ({
...
@@ -162,7 +173,7 @@ const ModelSelector: FC<Props> = ({
</
div
>
</
div
>
</
div
>
</
div
>
{
{
modelOptions
.
map
((
model
:
any
)
=>
{
modelOptions
.
map
((
model
)
=>
{
if
(
model
.
type
===
'provider'
)
{
if
(
model
.
type
===
'provider'
)
{
return
(
return
(
<
div
<
div
...
...
web/app/components/header/account-setting/plugin-page/index.tsx
View file @
5e054007
...
@@ -10,7 +10,7 @@ const PluginPage = () => {
...
@@ -10,7 +10,7 @@ const PluginPage = () => {
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
data
:
plugins
,
mutate
}
=
useSWR
(
'/workspaces/current/tool-providers'
,
fetchPluginProviders
)
const
{
data
:
plugins
,
mutate
}
=
useSWR
(
'/workspaces/current/tool-providers'
,
fetchPluginProviders
)
const
Plugin_MAP
:
Record
<
string
,
any
>
=
{
const
Plugin_MAP
:
Record
<
string
,
(
plugin
:
PluginProvider
)
=>
JSX
.
Element
>
=
{
serpapi
:
(
plugin
:
PluginProvider
)
=>
<
SerpapiPlugin
key=
'serpapi'
plugin=
{
plugin
}
onUpdate=
{
()
=>
mutate
()
}
/>,
serpapi
:
(
plugin
:
PluginProvider
)
=>
<
SerpapiPlugin
key=
'serpapi'
plugin=
{
plugin
}
onUpdate=
{
()
=>
mutate
()
}
/>,
}
}
...
...
web/app/components/share/chat/index.tsx
View file @
5e054007
...
@@ -30,7 +30,7 @@ import {
...
@@ -30,7 +30,7 @@ import {
}
from
'@/service/share'
}
from
'@/service/share'
import
type
{
ConversationItem
,
SiteInfo
}
from
'@/models/share'
import
type
{
ConversationItem
,
SiteInfo
}
from
'@/models/share'
import
type
{
PromptConfig
,
SuggestedQuestionsAfterAnswerConfig
}
from
'@/models/debug'
import
type
{
PromptConfig
,
SuggestedQuestionsAfterAnswerConfig
}
from
'@/models/debug'
import
type
{
Feedbacktype
,
IChatItem
}
from
'@/app/components/app/chat'
import
type
{
Feedbacktype
,
IChatItem
}
from
'@/app/components/app/chat
/type
'
import
Chat
from
'@/app/components/app/chat'
import
Chat
from
'@/app/components/app/chat'
import
{
changeLanguage
}
from
'@/i18n/i18next-config'
import
{
changeLanguage
}
from
'@/i18n/i18next-config'
import
useBreakpoints
,
{
MediaType
}
from
'@/hooks/use-breakpoints'
import
useBreakpoints
,
{
MediaType
}
from
'@/hooks/use-breakpoints'
...
...
web/app/components/share/text-generation/result/content.tsx
View file @
5e054007
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
React
from
'react'
import
Header
from
'./header'
import
Header
from
'./header'
import
type
{
Feedbacktype
}
from
'@/app/components/app/chat'
import
type
{
Feedbacktype
}
from
'@/app/components/app/chat
/type
'
import
{
format
}
from
'@/service/base'
import
{
format
}
from
'@/service/base'
export
type
IResultProps
=
{
export
type
IResultProps
=
{
...
...
web/app/components/share/text-generation/result/index.tsx
View file @
5e054007
...
@@ -8,7 +8,7 @@ import TextGenerationRes from '@/app/components/app/text-generate/item'
...
@@ -8,7 +8,7 @@ import TextGenerationRes from '@/app/components/app/text-generate/item'
import
NoData
from
'@/app/components/share/text-generation/no-data'
import
NoData
from
'@/app/components/share/text-generation/no-data'
import
Toast
from
'@/app/components/base/toast'
import
Toast
from
'@/app/components/base/toast'
import
{
sendCompletionMessage
,
updateFeedback
}
from
'@/service/share'
import
{
sendCompletionMessage
,
updateFeedback
}
from
'@/service/share'
import
type
{
Feedbacktype
}
from
'@/app/components/app/chat'
import
type
{
Feedbacktype
}
from
'@/app/components/app/chat
/type
'
import
Loading
from
'@/app/components/base/loading'
import
Loading
from
'@/app/components/base/loading'
import
type
{
PromptConfig
}
from
'@/models/debug'
import
type
{
PromptConfig
}
from
'@/models/debug'
import
type
{
InstalledApp
}
from
'@/models/explore'
import
type
{
InstalledApp
}
from
'@/models/explore'
...
...
web/app/signin/normalForm.tsx
View file @
5e054007
...
@@ -22,7 +22,11 @@ type IState = {
...
@@ -22,7 +22,11 @@ type IState = {
google
:
boolean
google
:
boolean
}
}
function
reducer
(
state
:
IState
,
action
:
{
type
:
string
;
payload
:
any
})
{
type
IAction
=
{
type
:
'login'
|
'login_failed'
|
'github_login'
|
'github_login_failed'
|
'google_login'
|
'google_login_failed'
}
function
reducer
(
state
:
IState
,
action
:
IAction
)
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
'login'
:
case
'login'
:
return
{
return
{
...
@@ -120,14 +124,14 @@ const NormalForm = () => {
...
@@ -120,14 +124,14 @@ const NormalForm = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
github_error
!==
undefined
)
if
(
github_error
!==
undefined
)
dispatch
({
type
:
'github_login_failed'
,
payload
:
null
})
dispatch
({
type
:
'github_login_failed'
})
if
(
github
)
if
(
github
)
window
.
location
.
href
=
github
.
redirect_url
window
.
location
.
href
=
github
.
redirect_url
},
[
github
,
github_error
])
},
[
github
,
github_error
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
google_error
!==
undefined
)
if
(
google_error
!==
undefined
)
dispatch
({
type
:
'google_login_failed'
,
payload
:
null
})
dispatch
({
type
:
'google_login_failed'
})
if
(
google
)
if
(
google
)
window
.
location
.
href
=
google
.
redirect_url
window
.
location
.
href
=
google
.
redirect_url
},
[
google
,
google
])
},
[
google
,
google
])
...
...
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