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
9ab5cef5
authored
Jun 11, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: tag theme
parent
1ac3edcc
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
19 deletions
+88
-19
client/src/components/Tag/index.tsx
+47
-0
client/src/constants/theme.ts
+0
-1
client/src/pages/chat/components/PhoneSliderBar.tsx
+33
-12
client/src/pages/chat/index.tsx
+1
-1
client/src/pages/kb/components/Info.tsx
+3
-2
client/src/pages/kb/components/KbList.tsx
+4
-3
No files found.
client/src/components/Tag/index.tsx
0 → 100644
View file @
9ab5cef5
import
React
,
{
useMemo
}
from
'react'
;
import
{
Box
,
type
BoxProps
}
from
'@chakra-ui/react'
;
interface
Props
extends
BoxProps
{
children
:
string
;
colorSchema
?:
'blue'
|
'green'
|
'gray'
;
}
const
Tag
=
({
children
,
colorSchema
=
'blue'
,
...
props
}:
Props
)
=>
{
const
theme
=
useMemo
(()
=>
{
const
map
=
{
blue
:
{
borderColor
:
'myBlue.700'
,
bg
:
'#F2FBFF'
,
color
:
'myBlue.700'
},
green
:
{
borderColor
:
'#52C41A'
,
bg
:
'#EDFFED'
,
color
:
'#52C41A'
},
gray
:
{
borderColor
:
'#979797'
,
bg
:
'#F7F7F7'
,
color
:
'#979797'
}
};
return
map
[
colorSchema
];
},
[
colorSchema
]);
return
(
<
Box
as=
{
'span'
}
border=
{
'1px solid'
}
px=
{
2
}
lineHeight=
{
0
}
py=
{
'1px'
}
borderRadius=
{
'md'
}
fontSize=
{
'xs'
}
{
...
theme
}
{
...
props
}
>
{
children
}
</
Box
>
);
};
export
default
Tag
;
client/src/constants/theme.ts
View file @
9ab5cef5
...
@@ -220,7 +220,6 @@ export const theme = extendTheme({
...
@@ -220,7 +220,6 @@ export const theme = extendTheme({
900
:
'#1237b3'
,
900
:
'#1237b3'
,
1000
:
'#07228c'
1000
:
'#07228c'
},
},
myRead
:
{
myRead
:
{
600
:
'#ff4d4f'
600
:
'#ff4d4f'
}
}
...
...
client/src/pages/chat/components/PhoneSliderBar.tsx
View file @
9ab5cef5
import
React
,
{
useMemo
}
from
'react'
;
import
React
,
{
useMemo
,
useState
}
from
'react'
;
import
{
AddIcon
,
ChatIcon
}
from
'@chakra-ui/icons'
;
import
{
AddIcon
,
ChatIcon
}
from
'@chakra-ui/icons'
;
import
{
import
{
Box
,
Box
,
...
@@ -17,6 +17,12 @@ import WxConcat from '@/components/WxConcat';
...
@@ -17,6 +17,12 @@ import WxConcat from '@/components/WxConcat';
import
{
delChatHistoryById
}
from
'@/api/chat'
;
import
{
delChatHistoryById
}
from
'@/api/chat'
;
import
{
useChatStore
}
from
'@/store/chat'
;
import
{
useChatStore
}
from
'@/store/chat'
;
import
Avatar
from
'@/components/Avatar'
;
import
Avatar
from
'@/components/Avatar'
;
import
Tabs
from
'@/components/Tabs'
;
enum
TabEnum
{
app
=
'app'
,
history
=
'history'
}
const
PhoneSliderBar
=
({
const
PhoneSliderBar
=
({
chatId
,
chatId
,
...
@@ -28,7 +34,7 @@ const PhoneSliderBar = ({
...
@@ -28,7 +34,7 @@ const PhoneSliderBar = ({
onClose
:
()
=>
void
;
onClose
:
()
=>
void
;
})
=>
{
})
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
colorMode
,
toggleColorMode
}
=
useColorMode
(
);
const
[
currentTab
,
setCurrentTab
]
=
useState
(
TabEnum
.
app
);
const
{
myModels
,
myCollectionModels
,
loadMyModels
}
=
useUserStore
();
const
{
myModels
,
myCollectionModels
,
loadMyModels
}
=
useUserStore
();
const
{
isOpen
:
isOpenWx
,
onOpen
:
onOpenWx
,
onClose
:
onCloseWx
}
=
useDisclosure
();
const
{
isOpen
:
isOpenWx
,
onOpen
:
onOpenWx
,
onClose
:
onCloseWx
}
=
useDisclosure
();
...
@@ -73,23 +79,37 @@ const PhoneSliderBar = ({
...
@@ -73,23 +79,37 @@ const PhoneSliderBar = ({
backgroundColor=
{
useColorModeValue
(
'blackAlpha.800'
,
'blackAlpha.500'
)
}
backgroundColor=
{
useColorModeValue
(
'blackAlpha.800'
,
'blackAlpha.500'
)
}
color=
{
'white'
}
color=
{
'white'
}
>
>
<
Flex
alignItems=
{
'center'
}
justifyContent=
{
'space-between'
}
px=
{
3
}
>
<
Flex
mb=
{
2
}
alignItems=
{
'center'
}
justifyContent=
{
'space-between'
}
px=
{
2
}
>
<
Box
flex=
{
'0 0 50px'
}
>
AI应用
</
Box
>
<
Tabs
w=
{
'140px'
}
list=
{
[
{
label
:
'应用'
,
id
:
TabEnum
.
app
},
{
label
:
'历史记录'
,
id
:
TabEnum
.
history
}
]
}
size=
{
'sm'
}
activeId=
{
currentTab
}
onChange=
{
(
e
:
any
)
=>
setCurrentTab
(
e
)
}
/>
{
/* 新对话 */
}
{
/* 新对话 */
}
{
currentTab
===
TabEnum
.
app
&&
(
<
Button
<
Button
w=
{
'50%
'
}
size=
{
'sm
'
}
variant=
{
'base'
}
variant=
{
'base'
}
colorScheme=
{
'white'
}
color=
{
'white'
}
mb=
{
2
}
leftIcon=
{
<
AddIcon
/>
}
leftIcon=
{
<
AddIcon
/>
}
onClick=
{
()
=>
router
.
replace
(
`/chat?modelId=${modelId}`
)
}
onClick=
{
()
=>
{
router
.
replace
(
`/chat?modelId=${modelId}`
);
onClose
();
}
}
>
>
新对话
新对话
</
Button
>
</
Button
>
)
}
</
Flex
>
</
Flex
>
{
/* 我的模型 & 历史记录 折叠框*/
}
{
/* 我的模型 & 历史记录 折叠框*/
}
<
Box
flex=
{
'1 0 0'
}
px=
{
3
}
h=
{
0
}
overflowY=
{
'auto'
}
>
<
Box
flex=
{
'1 0 0'
}
px=
{
3
}
h=
{
0
}
overflowY=
{
'auto'
}
>
<
Box
>
{
currentTab
===
TabEnum
.
app
&&
(
<>
{
models
.
map
((
item
)
=>
(
{
models
.
map
((
item
)
=>
(
<
Flex
<
Flex
key=
{
item
.
_id
}
key=
{
item
.
_id
}
...
@@ -121,10 +141,10 @@ const PhoneSliderBar = ({
...
@@ -121,10 +141,10 @@ const PhoneSliderBar = ({
</
Box
>
</
Box
>
</
Flex
>
</
Flex
>
))
}
))
}
</
Box
>
</>
)
}
{
currentTab
===
TabEnum
.
history
&&
(
<>
<>
<
Box
py=
{
1
}
>
历史记录
</
Box
>
{
history
.
map
((
item
)
=>
(
{
history
.
map
((
item
)
=>
(
<
Flex
<
Flex
key=
{
item
.
_id
}
key=
{
item
.
_id
}
...
@@ -168,6 +188,7 @@ const PhoneSliderBar = ({
...
@@ -168,6 +188,7 @@ const PhoneSliderBar = ({
</
Flex
>
</
Flex
>
))
}
))
}
</>
</>
)
}
</
Box
>
</
Box
>
<
Divider
my=
{
3
}
colorScheme=
{
useColorModeValue
(
'gray'
,
'white'
)
}
/>
<
Divider
my=
{
3
}
colorScheme=
{
useColorModeValue
(
'gray'
,
'white'
)
}
/>
...
...
client/src/pages/chat/index.tsx
View file @
9ab5cef5
...
@@ -893,7 +893,7 @@ const Chat = ({ modelId, chatId }: { modelId: string; chatId: string }) => {
...
@@ -893,7 +893,7 @@ const Chat = ({ modelId, chatId }: { modelId: string; chatId: string }) => {
{!isPc && (
{!isPc && (
<Drawer isOpen={isOpenSlider} placement="
left
"
size
=
{
'xs'
}
onClose
=
{
onCloseSlider
}
>
<Drawer isOpen={isOpenSlider} placement="
left
"
size
=
{
'xs'
}
onClose
=
{
onCloseSlider
}
>
<
DrawerOverlay
backgroundColor=
{
'rgba(255,255,255,0.5)'
}
/>
<
DrawerOverlay
backgroundColor=
{
'rgba(255,255,255,0.5)'
}
/>
<
DrawerContent
maxW
idth=
{
'250px
'
}
>
<
DrawerContent
maxW
=
{
'70%
'
}
>
<
PhoneSliderBar
chatId=
{
chatId
}
modelId=
{
modelId
}
onClose=
{
onCloseSlider
}
/>
<
PhoneSliderBar
chatId=
{
chatId
}
modelId=
{
modelId
}
onClose=
{
onCloseSlider
}
/>
</
DrawerContent
>
</
DrawerContent
>
<
/
Drawer
>
<
/
Drawer
>
...
...
client/src/pages/kb/components/Info.tsx
View file @
9ab5cef5
...
@@ -7,7 +7,7 @@ import React, {
...
@@ -7,7 +7,7 @@ import React, {
ForwardedRef
ForwardedRef
}
from
'react'
;
}
from
'react'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
Box
,
Flex
,
Button
,
FormControl
,
IconButton
,
Tooltip
,
Input
,
Tag
}
from
'@chakra-ui/react'
;
import
{
Box
,
Flex
,
Button
,
FormControl
,
IconButton
,
Tooltip
,
Input
}
from
'@chakra-ui/react'
;
import
{
QuestionOutlineIcon
,
DeleteIcon
}
from
'@chakra-ui/icons'
;
import
{
QuestionOutlineIcon
,
DeleteIcon
}
from
'@chakra-ui/icons'
;
import
{
delKbById
,
putKbById
}
from
'@/api/plugins/kb'
;
import
{
delKbById
,
putKbById
}
from
'@/api/plugins/kb'
;
import
{
useSelectFile
}
from
'@/hooks/useSelectFile'
;
import
{
useSelectFile
}
from
'@/hooks/useSelectFile'
;
...
@@ -18,6 +18,7 @@ import { UseFormReturn } from 'react-hook-form';
...
@@ -18,6 +18,7 @@ import { UseFormReturn } from 'react-hook-form';
import
{
compressImg
}
from
'@/utils/file'
;
import
{
compressImg
}
from
'@/utils/file'
;
import
type
{
KbItemType
}
from
'@/types/plugin'
;
import
type
{
KbItemType
}
from
'@/types/plugin'
;
import
Avatar
from
'@/components/Avatar'
;
import
Avatar
from
'@/components/Avatar'
;
import
Tag
from
'@/components/Tag'
;
export
interface
ComponentRef
{
export
interface
ComponentRef
{
initInput
:
(
tags
:
string
)
=>
void
;
initInput
:
(
tags
:
string
)
=>
void
;
...
@@ -211,7 +212,7 @@ const Info = (
...
@@ -211,7 +212,7 @@ const Info = (
.split(' ')
.split(' ')
.filter((item) => item)
.filter((item) => item)
.map((item, i) => (
.map((item, i) => (
<Tag mr={2} mb={2} key={i}
variant={'base'} colorScheme={'blue'}
>
<Tag mr={2} mb={2} key={i}>
{item}
{item}
</Tag>
</Tag>
))}
))}
...
...
client/src/pages/kb/components/KbList.tsx
View file @
9ab5cef5
import
React
,
{
useCallback
,
useState
,
useMemo
}
from
'react'
;
import
React
,
{
useCallback
,
useState
,
useMemo
}
from
'react'
;
import
{
Box
,
Flex
,
useTheme
,
Input
,
IconButton
,
Tooltip
,
Tag
}
from
'@chakra-ui/react'
;
import
{
Box
,
Flex
,
useTheme
,
Input
,
IconButton
,
Tooltip
}
from
'@chakra-ui/react'
;
import
{
AddIcon
}
from
'@chakra-ui/icons'
;
import
{
AddIcon
}
from
'@chakra-ui/icons'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
postCreateKb
}
from
'@/api/plugins/kb'
;
import
{
postCreateKb
}
from
'@/api/plugins/kb'
;
...
@@ -9,6 +9,7 @@ import { useQuery } from '@tanstack/react-query';
...
@@ -9,6 +9,7 @@ import { useQuery } from '@tanstack/react-query';
import
{
useUserStore
}
from
'@/store/user'
;
import
{
useUserStore
}
from
'@/store/user'
;
import
MyIcon
from
'@/components/Icon'
;
import
MyIcon
from
'@/components/Icon'
;
import
Avatar
from
'@/components/Avatar'
;
import
Avatar
from
'@/components/Avatar'
;
import
Tag
from
'@/components/Tag'
;
const
KbList
=
({
kbId
}:
{
kbId
:
string
})
=>
{
const
KbList
=
({
kbId
}:
{
kbId
:
string
})
=>
{
const
theme
=
useTheme
();
const
theme
=
useTheme
();
...
@@ -118,12 +119,12 @@ const KbList = ({ kbId }: { kbId: string }) => {
...
@@ -118,12 +119,12 @@ const KbList = ({ kbId }: { kbId: string }) => {
{
item
.
name
}
{
item
.
name
}
</
Box
>
</
Box
>
{
/* tags */
}
{
/* tags */
}
<
Box
className=
"textEllipsis"
color=
{
'myGray.400'
}
mt=
{
1
}
fontSize=
{
'sm'
}
>
<
Box
className=
"textEllipsis"
color=
{
'myGray.400'
}
py=
{
1
}
>
{
!
item
.
tags
?
(
{
!
item
.
tags
?
(
<>
{
item
.
tags
||
'你还没设置标签~'
}
</>
<>
{
item
.
tags
||
'你还没设置标签~'
}
</>
)
:
(
)
:
(
item
.
tags
.
split
(
' '
).
map
((
item
,
i
)
=>
(
item
.
tags
.
split
(
' '
).
map
((
item
,
i
)
=>
(
<
Tag
key=
{
i
}
mr=
{
2
}
mb=
{
2
}
variant=
{
'base'
}
colorScheme=
{
'blue'
}
size=
{
'sm'
}
>
<
Tag
key=
{
i
}
mr=
{
2
}
mb=
{
2
}
>
{
item
}
{
item
}
</
Tag
>
</
Tag
>
))
))
...
...
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