chore: updates from upstream

pull/1001/head
utin-francis-peter 4 months ago
parent 45145685d5
commit 1cbaf9bd9d

@ -9,7 +9,7 @@
"tagline": "DocsGPT 使用 GenAI, 请使用来源审核关键信息.", "tagline": "DocsGPT 使用 GenAI, 请使用来源审核关键信息.",
"sourceDocs": "来源文档", "sourceDocs": "来源文档",
"none": "无", "none": "无",
"cancel":"取消", "cancel": "取消",
"demo": [ "demo": [
{ {
"header": "了解 DocsGPT", "header": "了解 DocsGPT",
@ -41,13 +41,13 @@
"deleteAllLabel": "删除所有对话", "deleteAllLabel": "删除所有对话",
"deleteAllBtn": "删除所有", "deleteAllBtn": "删除所有",
"addNew": "添加新的", "addNew": "添加新的",
"convHistory":"对话历史", "convHistory": "对话历史",
"none":"无", "none": "无",
"low":"低", "low": "低",
"medium":"中", "medium": "中",
"high":"高", "high": "高",
"unlimited":"无限", "unlimited": "无限",
"default":"默认" "default": "默认"
}, },
"documents": { "documents": {
"label": "文件", "label": "文件",
@ -105,5 +105,4 @@
"delete": "删除" "delete": "删除"
} }
} }
} }

@ -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,25 +25,28 @@ export default function Upload({
search_queries: [''], search_queries: [''],
number_posts: 10, number_posts: 10,
}); });
const [activeTab, setActiveTab] = useState<string>('file');
const [files, setfiles] = useState<File[]>([]);
const [progress, setProgress] = useState<{
type: 'UPLOAD' | 'TRAINIING';
percentage: number;
taskId?: string;
failed?: boolean;
}>();
const { t } = useTranslation(); const { t } = useTranslation();
const urlOptions: { label: string; value: string }[] = [ const urlOptions: { label: string; value: string }[] = [
{ label: 'Crawler', value: 'crawler' }, { label: 'Crawler', value: 'crawler' },
// { label: 'Sitemap', value: 'sitemap' }, // { label: 'Sitemap', value: 'sitemap' },
{ label: 'Link', value: 'url' }, { label: 'Link', value: 'url' },
{ label: 'Reddit', value: 'reddit' }, { label: 'Reddit', value: 'reddit' },
]; ];
const [urlType, setUrlType] = useState<{ label: string; value: string }>({ const [urlType, setUrlType] = useState<{ label: string; value: string }>({
label: 'Link', label: 'Link',
value: 'url', value: 'url',
}); });
const [activeTab, setActiveTab] = useState<string>('file');
const [files, setfiles] = useState<File[]>([]);
const [progress, setProgress] = useState<{
type: 'UPLOAD' | 'TRAINIING';
percentage: number;
taskId?: string;
failed?: boolean;
}>();
function Progress({ function Progress({
title, title,
@ -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;

Loading…
Cancel
Save