fix: worker un exit (#624)

This commit is contained in:
Archer
2023-12-18 20:35:17 +08:00
committed by GitHub
parent 703583fff7
commit b14a1db2f9
9 changed files with 58 additions and 130 deletions

View File

@@ -23,7 +23,7 @@ function MyLink(e: any) {
<Box as={'li'} mb={1}>
<Box
as={'span'}
color={'blue.500'}
color={'blue.700'}
textDecoration={'underline'}
cursor={'pointer'}
onClick={() => {

View File

@@ -44,7 +44,7 @@ const SideTabs = ({ list, size = 'md', activeId, onChange, ...props }: Props) =>
alignItems={'center'}
{...(activeId === item.id
? {
bg: ' blue.200 !important',
bg: ' blue.100 !important',
fontWeight: 'bold',
color: 'blue.600 ',
cursor: 'default'

View File

@@ -1,11 +1,5 @@
import React from 'react';
import {
SmoothStepEdge,
EdgeLabelRenderer,
EdgeProps,
getSmoothStepPath,
MarkerType
} from 'reactflow';
import { SmoothStepEdge, EdgeLabelRenderer, EdgeProps, getSmoothStepPath } from 'reactflow';
import { Flex } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';

View File

@@ -289,28 +289,30 @@ export const PreviewFileOrChunk = () => {
overflow={'overlay'}
px={[4, 8]}
my={4}
contentEditable
dangerouslySetInnerHTML={{ __html: previewFile.rawText }}
// contentEditable
// dangerouslySetInnerHTML={{ __html: previewFile.rawText }}
fontSize={'sm'}
whiteSpace={'pre-wrap'}
wordBreak={'break-all'}
onBlur={(e) => {
// @ts-ignore
const val = e.target.innerText;
setReShowRePreview(true);
// onBlur={(e) => {
// // @ts-ignore
// const val = e.target.innerText;
// setReShowRePreview(true);
setFiles((state) =>
state.map((file) =>
file.id === previewFile.id
? {
...file,
text: val
}
: file
)
);
}}
/>
// setFiles((state) =>
// state.map((file) =>
// file.id === previewFile.id
// ? {
// ...file,
// text: val
// }
// : file
// )
// );
// }}
>
{previewFile.rawText}
</Box>
</Box>
) : (
<Box pt={[3, 6]}>
@@ -365,49 +367,9 @@ export const PreviewFileOrChunk = () => {
}}
/>
</Flex>
<Box
px={4}
fontSize={'sm'}
whiteSpace={'pre-wrap'}
wordBreak={'break-all'}
contentEditable={!chunk.a}
dangerouslySetInnerHTML={{
__html: chunk.a ? `q:${chunk.q}\na:${chunk.a}` : chunk.q
}}
onBlur={(e) => {
// @ts-ignore
const val = e.target.innerText;
/* delete file */
if (val === '') {
setFiles((state) =>
state.map((stateFile) =>
stateFile.id === file.id
? {
...file,
chunks: [...file.chunks.slice(0, i), ...file.chunks.slice(i + 1)]
}
: stateFile
)
);
} else {
// update chunk
setFiles((stateFiles) =>
stateFiles.map((stateFile) =>
file.id === stateFile.id
? {
...stateFile,
chunks: stateFile.chunks.map((chunk, index) => ({
...chunk,
index: i === index ? val : chunk.q
}))
}
: stateFile
)
);
}
}}
/>
<Box px={4} fontSize={'sm'} whiteSpace={'pre-wrap'} wordBreak={'break-all'}>
{chunk.a ? `q:${chunk.q}\na:${chunk.a}` : chunk.q}
</Box>
</Box>
))
)}

View File

@@ -284,16 +284,16 @@ export const theme = extendTheme({
1000: '#121416'
},
blue: {
50: '#f0f7ff',
100: '#EBF7FD',
200: '#d6e8ff',
300: '#adceff',
400: '#85b1ff',
500: '#4e83fd',
600: '#3370ff',
700: '#2152d9',
800: '#1237b3',
900: '#07228c'
50: '#F0F4FF',
100: '#E1EAFF',
200: '#C5D7FF',
300: '#94B5FF',
400: '#5E8FFF',
500: '#487FFF',
600: '#3370FF',
700: '#2B5FD9',
800: '#2450B5',
900: '#1D4091'
},
myRead: {
600: '#ff4d4f'