Compare commits
9 Commits
bef4479675
...
fix/displa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfa806ab53 | ||
|
|
82645dfb3b | ||
| c17fa243a1 | |||
|
|
a55ed9cc04 | ||
| d1408b74b4 | |||
|
|
4197475eed | ||
| 87bac8894a | |||
| 75970c57e3 | |||
|
|
f23044465a |
@@ -58,7 +58,7 @@ def get_current_user(
|
||||
|
||||
|
||||
@router.post(
|
||||
"/register", response_model=UserResponse, status_code=status.HTTP_201_CREATED
|
||||
"/register", response_model=Token, status_code=status.HTTP_201_CREATED
|
||||
)
|
||||
def register(user: UserCreate, db: Session = Depends(get_db)):
|
||||
existing_user = db.query(User).filter(User.email == user.email).first()
|
||||
@@ -75,7 +75,10 @@ def register(user: UserCreate, db: Session = Depends(get_db)):
|
||||
db.add(db_user)
|
||||
db.commit()
|
||||
db.refresh(db_user)
|
||||
return db_user
|
||||
|
||||
# Generate and return access token so frontend can proceed immediately
|
||||
access_token = create_access_token(data={"sub": db_user.id})
|
||||
return Token(access_token=access_token, token_type="bearer")
|
||||
|
||||
|
||||
@router.post("/login", response_model=Token)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import List, Optional, Dict, Any
|
||||
from crewai import Agent, Task, Crew
|
||||
from .llm_connector import MiniMaxConnector, MiniMaxLLM
|
||||
from crewai import Agent, Task, Crew, LLM
|
||||
from .llm_connector import MiniMaxConnector
|
||||
from ...core.config import get_settings
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ def create_trading_designer_agent(
|
||||
role="Trading Strategy Designer",
|
||||
goal="Convert natural language trading requests into precise strategy configurations",
|
||||
backstory=system_prompt,
|
||||
llm=MiniMaxLLM(api_key=api_key, model=model),
|
||||
llm=LLM(model=model, api_key=api_key, api_base="https://api.minimax.io/v1"),
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
@@ -155,7 +155,7 @@ def create_strategy_validator_agent(
|
||||
backstory="""You are a meticulous strategy validator with expertise in trading systems.
|
||||
You check that all required parameters are present, values are reasonable, and the
|
||||
strategy makes logical sense. You never approve strategies with missing or invalid data.""",
|
||||
llm=MiniMaxLLM(api_key=api_key, model=model),
|
||||
llm=LLM(model=model, api_key=api_key, api_base="https://api.minimax.io/v1"),
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
@@ -169,7 +169,7 @@ def create_strategy_explainer_agent(
|
||||
backstory="""You are a patient trading strategy explainer. You translate complex
|
||||
strategy configurations into easy-to-understand language. You help users understand
|
||||
exactly what their strategies will do when triggered.""",
|
||||
llm=MiniMaxLLM(api_key=api_key, model=model),
|
||||
llm=LLM(model=model, api_key=api_key, api_base="https://api.minimax.io/v1"),
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
from typing import Optional, List, Dict, Any
|
||||
import httpx
|
||||
from crewai import LLM
|
||||
|
||||
|
||||
class MiniMaxLLM(LLM):
|
||||
class MiniMaxLLM:
|
||||
def __init__(self, api_key: str, model: str = "MiniMax-M2.7", **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.api_key = api_key
|
||||
self.model = model
|
||||
self.base_url = "https://api.minimax.io/v1"
|
||||
@@ -23,7 +21,7 @@ class MiniMaxLLM(LLM):
|
||||
}
|
||||
with httpx.Client(timeout=60.0) as client:
|
||||
response = client.post(
|
||||
f"{self.base_url}/chat/completions",
|
||||
f"{self.base_url}/text/chatcompletion_v2",
|
||||
headers=headers,
|
||||
json=payload,
|
||||
)
|
||||
@@ -35,7 +33,7 @@ class MiniMaxLLM(LLM):
|
||||
|
||||
|
||||
class MiniMaxConnector:
|
||||
def __init__(self, api_key: str, model: str = "MiniMax-Text-01"):
|
||||
def __init__(self, api_key: str, model: str = "MiniMax-M2.7"):
|
||||
self.api_key = api_key
|
||||
self.model = model
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
|
||||
isSending = true;
|
||||
|
||||
// Add user's message immediately
|
||||
addMessage({ role: 'user', content: message });
|
||||
|
||||
try {
|
||||
const response = await api.bots.chat(botId, message);
|
||||
addMessage({ role: 'assistant', content: response.response });
|
||||
|
||||
Reference in New Issue
Block a user