437517ee by Administrator

Merge branch '31675_chatbotplus_llm' into 'master'

31675_chatbotplus_llm

See merge request !108
2 parents 4fa0b1d3 e45cfbc0
Pipeline #29156 for 437517ee passed in 16 seconds
......@@ -48,14 +48,14 @@ function App() {
return 0;
});
let model_list = [];
for( var i = 1; i < data.models.data.length; i++ ) {
for( var i = 0; i < data.models.data.length; i++ ) {
let model = data.models.data[i];
if( !(model.id === "whisper-1"
|| model.id === "gpt-4"
|| model.id === "gpt-4-0314"
|| model.id === "gpt-4-0613") ) model_list.push(model);
}
setModels(model_list)
setModels(model_list);
})
}
......@@ -104,7 +104,8 @@ function App() {
messages = JSON.stringify(chatLogTurboNew);
}
if(currentModel === "openchat_3.5" || currentModel === "zephyr-7B-beta") {
if(currentModel === "openchat_3.5" || currentModel === "zephyr-7B-beta"
|| currentModel === "meta-llama/Llama-3-8b-chat-hf" || currentModel === "google/gemma-7b-it") {
// "gpt-3.5-turbo"
let chatLogOpenSourceNew = [...chatLogOpenSource, { role: "user", content: chatInput }];
setChatLogOpenSource(chatLogOpenSourceNew);
......@@ -150,7 +151,7 @@ function App() {
});
userModifiedInput = "";
}
chatLogTurboNew.push({ role: "user", content: userModifiedInput });
chatLogTurboNew.push({ role: "assistant", content: parsedData });
......
......@@ -92,7 +92,9 @@ app.post('/api', async (req, res) => {
return;
}
if (currentModel == "openchat_3.5" || currentModel == "zephyr-7B-beta") {
if (currentModel == "openchat_3.5" || currentModel == "zephyr-7B-beta"
|| currentModel == "google/gemma-7b-it" || currentModel == "meta-llama/Llama-3-8b-chat-hf"
) {
runOpensource(req, res);
return;
......@@ -284,6 +286,7 @@ async function runOpensource(req, res) {
const endpoint_api_url = get_endpoint_api_url(currentModel);
const api_key = get_endpoint_api_key(currentModel);
const response = await axios.post(endpoint_api_url + '/chat/completions', {
model: currentModel,
messages: JSON.parse(message),
temperature
}, {
......@@ -465,7 +468,7 @@ async function validation (aiwp_app_id, req, res) {
app.get('/models', async (req, res) => {
const response = await openai.listModels();
const models = response.data;
const opensource_models = process.env.OPENSOURCE_MODELS ? process.env.OPENSOURCE_MODELS.split(',') : [];
const opensource_models = process.env.OPENSOURCE_MODELS ? JSON.parse(process.env.OPENSOURCE_MODELS) : [];
models.data = models.data.filter((model) => {
return model.id.indexOf('gpt-3') === 0
......@@ -473,7 +476,8 @@ app.get('/models', async (req, res) => {
opensource_models.forEach((model) => {
models.data.push({
id: model,
id: model.value,
label: model.label,
beta: true,
});
})
......@@ -491,7 +495,7 @@ app.get('/models', async (req, res) => {
} else if (model.id == 'dall-e-3') {
model.name = 'DALL-E 3';
} else {
model.name = model.id;
model.name = model.label ? model.label: model.id;
}
})
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!