Skip to content

Commit

Permalink
Merge branch 'main' into 2719-provider-vectordev
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored Dec 2, 2024
2 parents 87f7460 + f976451 commit 09a2cbe
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 12 deletions.
2 changes: 0 additions & 2 deletions docker/Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ ENV VIRTUAL_ENV="/venv"
ENV EE_PATH="ee"
COPY --from=builder /venv /venv
COPY --from=builder /app/examples /examples
# Build the providers cache
RUN keep provider build_cache
# as per Openshift guidelines, https://docs.openshift.com/container-platform/4.11/openshift_images/create-images.html#use-uid_create-images
RUN chgrp -R 0 /app && chmod -R g=u /app && \
chown -R keep:keep /app && \
Expand Down
8 changes: 4 additions & 4 deletions keep-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion keep-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"postcss-nested": "^6.0.1",
"postcss-selector-parser": "^6.0.12",
"postcss-value-parser": "^4.2.0",
"posthog-js": "^1.178.0",
"posthog-js": "^1.194.1",
"posthog-node": "^3.1.1",
"pusher-js": "^8.3.0",
"react": "^18.3.1",
Expand Down
14 changes: 10 additions & 4 deletions keep/api/models/db/ai_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from uuid import uuid4

from sqlalchemy import ForeignKey
from sqlalchemy import ForeignKey, Column, JSON, Text
from sqlmodel import Field, SQLModel
from pydantic import BaseModel, Json

Expand Down Expand Up @@ -58,9 +58,15 @@ class ExternalAIConfigAndMetadata(SQLModel, table=True):
id: str = Field(default_factory=lambda: str(uuid4()), primary_key=True)
algorithm_id: str = Field(nullable=False)
tenant_id: str = Field(ForeignKey("tenant.id"), nullable=False)
settings: str = Field(nullable=False)
settings_proposed_by_algorithm: str = Field(nullable=True)
feedback_logs: str = Field(nullable=True)
settings: str = Field(
nullable=False,
sa_column=Column(JSON),
)
settings_proposed_by_algorithm: str = Field(
nullable=True,
sa_column=Column(JSON),
)
feedback_logs: str = Field(nullable=True, sa_column=Column(Text))

@property
def algorithm(self) -> ExternalAI:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""New types for AI config
Revision ID: 3ad5308e7200
Revises: 3f056d747d9e
Create Date: 2024-12-01 16:40:12.655642
"""

import sqlalchemy as sa
import sqlalchemy_utils
import sqlmodel
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "3ad5308e7200"
down_revision = "3f056d747d9e"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###

with op.batch_alter_table("externalaiconfigandmetadata", schema=None) as batch_op:
batch_op.alter_column(
"settings", existing_type=sa.VARCHAR(), type_=sa.JSON(), nullable=True
)
batch_op.alter_column(
"settings_proposed_by_algorithm",
existing_type=sa.VARCHAR(),
type_=sa.JSON(),
existing_nullable=True,
)
batch_op.alter_column(
"feedback_logs",
existing_type=sa.VARCHAR(),
type_=sa.Text(),
existing_nullable=True,
)

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###

with op.batch_alter_table("externalaiconfigandmetadata", schema=None) as batch_op:
batch_op.alter_column(
"feedback_logs",
existing_type=sa.Text(),
type_=sa.VARCHAR(length=255),
existing_nullable=True,
)
batch_op.alter_column(
"settings_proposed_by_algorithm",
existing_type=sa.JSON(),
type_=sa.VARCHAR(length=255),
existing_nullable=True,
)
batch_op.alter_column(
"settings", existing_type=sa.JSON(), type_=sa.VARCHAR(length=255), nullable=False
)

# ### end Alembic commands ###
5 changes: 4 additions & 1 deletion keep/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ SCRIPT_DIR=$(dirname "$0")

python "$SCRIPT_DIR/server_jobs_bg.py" &

# Build the providers cache
keep provider build_cache

# Execute the CMD provided in the Dockerfile or as arguments
exec "$@"
exec "$@"

0 comments on commit 09a2cbe

Please sign in to comment.