mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
v4.6.9-alpha (#918)
Co-authored-by: Mufei <327958099@qq.com> Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
@@ -52,6 +52,7 @@ export const iconPaths = {
|
||||
'common/uploadFileFill': () => import('./icons/common/uploadFileFill.svg'),
|
||||
'common/viewLight': () => import('./icons/common/viewLight.svg'),
|
||||
'common/voiceLight': () => import('./icons/common/voiceLight.svg'),
|
||||
'common/wechatFill': () => import('./icons/common/wechatFill.svg'),
|
||||
copy: () => import('./icons/copy.svg'),
|
||||
'core/app/aiFill': () => import('./icons/core/app/aiFill.svg'),
|
||||
'core/app/aiLight': () => import('./icons/core/app/aiLight.svg'),
|
||||
@@ -144,6 +145,7 @@ export const iconPaths = {
|
||||
save: () => import('./icons/save.svg'),
|
||||
stop: () => import('./icons/stop.svg'),
|
||||
'support/account/loginoutLight': () => import('./icons/support/account/loginoutLight.svg'),
|
||||
'support/account/passwordLogin': () => import('./icons/support/account/passwordLogin.svg'),
|
||||
'support/account/plans': () => import('./icons/support/account/plans.svg'),
|
||||
'support/account/promotionLight': () => import('./icons/support/account/promotionLight.svg'),
|
||||
'support/bill/extraDatasetsize': () => import('./icons/support/bill/extraDatasetsize.svg'),
|
||||
|
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1708675975750" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4218" xmlns:xlink="http://www.w3.org/1999/xlink" width="200.1953125" height="200"><path d="M1024.16 694.816c0-149.92-143.104-271.392-319.584-271.392-176.576 0-319.68 121.504-319.68 271.392S528 966.208 704.576 966.208c55.456 0 107.648-12.096 153.184-33.248l125.984 54.528-14.592-140.544c34.784-43.392 55.04-95.808 55.04-152.128zM596.832 621.28c-25.152 0-45.472-20.352-45.472-45.472s20.32-45.472 45.472-45.472c25.12 0 45.44 20.384 45.44 45.472s-20.384 45.472-45.44 45.472z m215.392 0c-25.056 0-45.44-20.352-45.44-45.472s20.384-45.472 45.44-45.472c25.184 0 45.536 20.384 45.536 45.472s-20.352 45.472-45.536 45.472zM704.576 387.488c49.376 0 96.416 8.8 139.264 24.64 0.32-5.728 0.992-11.232 0.992-16.992 0-198.08-189.152-358.624-422.432-358.624C189.184 36.512 0.032 197.024 0.032 395.136c0 74.496 26.816 143.776 72.704 201.12L53.472 781.92l166.432-72.096c41.216 19.2 86.784 32.16 134.88 38.784-3.616-17.504-5.824-35.424-5.824-53.792 0.032-169.44 159.552-307.296 355.616-307.296z m-139.808-209.6c33.184 0 60 26.88 60 60 0 33.184-26.816 60.064-60 60.064s-60.032-26.88-60.032-60.064c0-33.152 26.88-60 60.032-60zM280.032 297.952c-33.184 0-60-26.88-60-60.064 0-33.152 26.848-60 60-60 33.184 0 60.032 26.88 60.032 60s-26.88 60.064-60.032 60.064z" fill="#51C332" p-id="4219"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg t="1709471698048" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4242"
|
||||
width="128" height="128">
|
||||
<path
|
||||
d="M855.158154 945.664H168.999385c-28.081231 0-50.845538-22.843077-50.845539-51.003077V486.833231C118.153846 458.673231 129.457231 433.230769 157.538462 433.230769h708.923076c28.081231 0 39.502769 25.442462 39.50277 53.602462v407.827692c0 28.16-22.764308 51.003077-50.806154 51.003077z m-340.913231-376.595692a99.761231 99.761231 0 0 0-99.603692 99.958154c0 40.251077 23.827692 74.712615 57.974154 90.54523V827.076923a39.384615 39.384615 0 0 0 78.76923 0v-65.417846a99.879385 99.879385 0 0 0 62.424616-92.632615 99.761231 99.761231 0 0 0-99.564308-99.958154z m0.551385-396.524308c-104.841846 0-189.794462 81.329231-197.159385 184.123077H217.718154C229.060923 201.334154 358.321231 78.769231 516.489846 78.769231s287.428923 122.564923 298.732308 277.897846h-103.266462c-7.364923-102.793846-92.317538-184.123077-197.159384-184.123077z"
|
||||
fill="#3B9BF8" p-id="4243"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
@@ -64,14 +64,17 @@ export default function Editor({
|
||||
|
||||
useEffect(() => {
|
||||
setKey(getNanoid(6));
|
||||
setFocus(false);
|
||||
}, [updateTrigger]);
|
||||
|
||||
const dropdownVariables = useMemo(
|
||||
() =>
|
||||
variables.filter((item) => {
|
||||
return item.key.includes(currentValue || '') && item.key !== currentValue;
|
||||
const key = item.key.toLowerCase();
|
||||
const current = currentValue?.toLowerCase();
|
||||
return key.includes(current || '') && item.key !== currentValue;
|
||||
}),
|
||||
[currentValue]
|
||||
[currentValue, variables]
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -115,7 +118,7 @@ export default function Editor({
|
||||
}}
|
||||
/>
|
||||
{hasVariablePlugin ? <VariablePickerPlugin variables={variables} /> : ''}
|
||||
{hasVariablePlugin ? <VariablePlugin variables={variables} /> : ''}
|
||||
<VariablePlugin variables={variables} />
|
||||
<OnBlurPlugin onBlur={onBlur} />
|
||||
<SingleLinePlugin />
|
||||
</LexicalComposer>
|
||||
|
@@ -21,6 +21,7 @@ type Props = Omit<BoxProps, 'resize' | 'onChange'> & {
|
||||
value?: string;
|
||||
onChange?: (e: string) => void;
|
||||
variables?: EditorVariablePickerType[];
|
||||
defaultHeight?: number;
|
||||
};
|
||||
|
||||
const options = {
|
||||
@@ -52,11 +53,12 @@ const JSONEditor = ({
|
||||
resize,
|
||||
variables = [],
|
||||
placeholder,
|
||||
defaultHeight = 100,
|
||||
...props
|
||||
}: Props) => {
|
||||
const { toast } = useToast();
|
||||
const { t } = useTranslation();
|
||||
const [height, setHeight] = useState(props.height || 100);
|
||||
const [height, setHeight] = useState(defaultHeight);
|
||||
const [placeholderDisplay, setPlaceholderDisplay] = useState('block');
|
||||
const initialY = useRef(0);
|
||||
const completionRegisterRef = useRef<any>();
|
||||
@@ -205,7 +207,15 @@ const JSONEditor = ({
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box position={'relative'}>
|
||||
<Box
|
||||
borderWidth={'1px'}
|
||||
borderRadius={'md'}
|
||||
borderColor={'myGray.200'}
|
||||
py={2}
|
||||
height={height}
|
||||
position={'relative'}
|
||||
{...props}
|
||||
>
|
||||
{resize && (
|
||||
<Box
|
||||
position={'absolute'}
|
||||
@@ -219,54 +229,43 @@ const JSONEditor = ({
|
||||
<MyIcon name={'common/editor/resizer'} width={'16px'} height={'16px'} />
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Editor
|
||||
height={'100%'}
|
||||
defaultLanguage="json"
|
||||
options={options as any}
|
||||
theme="JSONEditorTheme"
|
||||
beforeMount={beforeMount}
|
||||
defaultValue={defaultValue}
|
||||
value={value}
|
||||
onChange={(e) => {
|
||||
onChange?.(e || '');
|
||||
if (!e) {
|
||||
setPlaceholderDisplay('block');
|
||||
} else {
|
||||
setPlaceholderDisplay('none');
|
||||
}
|
||||
}}
|
||||
wrapperProps={{
|
||||
onBlur
|
||||
}}
|
||||
onMount={() => {
|
||||
if (!value) {
|
||||
setPlaceholderDisplay('block');
|
||||
} else {
|
||||
setPlaceholderDisplay('none');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Box
|
||||
borderWidth={'1px'}
|
||||
borderRadius={'md'}
|
||||
borderColor={'myGray.200'}
|
||||
py={2}
|
||||
height={'auto'}
|
||||
position={'relative'}
|
||||
{...props}
|
||||
className="monaco-placeholder"
|
||||
position={'absolute'}
|
||||
top={2}
|
||||
left={4}
|
||||
fontSize={'xs'}
|
||||
color={'myGray.500'}
|
||||
display={placeholderDisplay}
|
||||
>
|
||||
<Editor
|
||||
height={height}
|
||||
defaultLanguage="json"
|
||||
options={options as any}
|
||||
theme="JSONEditorTheme"
|
||||
beforeMount={beforeMount}
|
||||
defaultValue={defaultValue}
|
||||
value={value}
|
||||
onChange={(e) => {
|
||||
onChange?.(e || '');
|
||||
if (!e) {
|
||||
setPlaceholderDisplay('block');
|
||||
} else {
|
||||
setPlaceholderDisplay('none');
|
||||
}
|
||||
}}
|
||||
wrapperProps={{
|
||||
onBlur
|
||||
}}
|
||||
onMount={() => {
|
||||
if (!value) {
|
||||
setPlaceholderDisplay('block');
|
||||
} else {
|
||||
setPlaceholderDisplay('none');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Box
|
||||
className="monaco-placeholder"
|
||||
position={'absolute'}
|
||||
top={2}
|
||||
left={4}
|
||||
fontSize={'xs'}
|
||||
color={'myGray.500'}
|
||||
display={placeholderDisplay}
|
||||
>
|
||||
{placeholder}
|
||||
</Box>
|
||||
{placeholder}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
@@ -44,6 +44,9 @@ export default function DropDownMenu({
|
||||
position={'fixed'}
|
||||
w={'auto'}
|
||||
zIndex={99999}
|
||||
maxH={'300px'}
|
||||
overflow={'auto'}
|
||||
className="nowheel"
|
||||
>
|
||||
{variables.map((item, index) => (
|
||||
<Flex
|
||||
|
@@ -14,13 +14,13 @@
|
||||
"@fingerprintjs/fingerprintjs": "^4.2.1",
|
||||
"@monaco-editor/react": "^4.6.0",
|
||||
"mammoth": "^1.6.0",
|
||||
"i18next": "^22.5.1",
|
||||
"i18next": "23.10.0",
|
||||
"joplin-turndown-plugin-gfm": "^1.0.12",
|
||||
"next-i18next": "^13.3.0",
|
||||
"next-i18next": "15.2.0",
|
||||
"pdfjs-dist": "4.0.269",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-i18next": "^12.3.1",
|
||||
"react-i18next": "13.5.0",
|
||||
"turndown": "^7.1.2",
|
||||
"lexical": "0.12.6",
|
||||
"@lexical/react": "0.12.6",
|
||||
|
Reference in New Issue
Block a user