-
-
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 #40 from SkywardAI/function-improve
v0.1.6 bug fix & new setting page & input validation
- Loading branch information
Showing
23 changed files
with
538 additions
and
307 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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import useModelSettings from "../../global/useModelSettings.js"; | ||
import rangeSettingSection from "./range-setting-section.js"; | ||
|
||
let settings = {}; | ||
|
||
const { | ||
updateSettings:updateModelSettings, setToDefault | ||
} = useModelSettings(s=>settings = s); | ||
|
||
const fields = { | ||
temperature: { title: 'Temperature', valueRange: { min: 0, max: 2, is_100_times: true } }, | ||
top_k: { title: 'Top-K', valueRange: { min: 0, max: 40 } }, | ||
top_p: { title: 'Top-P', valueRange: { min: 0, max: 0.9, is_100_times: true } }, | ||
n_predict: { title: 'N-Predict', valueRange: { min: 128, max: 512 } } | ||
} | ||
|
||
export default function createModelSettings(main) { | ||
const model_settings = document.createElement('div'); | ||
|
||
model_settings.innerHTML = ` | ||
<div class='title'>Adjust Model Settings</div> | ||
<div class='sub-title'>Settings will be saved automatically</div> | ||
` | ||
|
||
for(const key in fields) { | ||
const { title, valueRange } = fields[key]; | ||
const [component, setter] = rangeSettingSection( | ||
title, valueRange, | ||
() => { setToDefault(key) && loadSettings() }, | ||
value=>updateModelSettings(key, value) | ||
) | ||
model_settings.appendChild(component); | ||
fields[key].setValue = setter; | ||
} | ||
|
||
main.appendChild(model_settings); | ||
loadSettings(); | ||
} | ||
|
||
function loadSettings() { | ||
for(const key in fields) { | ||
fields[key].setValue(settings[key]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
components/chat-page/settingSection.js → ...onents/chat-page/range-setting-section.js
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
Oops, something went wrong.