From 524ee4848701d763744644f1b128929f52d93a8b Mon Sep 17 00:00:00 2001 From: aaron <> Date: Mon, 26 May 2025 16:25:13 +0800 Subject: [PATCH] update --- cryptoai/routes/analysis.py | 25 ++++++++++++++++++++++--- docker-compose.yml | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cryptoai/routes/analysis.py b/cryptoai/routes/analysis.py index 31e9ad6..948f2b2 100644 --- a/cryptoai/routes/analysis.py +++ b/cryptoai/routes/analysis.py @@ -7,7 +7,7 @@ from cryptoai.routes.user import get_current_user from fastapi import HTTPException from fastapi.responses import StreamingResponse import requests - +from datetime import date, timedelta class AnalysisHistoryRequest(BaseModel): symbol: str @@ -64,7 +64,7 @@ async def analysis(request: AnalysisRequest, get_db_manager().user_question_manager.save_user_question(current_user["id"], symbol, "请分析以下加密货币:" + symbol + ",并给出分析报告。") - else: + elif request.type == 'astock': stock_code = request.stock_code token = 'app-nWuCOa0YfQVtAosTY3Jr5vFV' @@ -76,7 +76,26 @@ async def analysis(request: AnalysisRequest, "user": current_user["mail"] } - get_db_manager().user_question_manager.save_user_question(current_user["id"], stock_code, "请分析以下股票:" + stock_code + ",并给出分析报告。") + get_db_manager().user_question_manager.save_user_question(current_user["id"], stock_code, "请分析以下A股股票:" + stock_code + ",并给出分析报告。") + + elif request.type == 'usstock': + stock_code = request.stock_code + token = 'app-gFjHuqwMEFzu7oNAMWAlZXBG' + + payload = { + "inputs" : { + "stock": stock_code, + "start_date": (date.today() - timedelta(days=180)).strftime("%Y-%m-%d"), + "end_date": date.today().strftime("%Y-%m-%d") + }, + "response_mode": "streaming", + "user": current_user["mail"] + } + get_db_manager().user_question_manager.save_user_question(current_user["id"], stock_code, "请分析以下美股股票:" + stock_code + ",并给出分析报告。") + + else: + raise HTTPException(status_code=400, detail="不支持的类型") + url = 'https://mate.aimateplus.com/v1/workflows/run' headers = { diff --git a/docker-compose.yml b/docker-compose.yml index 8775199..3685bd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: cryptoai-api: build: . container_name: cryptoai-api - image: cryptoai-api:0.1.28 + image: cryptoai-api:0.1.29 restart: always ports: - "8000:8000"