Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1354

Merged
merged 1 commit into from
Oct 31, 2023
Merged

fixes #1354

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,6 @@ def register_toolkit_for_master_organisation():
if marketplace_organisation is not None:
register_marketplace_toolkits(session, marketplace_organisation)

def local_llm_model_config():
existing_models_config = session.query(ModelsConfig).filter(ModelsConfig.org_id == default_user.organisation_id, ModelsConfig.provider == 'Local LLM').first()
if existing_models_config is None:
models_config = ModelsConfig(org_id=default_user.organisation_id, provider='Local LLM', api_key="EMPTY")
session.add(models_config)
session.commit()

IterationWorkflowSeed.build_single_step_agent(session)
IterationWorkflowSeed.build_task_based_agents(session)
IterationWorkflowSeed.build_action_based_agents(session)
Expand All @@ -246,7 +239,6 @@ def local_llm_model_config():
# AgentWorkflowSeed.doc_search_and_code(session)
# AgentWorkflowSeed.build_research_email_workflow(session)
replace_old_iteration_workflows(session)
local_llm_model_config()

if env != "PROD":
register_toolkit_for_all_organisation()
Expand Down
6 changes: 6 additions & 0 deletions superagi/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from superagi.helper.auth import check_auth, get_current_user
from superagi.lib.logger import logger

from superagi.models.models_config import ModelsConfig

# from superagi.types.db import UserBase, UserIn, UserOut

router = APIRouter()
Expand Down Expand Up @@ -73,6 +75,10 @@ def create_user(user: UserIn,
organisation = Organisation.find_or_create_organisation(db.session, db_user)
Project.find_or_create_default_project(db.session, organisation.id)
logger.info("User created", db_user)

#adding local llm configuration
ModelsConfig.add_llm_config(db.session, organisation.id)

return db_user


Expand Down
10 changes: 9 additions & 1 deletion superagi/models/models_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,12 @@ def fetch_model_by_id_marketplace(cls, session, model_provider_id):
if model is None:
return {"error": "Model not found"}
else:
return {"provider": model.provider}
return {"provider": model.provider}

@classmethod
def add_llm_config(cls, session, organisation_id):
existing_models_config = session.query(ModelsConfig).filter(ModelsConfig.org_id == organisation_id, ModelsConfig.provider == 'Local LLM').first()
if existing_models_config is None:
models_config = ModelsConfig(org_id=organisation_id, provider='Local LLM', api_key="EMPTY")
session.add(models_config)
session.commit()