diff --git a/components/chat-page/session-settings.js b/components/chat-page/session-settings.js index 8a6789b..12eb541 100644 --- a/components/chat-page/session-settings.js +++ b/components/chat-page/session-settings.js @@ -1,9 +1,8 @@ import useConversation from '../../global/useConversation.js'; import useUser from '../../global/useUser.js'; import showMessage from '../../tools/message.js'; -import request from '../../tools/request.js'; -import fileSettingSection from './file-setting-section.js'; -import textSettingSection from './text-setting-section.js'; +// import request from '../../tools/request.js'; +import normalSettingSection from './normal-setting-section.js'; let current_conversation = {}, session_settings, name_setter; @@ -34,7 +33,7 @@ export default function createSessionSettings(main) {
* Cannot change RAG settings after session started *
` - const [rename_elem, setName] = textSettingSection('Rename Session', new_name=>{ + const [rename_elem, setName] = normalSettingSection('text', 'Rename Session', new_name=>{ if(!new_name) { setName(current_conversation.name) } else if(new_name === current_conversation.name) { @@ -51,23 +50,11 @@ export default function createSessionSettings(main) { session_settings.appendChild(rename_elem); name_setter = setName; - const csv_upload_elem = fileSettingSection('Upload CSV file for RAG', async form=>{ - const form_data = new FormData(form); - const { http_error } = await request('/api/file', { - method: 'POST', - headers: { - 'Content-Type': 'multipart/form-data' - }, - body: form_data - }); - if(http_error) { - showMessage("File upload failed!", { type: "err" }); - } else { - showMessage("File upload success!", { type: "success" }); - } - }, ['csv']) - csv_upload_elem.classList.add('rag-option') - session_settings.appendChild(csv_upload_elem) + const [select_dataset_elem] = normalSettingSection('select', "Select Dataset For RAG", dataset_name=>{ + dataset_name && showMessage(`"${dataset_name}" Selected`) + }, [{value:'', title: '-- Please select a dataset --'}, {value: 'example/dataset1'}, {value: 'example/dataset2'}, {value: 'example/dataset3'}]) + select_dataset_elem.classList.add('rag-option') + session_settings.appendChild(select_dataset_elem) main.appendChild(session_settings); } \ No newline at end of file