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 #1353

Merged
merged 1 commit into from
Oct 31, 2023
Merged

fixes #1353

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
10 changes: 1 addition & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ def register_toolkit_for_master_organisation():
Organisation.id == marketplace_organisation_id).first()
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)
Expand All @@ -246,8 +239,7 @@ 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()
else:
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 @@
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)

Check warning on line 80 in superagi/controllers/user.py

View check run for this annotation

Codecov / codecov/patch

superagi/controllers/user.py#L80

Added line #L80 was not covered by tests

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 @@ -145,4 +145,12 @@
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()

Check warning on line 152 in superagi/models/models_config.py

View check run for this annotation

Codecov / codecov/patch

superagi/models/models_config.py#L152

Added line #L152 was not covered by tests
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()

Check warning on line 156 in superagi/models/models_config.py

View check run for this annotation

Codecov / codecov/patch

superagi/models/models_config.py#L154-L156

Added lines #L154 - L156 were not covered by tests
Loading