CaffeinatedCoding commited on
Commit
766aa62
·
verified ·
1 Parent(s): 6b6a2d7

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. api/court_schemas.py +12 -5
  2. api/main.py +7 -3
api/court_schemas.py CHANGED
@@ -8,17 +8,24 @@ from typing import Optional, List, Dict, Any
8
 
9
  class NewSessionRequest(BaseModel):
10
  case_title: str
11
- user_side: str # petitioner | respondent
12
- user_client: str
13
- opposing_party: str
14
- legal_issues: List[str]
15
- brief_facts: str
 
16
  jurisdiction: str = "supreme_court"
17
  bench_composition: str = "division" # single | division | constitutional
 
18
  difficulty: str = "standard" # moot | standard | adversarial
19
  session_length: str = "standard" # brief | standard | extended
 
20
  show_trap_warnings: bool = True
21
 
 
 
 
 
22
 
23
  class ImportSessionRequest(BaseModel):
24
  research_session_id: str
 
8
 
9
  class NewSessionRequest(BaseModel):
10
  case_title: str
11
+ user_side: str = "petitioner" # petitioner | respondent
12
+ user_client: str = "Petitioner"
13
+ opposing_party: str = "Respondent"
14
+ legal_issues: List[str] = []
15
+ brief_facts: str = ""
16
+ case_facts: str = "" # alias for brief_facts if frontend sends this
17
  jurisdiction: str = "supreme_court"
18
  bench_composition: str = "division" # single | division | constitutional
19
+ bench_type: str = "division" # alias for bench_composition if frontend sends this
20
  difficulty: str = "standard" # moot | standard | adversarial
21
  session_length: str = "standard" # brief | standard | extended
22
+ max_rounds: int = 5 # optional max rounds
23
  show_trap_warnings: bool = True
24
 
25
+ class Config:
26
+ # Allow both snake_case and camelCase fields
27
+ populate_by_name = True
28
+
29
 
30
  class ImportSessionRequest(BaseModel):
31
  research_session_id: str
api/main.py CHANGED
@@ -300,13 +300,17 @@ def court_new_session(request: NewSessionRequest):
300
  from src.court.brief import generate_fresh_brief
301
  from src.court.registrar import build_round_announcement
302
 
 
 
 
 
303
  case_brief = generate_fresh_brief(
304
  case_title=request.case_title,
305
  user_side=request.user_side,
306
  user_client=request.user_client,
307
  opposing_party=request.opposing_party,
308
  legal_issues=request.legal_issues,
309
- brief_facts=request.brief_facts,
310
  jurisdiction=request.jurisdiction,
311
  )
312
 
@@ -316,9 +320,9 @@ def court_new_session(request: NewSessionRequest):
316
  user_client=request.user_client,
317
  opposing_party=request.opposing_party,
318
  legal_issues=request.legal_issues,
319
- brief_facts=request.brief_facts,
320
  jurisdiction=request.jurisdiction,
321
- bench_composition=request.bench_composition,
322
  difficulty=request.difficulty,
323
  session_length=request.session_length,
324
  show_trap_warnings=request.show_trap_warnings,
 
300
  from src.court.brief import generate_fresh_brief
301
  from src.court.registrar import build_round_announcement
302
 
303
+ # Handle field aliases (support both frontend field names and schema names)
304
+ brief_facts = request.brief_facts or request.case_facts or ""
305
+ bench_composition = request.bench_composition or request.bench_type or "division"
306
+
307
  case_brief = generate_fresh_brief(
308
  case_title=request.case_title,
309
  user_side=request.user_side,
310
  user_client=request.user_client,
311
  opposing_party=request.opposing_party,
312
  legal_issues=request.legal_issues,
313
+ brief_facts=brief_facts,
314
  jurisdiction=request.jurisdiction,
315
  )
316
 
 
320
  user_client=request.user_client,
321
  opposing_party=request.opposing_party,
322
  legal_issues=request.legal_issues,
323
+ brief_facts=brief_facts,
324
  jurisdiction=request.jurisdiction,
325
+ bench_composition=bench_composition,
326
  difficulty=request.difficulty,
327
  session_length=request.session_length,
328
  show_trap_warnings=request.show_trap_warnings,