-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from SkywardAI/rag-implement
update according to new RAG APIs
- Loading branch information
Showing
6 changed files
with
73 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* create a normal setting section | ||
* @param { "text" | "select" } type What type this section should contains | ||
* @param {String} title Name of this secction, apperas on top | ||
* @param {Function} callback Callback function takes one parameter of updated value of this section | ||
* @returns { [HTMLElement, Function] } Returns an array where index 0 is the element of section and index 1 is the setter function | ||
*/ | ||
export default function normalSettigSection(type, title, callback, ...args) { | ||
const section = document.createElement('div'); | ||
section.className = 'setting-section' | ||
section.innerHTML = `<div class='title'>${title}</div>`; | ||
|
||
let input_like; | ||
if(type === 'text') { | ||
input_like = document.createElement('input'); | ||
input_like.type = 'text'; | ||
} else if(type === 'select') { | ||
input_like = document.createElement('select'); | ||
args[0].forEach(({value, title})=>{ | ||
const option = document.createElement('option'); | ||
option.textContent = title || value; | ||
input_like.appendChild(option); | ||
}) | ||
} | ||
|
||
function setter(value) { | ||
input_like.value = value; | ||
} | ||
|
||
input_like.onchange = () => { | ||
callback(input_like.value); | ||
} | ||
|
||
section.appendChild(input_like) | ||
|
||
return [section, setter]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters