mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-12-14 11:51:30 +00:00
chore: updates from upstream
This commit is contained in:
@@ -106,4 +106,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4,10 +4,11 @@ import { useDropzone } from 'react-dropzone';
|
|||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { ActiveState } from '../models/misc';
|
import { ActiveState } from '../models/misc';
|
||||||
import { getDocs } from '../preferences/preferenceApi';
|
import { getDocs } from '../preferences/preferenceApi';
|
||||||
import { setSourceDocs } from '../preferences/preferenceSlice';
|
import { setSelectedDocs, setSourceDocs } from '../preferences/preferenceSlice';
|
||||||
import Dropdown from '../components/Dropdown';
|
import Dropdown from '../components/Dropdown';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
export default function Upload({
|
|
||||||
|
function Upload({
|
||||||
modalState,
|
modalState,
|
||||||
setModalState,
|
setModalState,
|
||||||
}: {
|
}: {
|
||||||
@@ -24,17 +25,6 @@ export default function Upload({
|
|||||||
search_queries: [''],
|
search_queries: [''],
|
||||||
number_posts: 10,
|
number_posts: 10,
|
||||||
});
|
});
|
||||||
const { t } = useTranslation();
|
|
||||||
const urlOptions: { label: string; value: string }[] = [
|
|
||||||
{ label: 'Crawler', value: 'crawler' },
|
|
||||||
// { label: 'Sitemap', value: 'sitemap' },
|
|
||||||
{ label: 'Link', value: 'url' },
|
|
||||||
{ label: 'Reddit', value: 'reddit' },
|
|
||||||
];
|
|
||||||
const [urlType, setUrlType] = useState<{ label: string; value: string }>({
|
|
||||||
label: 'Link',
|
|
||||||
value: 'url',
|
|
||||||
});
|
|
||||||
const [activeTab, setActiveTab] = useState<string>('file');
|
const [activeTab, setActiveTab] = useState<string>('file');
|
||||||
const [files, setfiles] = useState<File[]>([]);
|
const [files, setfiles] = useState<File[]>([]);
|
||||||
const [progress, setProgress] = useState<{
|
const [progress, setProgress] = useState<{
|
||||||
@@ -44,6 +34,20 @@ export default function Upload({
|
|||||||
failed?: boolean;
|
failed?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const urlOptions: { label: string; value: string }[] = [
|
||||||
|
{ label: 'Crawler', value: 'crawler' },
|
||||||
|
// { label: 'Sitemap', value: 'sitemap' },
|
||||||
|
{ label: 'Link', value: 'url' },
|
||||||
|
{ label: 'Reddit', value: 'reddit' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const [urlType, setUrlType] = useState<{ label: string; value: string }>({
|
||||||
|
label: 'Link',
|
||||||
|
value: 'url',
|
||||||
|
});
|
||||||
|
|
||||||
function Progress({
|
function Progress({
|
||||||
title,
|
title,
|
||||||
isCancellable = false,
|
isCancellable = false,
|
||||||
@@ -93,6 +97,7 @@ export default function Upload({
|
|||||||
|
|
||||||
function TrainingProgress() {
|
function TrainingProgress() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let timeoutID: number | undefined;
|
let timeoutID: number | undefined;
|
||||||
|
|
||||||
@@ -241,6 +246,7 @@ export default function Upload({
|
|||||||
['.docx'],
|
['.docx'],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const { name, value } = e.target;
|
const { name, value } = e.target;
|
||||||
if (name === 'search_queries' && value.length > 0) {
|
if (name === 'search_queries' && value.length > 0) {
|
||||||
@@ -254,7 +260,9 @@ export default function Upload({
|
|||||||
[name]: value,
|
[name]: value,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let view;
|
let view;
|
||||||
|
|
||||||
if (progress?.type === 'UPLOAD') {
|
if (progress?.type === 'UPLOAD') {
|
||||||
view = <UploadProgress></UploadProgress>;
|
view = <UploadProgress></UploadProgress>;
|
||||||
} else if (progress?.type === 'TRAINIING') {
|
} else if (progress?.type === 'TRAINIING') {
|
||||||
@@ -287,6 +295,7 @@ export default function Upload({
|
|||||||
{t('modals.uploadDoc.remote')}
|
{t('modals.uploadDoc.remote')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{activeTab === 'file' && (
|
{activeTab === 'file' && (
|
||||||
<>
|
<>
|
||||||
<input
|
<input
|
||||||
@@ -435,6 +444,7 @@ export default function Upload({
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="flex flex-row-reverse">
|
<div className="flex flex-row-reverse">
|
||||||
{activeTab === 'file' ? (
|
{activeTab === 'file' ? (
|
||||||
<button
|
<button
|
||||||
@@ -486,3 +496,5 @@ export default function Upload({
|
|||||||
</article>
|
</article>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Upload;
|
||||||
|
|||||||
Reference in New Issue
Block a user