adding values for undefined variables
+        key_name = "fixme"
+        user_id = "fixme"
pull/699/head
mike dupont 4 months ago
parent 2a86aaf88f
commit 2fbfcb8a82

@ -1,18 +1,27 @@
import os import os
import secrets import secrets
import sys # import sys
import traceback import traceback
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta from datetime import datetime, timedelta
from enum import Enum from enum import Enum
from pathlib import Path # from pathlib import Path
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
from uuid import UUID, uuid4 from uuid import UUID, uuid4
import hunter import hunter
import uvicorn import uvicorn
from dotenv import load_dotenv from dotenv import load_dotenv
from fastapi import BackgroundTasks, FastAPI, HTTPException, Query, status from fastapi import (
BackgroundTasks,
Depends,
FastAPI,
Header,
HTTPException,
Query,
Request,
status,
)
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from loguru import logger from loguru import logger
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
@ -22,7 +31,9 @@ from swarms.structs.agent import Agent
seen = {} seen = {}
kind = {} kind = {}
def foo(x):
def process_hunter_event(x):
# <Event kind='call' # <Event kind='call'
# function='<module>' # function='<module>'
# module='ray.experimental.channel' # module='ray.experimental.channel'
@ -42,17 +53,16 @@ def foo(x):
# print(x) # print(x)
pass pass
if m not in seen: if m not in seen:
print("MOD", m) print("MOD", m)
seen[m] = 1 seen[m] = 1
else: else:
seen[m] = seen[m]+11 seen[m] = seen[m]+11
hunter.trace( hunter.trace(
stdlib=False, stdlib=False,
action=foo action=process_hunter_event
) )
# print("starting") # print("starting")
@ -82,10 +92,12 @@ class APIKey(BaseModel):
class APIKeyCreate(BaseModel): class APIKeyCreate(BaseModel):
"Fixme"
name: str # A friendly name for the API key name: str # A friendly name for the API key
class User(BaseModel): class User(BaseModel):
"User "
id: UUID id: UUID
username: str username: str
is_active: bool = True is_active: bool = True
@ -246,6 +258,8 @@ class AgentStore:
api_key = secrets.token_urlsafe(API_KEY_LENGTH) api_key = secrets.token_urlsafe(API_KEY_LENGTH)
# Create the API key object # Create the API key object
key_name = "fixme"
user_id = "fixme"
key_object = APIKey( key_object = APIKey(
key=api_key, key=api_key,
name=key_name, name=key_name,
@ -330,11 +344,11 @@ class AgentStore:
logger.info(f"agent store: {self}") logger.info(f"agent store: {self}")
return agent_id return agent_id
except Exception as e: except Exception as exp:
logger.error(f"Error creating agent: {str(e)}") logger.error(f"Error creating agent: {str(exp)}")
raise HTTPException( raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=f"Failed to create agent: {str(e)}", detail=f"Failed to create agent: {str(exp)}",
) )
async def get_agent(self, agent_id: UUID) -> Agent: async def get_agent(self, agent_id: UUID) -> Agent:

Loading…
Cancel
Save