Fix: Move project files to root directory

This commit is contained in:
jeremygan2021
2026-01-13 21:23:50 +08:00
parent f85cded5d9
commit ecf994ab19
16 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
# Add Dynamic Agent API (Type=1) with Database Integration
I will implement the Dynamic Agent feature by integrating it with the existing `agent_cards` system. Dynamic Agents will be distinguished by `type=1` and will store their extended data (videos, knowledge base) in a new linked table.
## 1. Database Schema Extension
I will create a new table `dynamic_agent_details` to store the specialized data for dynamic agents.
* **Table Name**: `dynamic_agent_details`
* **Columns**:
* `id`: `SERIAL PRIMARY KEY`
* `card_id`: `INTEGER` (Foreign Key linking to `agent_cards.card_id`)
* `videos`: `JSONB` (Stores list of `{url, emotion}`, min 1, max 7)
* `kb_id`: `VARCHAR` (Knowledge Base ID)
* `kb_config`: `JSONB` (Additional Knowledge Base fields)
* `created_at`: `TIMESTAMP`
## 2. Code Implementation (`main.py`)
### Pydantic Models
I will define:
* `VideoItem`: `{url: str, emotion: str}`
* `DynamicAgentCreate`: Inherits/Includes fields from `AgentCard` (name, avatar, etc.) PLUS:
* `videos`: List[VideoItem] (validated length 1-7)
* `kb_id`: str
* `kb_config`: dict
### API Endpoints
1. **Create Dynamic Agent**
* `POST /dynamic_agent/`
* **Logic**:
1. Insert the base agent info into `agent_cards` with `type=1` and `RETURNING card_id`.
2. Insert the extended info (videos, kb details) into `dynamic_agent_details` using the returned `card_id`.
3. Return the new `card_id`.
2. **Get Dynamic Agent Details**
* `GET /dynamic_agent/{card_id}`
* **Logic**:
1. Fetch base info from `agent_cards`.
2. Fetch extended info from `dynamic_agent_details`.
3. Return combined result.
### Helper Functions
* `init_dynamic_agent_db()`: Checks/Creates the `dynamic_agent_details` table on startup.
## 3. Verification
* Create a dynamic agent via the new API.
* Verify it appears in the `agent_cards` table (as type 1).
* Verify extended data is in `dynamic_agent_details`.