Session fixes: auth working, frontend files created, running locally

- Fixed circular imports in API files
- Created missing frontend lib files (api.ts, socket.ts, types.ts)
- Fixed register endpoint to return token instead of user
- Updated Anthropic client version
- Backend running locally on port 8000
- Frontend running on port 3000
- Authentication working
- Still need: channel response fix, WebSocket auth fix
This commit is contained in:
JA
2026-02-14 04:45:39 +00:00
parent 5e85965cd8
commit 6d6b1d0fbb
9 changed files with 18 additions and 12 deletions

View File

@@ -78,7 +78,7 @@ async def get_current_user(
return user
@router.post("/register", response_model=UserResponse)
@router.post("/register", response_model=Token)
async def register(user_data: UserRegister, db: Session = Depends(get_db)):
"""Register a new user"""
@@ -102,6 +102,10 @@ async def register(user_data: UserRegister, db: Session = Depends(get_db)):
db.commit()
db.refresh(user)
# Create access token
access_token = create_access_token(data={"sub": user.email})
return {"access_token": access_token, "token_type": "bearer"}
return user
@router.post("/login", response_model=Token)

View File

@@ -121,8 +121,8 @@ async def send_dm(
background_tasks: BackgroundTasks,
current_user: User = Depends(get_current_user),
db: Session = Depends(get_db),
context_manager: ContextManager = Depends(main.get_context_manager),
ai_client: AIClient = Depends(main.get_ai_client)
context_manager: ContextManager = Depends(lambda: main.context_manager),
ai_client: AIClient = Depends(lambda: main.ai_client)
):
"""Send a direct message"""

View File

@@ -20,7 +20,7 @@ from api.auth import get_current_user
router = APIRouter()
# File storage configuration
UPLOAD_DIR = os.getenv("UPLOAD_DIR", "./uploads")
UPLOAD_DIR = os.getenv("UPLOAD_DIR", "/tmp/uploads")
Path(UPLOAD_DIR).mkdir(parents=True, exist_ok=True)
class FileResponse(BaseModel):

View File

@@ -62,8 +62,8 @@ async def handle_grimlock_mention(
message: Message,
channel: Channel,
db: Session,
context_manager: ContextManager,
ai_client: AIClient
context_manager: ContextManager = Depends(lambda: main.context_manager),
ai_client: AIClient = Depends(lambda: main.ai_client)
):
"""Handle @grimlock mention - respond with AI"""
@@ -150,8 +150,8 @@ async def send_message(
background_tasks: BackgroundTasks,
current_user: User = Depends(get_current_user),
db: Session = Depends(get_db),
context_manager: ContextManager = Depends(main.get_context_manager),
ai_client: AIClient = Depends(main.get_ai_client)
context_manager: ContextManager = Depends(lambda: main.context_manager),
ai_client: AIClient = Depends(lambda: main.ai_client)
):
"""Send a message to a channel"""