Skip to content

Commit

Permalink
Merge pull request #1360 from TransformerOptimus/fixes_for_main_1
Browse files Browse the repository at this point in the history
fixes
  • Loading branch information
rounak610 authored Nov 8, 2023
2 parents 4afbd7c + 8e1d223 commit a613785
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions gui/pages/Content/Models/ModelForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default function ModelForm({internalId, getModels, sendModelData, env}){
<div>
{modelDropdown && <div className="custom_select_options w_100" ref={modelRef}>
{models.map((model, index) => (
<div key={index} className="custom_select_option" onClick={() => handleModelSelect(index)} style={{padding: '12px 14px', maxWidth: '100%'}}>
<div key={index} className="custom_select_option" onClick={() => {setModelStatus(null); handleModelSelect(index)}} style={{padding: '12px 14px', maxWidth: '100%'}}>
{model}
</div>))}
</div>}
Expand Down Expand Up @@ -186,14 +186,14 @@ export default function ModelForm({internalId, getModels, sendModelData, env}){
onChange={(event) => setModelTokenLimit(parseInt(event.target.value, 10))}/>
</div>

{modelStatus===false && <div className="horizontal_container align_start error_box mt_24 gap_6">
{selectedModel === 'Local LLM' && modelStatus===false && <div className="horizontal_container align_start error_box mt_24 gap_6">
<Image width={16} height={16} src="/images/icon_error.svg" alt="error-icon" />
<div className="vertical_containers">
<span className="text_12 color_white lh_16">Test model failed</span>
</div>
</div>}

{modelStatus===true && <div className="horizontal_container align_start success_box mt_24 gap_6">
{selectedModel === 'Local LLM' && modelStatus===true && <div className="horizontal_container align_start success_box mt_24 gap_6">
<Image width={16} height={16} src="/images/icon_info.svg"/>
<div className="vertical_containers">
<span className="text_12 color_white lh_16">Test model successful</span>
Expand Down
8 changes: 6 additions & 2 deletions superagi/controllers/models_controller.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException, Query, Body
from superagi.helper.auth import check_auth, get_user_organisation
from superagi.helper.models_helper import ModelsHelper
Expand Down Expand Up @@ -28,7 +29,7 @@ class StoreModelRequest(BaseModel):
token_limit: int
type: str
version: str
context_length: int
context_length: Optional[int]

class ModelName (BaseModel):
model: str
Expand Down Expand Up @@ -74,7 +75,10 @@ async def store_model(request: StoreModelRequest, organisation=Depends(get_user_
try:
#context_length = 4096
logger.info(request)
return Models.store_model_details(db.session, organisation.id, request.model_name, request.description, request.end_point, request.model_provider_id, request.token_limit, request.type, request.version, request.context_length)
if 'context_length' in request.dict():
return Models.store_model_details(db.session, organisation.id, request.model_name, request.description, request.end_point, request.model_provider_id, request.token_limit, request.type, request.version, request.context_length)
else:
return Models.store_model_details(db.session, organisation.id, request.model_name, request.description, request.end_point, request.model_provider_id, request.token_limit, request.type, request.version, 0)
except Exception as e:
logging.error(f"Error storing the Model Details: {str(e)}")
raise HTTPException(status_code=500, detail="Internal Server Error")
Expand Down
2 changes: 1 addition & 1 deletion superagi/models/models_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def storeGptModels(cls, session, organisation_id, model_provider_id, model_api_k
for model in models:
if model not in installed_models and model in default_models:
result = Models.store_model_details(session, organisation_id, model, model, '',
model_provider_id, default_models[model], 'Custom', '')
model_provider_id, default_models[model], 'Custom', '', 0)

@classmethod
def fetch_api_keys(cls, session, organisation_id):
Expand Down

0 comments on commit a613785

Please sign in to comment.