diff --git a/docker-compose.yaml b/docker-compose.yaml
index 94044916b..926b8515c 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -43,7 +43,7 @@ services:
- redis_data:/data
super__postgres:
- image: "docker.io/library/postgres:latest"
+ image: "docker.io/library/postgres:15"
environment:
- POSTGRES_USER=superagi
- POSTGRES_PASSWORD=password
diff --git a/gui/pages/Content/Models/AddModel.js b/gui/pages/Content/Models/AddModel.js
index e596cb80c..0ef3d5497 100644
--- a/gui/pages/Content/Models/AddModel.js
+++ b/gui/pages/Content/Models/AddModel.js
@@ -1,14 +1,14 @@
import React, {useEffect, useState} from "react";
import ModelForm from "./ModelForm";
-export default function AddModel({internalId, getModels, sendModelData}){
+export default function AddModel({internalId, getModels, sendModelData, env}){
return(
diff --git a/gui/pages/Content/Models/ModelForm.js b/gui/pages/Content/Models/ModelForm.js
index d8b248c56..45794bf18 100644
--- a/gui/pages/Content/Models/ModelForm.js
+++ b/gui/pages/Content/Models/ModelForm.js
@@ -1,12 +1,12 @@
import React, {useEffect, useRef, useState} from "react";
import {removeTab, openNewTab, createInternalId, getUserClick} from "@/utils/utils";
import Image from "next/image";
-import {fetchApiKey, storeModel, verifyEndPoint} from "@/pages/api/DashboardService";
+import {fetchApiKey, storeModel, testModel, verifyEndPoint} from "@/pages/api/DashboardService";
import {BeatLoader, ClipLoader} from "react-spinners";
import {ToastContainer, toast} from 'react-toastify';
-export default function ModelForm({internalId, getModels, sendModelData}){
- const models = ['OpenAI', 'Replicate', 'Hugging Face', 'Google Palm'];
+export default function ModelForm({internalId, getModels, sendModelData, env}){
+ const models = env === 'DEV' ? ['OpenAI', 'Replicate', 'Hugging Face', 'Google Palm', 'Local LLM'] : ['OpenAI', 'Replicate', 'Hugging Face', 'Google Palm'];
const [selectedModel, setSelectedModel] = useState('Select a Model');
const [modelName, setModelName] = useState('');
const [modelDescription, setModelDescription] = useState('');
@@ -14,9 +14,12 @@ export default function ModelForm({internalId, getModels, sendModelData}){
const [modelEndpoint, setModelEndpoint] = useState('');
const [modelDropdown, setModelDropdown] = useState(false);
const [modelVersion, setModelVersion] = useState('');
+ const [modelContextLength, setContextLength] = useState(4096);
const [tokenError, setTokenError] = useState(false);
const [lockAddition, setLockAddition] = useState(true);
const [isLoading, setIsLoading] = useState(false)
+ const [modelStatus, setModelStatus] = useState(null);
+ const [createClickable, setCreateClickable] = useState(true);
const modelRef = useRef(null);
useEffect(() => {
@@ -79,13 +82,31 @@ export default function ModelForm({internalId, getModels, sendModelData}){
})
}
+ const handleModelStatus = async () => {
+ try {
+ setCreateClickable(false);
+ const response = await testModel();
+ if(response.status === 200) {
+ setModelStatus(true);
+ setCreateClickable(true);
+ } else {
+ setModelStatus(false);
+ setCreateClickable(true);
+ }
+ } catch(error) {
+ console.log("Error Message:: " + error);
+ setModelStatus(false);
+ setCreateClickable(true);
+ }
+ }
+
const handleModelSuccess = (model) => {
model.contentType = 'Model'
sendModelData(model)
}
const storeModelDetails = (modelProviderId) => {
- storeModel(modelName,modelDescription, modelEndpoint, modelProviderId, modelTokenLimit, "Custom", modelVersion).then((response) =>{
+ storeModel(modelName,modelDescription, modelEndpoint, modelProviderId, modelTokenLimit, "Custom", modelVersion, modelContextLength).then((response) =>{
setIsLoading(false)
let data = response.data
if (data.error) {
@@ -153,18 +174,42 @@ export default function ModelForm({internalId, getModels, sendModelData}){
onChange={(event) => setModelVersion(event.target.value)}/>
}
+ {(selectedModel === 'Local LLM') &&