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`.

View File

@@ -0,0 +1,43 @@
# Implement Tool Management for Dynamic Agents
I will implement a system to manage "Tools" (Function Calls) and associate them with Dynamic Agents, allowing the frontend to easily configure which tools an agent can use.
## 1. Database Schema Expansion
I will create two new tables in PostgreSQL:
* `tools`: Stores reusable tool definitions (templates).
* `tool_id`: `SERIAL PRIMARY KEY`
* `name`: `VARCHAR` (Unique, e.g., "get_weather")
* `description`: `TEXT` (For LLM understanding)
* `parameters`: `JSONB` (JSON Schema for arguments)
* `created_at`: `TIMESTAMP`
* `agent_tools`: Maps agents to tools (Many-to-Many).
* `agent_card_id`: `INTEGER` (FK)
* `tool_id`: `INTEGER` (FK)
* `config`: `JSONB` (Optional, for agent-specific tool config if needed)
## 2. API Implementation (`main.py`)
### Pydantic Models
* `ToolCreate`: Validation for creating new tool definitions.
* `ToolResponse`: API response format.
* `AgentToolAssignment`: For linking tools to agents.
### New Endpoints
* **Tool Management (CRUD)**:
* `POST /tools/`: Create a new tool definition.
* `GET /tools/`: List all available tools.
* `PUT /tools/{tool_id}`: Update a tool.
* `DELETE /tools/{tool_id}`: Delete a tool.
* **Agent Tool Association**:
* `POST /agent/{card_id}/tools`: Assign a list of tools to an agent.
* `GET /agent/{card_id}/tools`: Get all tools assigned to an agent.
* `DELETE /agent/{card_id}/tools/{tool_id}`: Remove a tool from an agent.
### Update Existing Logic
* **Modify `GET /dynamic_agent/{card_id}`**:
* Update the query to automatically fetch and include the list of associated tools in the agent details response. This ensures the frontend gets everything in one call.
## 3. Verification
* Create a "Weather Query" tool definition.
* Assign it to a Dynamic Agent.
* Verify the agent details endpoint returns the tool info correctly.