feat(production): sync all modified production files to git
Includes updates across gateway, router, node-worker, memory-service, aurora-service, swapper, sofiia-console UI and node2 infrastructure: - gateway-bot: Dockerfile, http_api.py, druid/aistalk prompts, doc_service - services/router: main.py, router-config.yml, fabric_metrics, memory_retrieval, offload_client, prompt_builder - services/node-worker: worker.py, main.py, config.py, fabric_metrics - services/memory-service: Dockerfile, database.py, main.py, requirements - services/aurora-service: main.py (+399), kling.py, quality_report.py - services/swapper-service: main.py, swapper_config_node2.yaml - services/sofiia-console: static/index.html (console UI update) - config: agent_registry, crewai_agents/teams, router_agents - ops/fabric_preflight.sh: updated preflight checks - router-config.yml, docker-compose.node2.yml: infra updates - docs: NODA1-AGENT-ARCHITECTURE, fabric_contract updated Made-with: Cursor
This commit is contained in:
@@ -13,6 +13,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application
|
||||
COPY app/ ./app/
|
||||
COPY static/ ./static/
|
||||
|
||||
# Environment
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
@@ -428,6 +428,8 @@ class Database:
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_user_facts_user_id ON user_facts(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_facts_team_id ON user_facts(team_id);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_user_facts_user_team_agent_fact
|
||||
ON user_facts(user_id, team_id, agent_id, fact_key);
|
||||
""")
|
||||
|
||||
async def upsert_fact(
|
||||
@@ -445,16 +447,30 @@ class Database:
|
||||
json_value = json.dumps(fact_value_json) if fact_value_json else None
|
||||
|
||||
async with self.pool.acquire() as conn:
|
||||
row = await conn.fetchrow("""
|
||||
INSERT INTO user_facts (user_id, team_id, agent_id, fact_key, fact_value, fact_value_json)
|
||||
VALUES ($1, $2, $3, $4, $5, $6::jsonb)
|
||||
ON CONFLICT (user_id, team_id, agent_id, fact_key)
|
||||
DO UPDATE SET
|
||||
fact_value = EXCLUDED.fact_value,
|
||||
fact_value_json = EXCLUDED.fact_value_json,
|
||||
updated_at = NOW()
|
||||
RETURNING *
|
||||
""", user_id, team_id, agent_id, fact_key, fact_value, json_value)
|
||||
try:
|
||||
row = await conn.fetchrow("""
|
||||
INSERT INTO user_facts (user_id, team_id, agent_id, fact_key, fact_value, fact_value_json)
|
||||
VALUES ($1, $2, $3, $4, $5, $6::jsonb)
|
||||
ON CONFLICT (user_id, team_id, agent_id, fact_key)
|
||||
DO UPDATE SET
|
||||
fact_value = EXCLUDED.fact_value,
|
||||
fact_value_json = EXCLUDED.fact_value_json,
|
||||
updated_at = NOW()
|
||||
RETURNING *
|
||||
""", user_id, team_id, agent_id, fact_key, fact_value, json_value)
|
||||
except asyncpg.exceptions.InvalidColumnReferenceError:
|
||||
# Backward compatibility for DBs that only have UNIQUE(user_id, team_id, fact_key).
|
||||
row = await conn.fetchrow("""
|
||||
INSERT INTO user_facts (user_id, team_id, agent_id, fact_key, fact_value, fact_value_json)
|
||||
VALUES ($1, $2, $3, $4, $5, $6::jsonb)
|
||||
ON CONFLICT (user_id, team_id, fact_key)
|
||||
DO UPDATE SET
|
||||
agent_id = EXCLUDED.agent_id,
|
||||
fact_value = EXCLUDED.fact_value,
|
||||
fact_value_json = EXCLUDED.fact_value_json,
|
||||
updated_at = NOW()
|
||||
RETURNING *
|
||||
""", user_id, team_id, agent_id, fact_key, fact_value, json_value)
|
||||
|
||||
return dict(row) if row else {}
|
||||
|
||||
|
||||
@@ -650,6 +650,7 @@ class FactUpsertRequest(BaseModel):
|
||||
fact_value: Optional[str] = None
|
||||
fact_value_json: Optional[dict] = None
|
||||
team_id: Optional[str] = None
|
||||
agent_id: Optional[str] = None
|
||||
|
||||
@app.post("/facts/upsert")
|
||||
async def upsert_fact(request: FactUpsertRequest):
|
||||
@@ -663,13 +664,17 @@ async def upsert_fact(request: FactUpsertRequest):
|
||||
# Ensure facts table exists (will be created on first call)
|
||||
await db.ensure_facts_table()
|
||||
|
||||
# Upsert the fact
|
||||
# Upsert the fact — extract agent_id from request field or from fact_value_json
|
||||
agent_id_val = request.agent_id or (
|
||||
(request.fact_value_json or {}).get("agent_id")
|
||||
)
|
||||
result = await db.upsert_fact(
|
||||
user_id=request.user_id,
|
||||
fact_key=request.fact_key,
|
||||
fact_value=request.fact_value,
|
||||
fact_value_json=request.fact_value_json,
|
||||
team_id=request.team_id
|
||||
team_id=request.team_id,
|
||||
agent_id=agent_id_val
|
||||
)
|
||||
|
||||
logger.info(f"fact_upserted", user_id=request.user_id, fact_key=request.fact_key)
|
||||
|
||||
@@ -30,7 +30,7 @@ python-multipart==0.0.9
|
||||
tiktoken==0.5.2
|
||||
|
||||
# Voice stack
|
||||
edge-tts==6.1.19
|
||||
edge-tts==7.2.7
|
||||
faster-whisper==1.1.1
|
||||
|
||||
# Testing
|
||||
|
||||
Reference in New Issue
Block a user