-
Notifications
You must be signed in to change notification settings - Fork 1
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 #31 from SkywardAI/aws-credentials
Invoke AWS Bedrock
- Loading branch information
Showing
15 changed files
with
321 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
"name": "Bohan Cheng", | ||
"email": "[email protected]" | ||
}, | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"main": "electron.js", | ||
"scripts": { | ||
"dev": "npm run start & npm run electron", | ||
|
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,52 @@ | ||
import { useEffect, useState } from "react"; | ||
import ScrollBarComponent from "./components/ScrollBarComponent"; | ||
import SettingSection from "./SettingSection"; | ||
import { getModelSettings, updateModelSettings } from "../../utils/general_settings"; | ||
|
||
export default function ModelSettings({ trigger }) { | ||
|
||
const [max_tokens, setMaxTokens] = useState(0); | ||
const [top_p, setTopP] = useState(0); | ||
const [temperature, setTemperature] = useState(0); | ||
|
||
function saveSettings() { | ||
updateModelSettings({ | ||
max_tokens, top_p, temperature | ||
}) | ||
} | ||
|
||
useEffect(()=>{ | ||
trigger && saveSettings(); | ||
// eslint-disable-next-line | ||
}, [trigger]) | ||
|
||
useEffect(()=>{ | ||
const model_settings = getModelSettings(); | ||
setMaxTokens(model_settings.max_tokens); | ||
setTopP(model_settings.top_p); | ||
setTemperature(model_settings.temperature); | ||
}, []) | ||
|
||
return ( | ||
<SettingSection title={'General Model Settings'}> | ||
<ScrollBarComponent | ||
title={'Set Max Tokens'} | ||
description={'The max tokens AI can generate'} | ||
value={max_tokens} cb={setMaxTokens} | ||
max={2048} min={32} | ||
/> | ||
<ScrollBarComponent | ||
title={'Set Top P'} | ||
description={'This can be considered the general accuracy of AI response'} | ||
value={top_p} cb={setTopP} | ||
max={1} min={0} times_10={true} | ||
/> | ||
<ScrollBarComponent | ||
title={'Set Temperature'} | ||
description={'The higher temperature, the more creative AI\'s response is.'} | ||
value={temperature} cb={setTemperature} | ||
max={1} min={0} times_10={true} | ||
/> | ||
</SettingSection> | ||
) | ||
} |
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,52 @@ | ||
import { useEffect, useState } from "react" | ||
|
||
export default function ScrollBarComponent({ cb, value, disabled, title, description, min, max, times_10, step }) { | ||
|
||
const [scrollValue, setScrollValue] = useState((times_10 ? 10 : 1) * value); | ||
const [textValue, setTextValue] = useState(value); | ||
|
||
function checkValue(v) { | ||
v = v || +textValue; | ||
return v <= max && v >= min; | ||
} | ||
|
||
function setValue(value, is_scroll = false) { | ||
if(is_scroll) { | ||
setTextValue(times_10 ? value / 10 : value); | ||
setScrollValue(value); | ||
} else { | ||
if(!isNaN(+value)) { | ||
setScrollValue(times_10 ? value * 10 : value); | ||
} | ||
setTextValue(value); | ||
} | ||
} | ||
|
||
useEffect(()=>{ | ||
!isNaN(+textValue) && checkValue() && cb(textValue); | ||
// eslint-disable-next-line | ||
}, [textValue]) | ||
|
||
useEffect(()=>{ | ||
setScrollValue((times_10 ? 10 : 1) * value) | ||
setTextValue(value); | ||
// eslint-disable-next-line | ||
}, [value]) | ||
|
||
|
||
return ( | ||
<div className="component"> | ||
<div className="title">{title}</div> | ||
{ description && <div className="description">{description}</div> } | ||
<div className="main-part scroll-group"> | ||
<input | ||
type="range" onChange={evt=>setValue(evt.target.value, true)} | ||
step={step || 1} value={scrollValue} | ||
min={(times_10 ? 10 : 1) * min} max={(times_10 ? 10 : 1) * max} | ||
disabled={disabled} | ||
/> | ||
<input type="text" value={textValue} onInput={evt=>setValue(evt.target.value, false)} /> | ||
</div> | ||
</div> | ||
) | ||
} |
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
Oops, something went wrong.