using openaicomp apikey
This commit is contained in:
parent
589c8fef5b
commit
e85ecc9e50
2 changed files with 4 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ import { OpenAIComp } from '../js/api/openai_comp.js';
|
|||
|
||||
let openai_comp_host = null;
|
||||
let openai_comp_model = '';
|
||||
let openai_comp_api_key = '';
|
||||
let openai_comp = null;
|
||||
let stopStreaming = false;
|
||||
|
||||
|
|
@ -34,7 +35,8 @@ self.onmessage = async function(event) {
|
|||
if (event.data.type === 'init') {
|
||||
openai_comp_host = event.data.openai_comp_host;
|
||||
openai_comp_model = event.data.openai_comp_model;
|
||||
openai_comp = new OpenAIComp(openai_comp_host, openai_comp_model, true);
|
||||
openai_comp_api_key = event.data.openai_comp_api_key;
|
||||
openai_comp = new OpenAIComp(openai_comp_host, openai_comp_model, openai_comp_api_key, true);
|
||||
} else if (event.data.type === 'chatMessage') {
|
||||
conversationHistory.push({ role: 'user', content: event.data.message });
|
||||
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ select_openai_comp_model.addEventListener("change", warn_OpenAIComp_HostEmpty);
|
|||
|
||||
document.getElementById('btnUpdateOpenAICompModels').addEventListener('click', async () => {
|
||||
document.getElementById('openai_comp_model_fetch_loading').style.display = 'inline';
|
||||
let openai_comp = new OpenAIComp(document.getElementById("openai_comp_host").value, true);
|
||||
let openai_comp = new OpenAIComp(document.getElementById("openai_comp_host").value , null, document.getElementById("openai_comp_api_key").value, true);
|
||||
openai_comp.fetchModels().then((data) => {
|
||||
if(!data.ok){
|
||||
let errorDetail = JSON.parse(data.error);
|
||||
|
|
|
|||
Loading…
Reference in a new issue