JWT-update_6
Browse files
app.py
CHANGED
|
@@ -110,10 +110,12 @@ def chat_stream(
|
|
| 110 |
financial_context = ""
|
| 111 |
try:
|
| 112 |
access_token = request.access_token if request.access_token else SANDBOX_ACCESS_TOKEN
|
|
|
|
| 113 |
financial_context = get_financial_snapshot(access_token)
|
|
|
|
| 114 |
financial_context = financial_context.replace("{", "(").replace("}", ")")
|
| 115 |
-
print(f"Using access token: {access_token[:20]}...", flush=True)
|
| 116 |
except Exception as e:
|
|
|
|
| 117 |
financial_context = "Bank data temporarily unavailable."
|
| 118 |
|
| 119 |
def generate():
|
|
@@ -126,7 +128,7 @@ def chat_stream(
|
|
| 126 |
yield "data: [DONE]\n\n"
|
| 127 |
|
| 128 |
return StreamingResponse(generate(), media_type="text/event-stream")
|
| 129 |
-
|
| 130 |
|
| 131 |
@app.post("/plaid/create_link_token", response_model=LinkTokenResponse)
|
| 132 |
def plaid_create_link_token(
|
|
|
|
| 110 |
financial_context = ""
|
| 111 |
try:
|
| 112 |
access_token = request.access_token if request.access_token else SANDBOX_ACCESS_TOKEN
|
| 113 |
+
print(f"Using access token: {access_token[:20]}...", flush=True)
|
| 114 |
financial_context = get_financial_snapshot(access_token)
|
| 115 |
+
print(f"Financial context preview: {financial_context[:150]}", flush=True)
|
| 116 |
financial_context = financial_context.replace("{", "(").replace("}", ")")
|
|
|
|
| 117 |
except Exception as e:
|
| 118 |
+
print(f"Plaid fetch error: {e}", flush=True)
|
| 119 |
financial_context = "Bank data temporarily unavailable."
|
| 120 |
|
| 121 |
def generate():
|
|
|
|
| 128 |
yield "data: [DONE]\n\n"
|
| 129 |
|
| 130 |
return StreamingResponse(generate(), media_type="text/event-stream")
|
| 131 |
+
|
| 132 |
|
| 133 |
@app.post("/plaid/create_link_token", response_model=LinkTokenResponse)
|
| 134 |
def plaid_create_link_token(
|