This commit is contained in:
aaron 2025-05-09 22:02:34 +08:00
parent 418d5e3001
commit 560597a892
2 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,7 @@ from cryptoai.utils.config_loader import ConfigLoader
from fastapi.responses import StreamingResponse from fastapi.responses import StreamingResponse
from cryptoai.routes.user import get_current_user from cryptoai.routes.user import get_current_user
import requests import requests
from datetime import datetime
from cryptoai.utils.db_manager import get_db_manager from cryptoai.utils.db_manager import get_db_manager
# 创建路由 # 创建路由
@ -42,7 +43,7 @@ async def get_agents(current_user: Dict[str, Any] = Depends(get_current_user)):
{ {
"id": "2", "id": "2",
"name": "美股交易助手", "name": "美股交易助手",
"hello_prompt": "您好,我是美股交易助手,为您提供专业的股票交易分析和建议", "hello_prompt": "您好,我是美股交易助手,您可以直接输入股票名称比如AAPL然后我会为您提供专业的股票交易分析和建议",
"description": "帮你分析做美股股票技术分析", "description": "帮你分析做美股股票技术分析",
}, },
# { # {
@ -66,13 +67,19 @@ async def chat(request: ChatRequest,current_user: Dict[str, Any] = Depends(get_c
else: else:
raise HTTPException(status_code=400, detail="Invalid agent ID") raise HTTPException(status_code=400, detail="Invalid agent ID")
inputs = {}
if request.agent_id == "2":
inputs = {
"current_date": datetime.now().strftime("%Y-%m-%d")
}
url = "https://mate.aimateplus.com/v1/chat-messages" url = "https://mate.aimateplus.com/v1/chat-messages"
headers = { headers = {
"Authorization": f"Bearer {token}", "Authorization": f"Bearer {token}",
"Content-Type": "application/json" "Content-Type": "application/json"
} }
data = { data = {
"inputs" : {}, "inputs" : inputs,
"query" : request.user_prompt, "query" : request.user_prompt,
"response_mode" : "streaming", "response_mode" : "streaming",
"user" : current_user["mail"] "user" : current_user["mail"]

View File

@ -29,7 +29,7 @@ services:
cryptoai-api: cryptoai-api:
build: . build: .
container_name: cryptoai-api container_name: cryptoai-api
image: cryptoai-api:0.0.9 image: cryptoai-api:0.0.10
restart: always restart: always
ports: ports:
- "8000:8000" - "8000:8000"