Skip to content

Commit

Permalink
feat: cr
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl committed Nov 2, 2024
1 parent b488d26 commit 5ce3230
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
1 change: 1 addition & 0 deletions keep-ui/app/alerts/alert-create-incident-ai-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const CreateIncidentWithAIModal = ({

// If timeout error (which happens after 30s with NextJS), wait 10s and retry
// This handles cases where the request goes through the NextJS server which has a 30s timeout
// TODO: https://github.com/keephq/keep/issues/2374
if (!response.ok && response.status === 500) {
await new Promise((resolve) => setTimeout(resolve, 10000));
response = await fetch(`${apiUrl}/incidents/ai/suggest`, {
Expand Down
3 changes: 3 additions & 0 deletions keep/api/bl/ai_suggestion_bl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ def __init__(self, tenant_id: str, session: Session | None = None) -> None:
self.session = session if session else get_session_sync()

# Todo: interface it with any model
# https://github.com/keephq/keep/issues/2373
# Todo: per-tenant keys
# https://github.com/keephq/keep/issues/2365
# Todo: also goes with settings page
# https://github.com/keephq/keep/issues/2365
try:
self._client = OpenAI()
except OpenAIError as e:
Expand Down
28 changes: 0 additions & 28 deletions keep/api/models/db/ai_suggestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,3 @@ class AIFeedback(SQLModel, table=True):

class Config:
arbitrary_types_allowed = True


"""
SQL commands to create the tables in SQLite:
CREATE TABLE aisuggestion (
id TEXT PRIMARY KEY,
tenant_id TEXT,
user_id TEXT,
suggestion_input TEXT,
suggestion_input_hash TEXT,
suggestion_type TEXT,
suggestion_content TEXT,
model TEXT,
created_at TIMESTAMP
);
CREATE TABLE aifeedback (
id TEXT PRIMARY KEY,
suggestion_id TEXT,
user_id TEXT,
feedback_content TEXT,
rating INTEGER,
comment TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
FOREIGN KEY(suggestion_id) REFERENCES aisuggestion(id)
);
"""

0 comments on commit 5ce3230

Please sign in to comment.