GitHub Actions commited on
Commit
bc84d34
·
1 Parent(s): 5136e53

Deploy Emily Pantheon backend from GitHub Actions

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -151,17 +151,22 @@ def get_tarot_deck():
151
 
152
  @app.post("/tarot/read")
153
  def read_tarot(request: TarotRequest):
154
- lang = normalize_lang(request.lang)
155
- system = get_dynamic_persona(lang, "tarot")
156
- cards_text = ", ".join(request.cards)
157
- user = (
158
- f"Topic: {request.topic}\n"
159
- f"Selected cards: {cards_text}\n"
160
- f"Question: {request.query}\n\n"
161
- f"Give a tarot reading as Emily. Interpret each card for this topic and weave them together."
162
- )
163
- result = _call_llm(system, user)
164
- return {"result": result}
 
 
 
 
 
165
 
166
 
167
  @app.post("/fengshui/analyze")
 
151
 
152
  @app.post("/tarot/read")
153
  def read_tarot(request: TarotRequest):
154
+ try:
155
+ lang = normalize_lang(request.lang)
156
+ system = get_dynamic_persona(lang, "tarot")
157
+ cards_text = ", ".join(request.cards)
158
+ user = (
159
+ f"Topic: {request.topic}\n"
160
+ f"Selected cards: {cards_text}\n"
161
+ f"Question: {request.query}\n\n"
162
+ f"Give a tarot reading as Emily. Interpret each card for this topic and weave them together."
163
+ )
164
+ result = _call_llm(system, user)
165
+ return {"result": result}
166
+ except HTTPException:
167
+ raise
168
+ except Exception as exc:
169
+ raise HTTPException(status_code=502, detail=str(exc)) from exc
170
 
171
 
172
  @app.post("/fengshui/analyze")