You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
# backend/app/agents/tools/task_create.py
|
|
import uuid
|
|
|
|
from ...models import Prio, Project, Task, TaskStatus
|
|
from .base import Tool, ToolResult
|
|
|
|
|
|
class TaskCreateTool(Tool):
|
|
name = "task_create"
|
|
description = "분류된 액션을 task 로 실체화(federation)."
|
|
schema = {
|
|
"type": "object",
|
|
"properties": {"title": {"type": "string"}, "project_id": {"type": "string"}},
|
|
}
|
|
|
|
def __init__(self, session):
|
|
self.session = session
|
|
|
|
def run(self, title: str = "", project_id: str = "me", **kw) -> ToolResult:
|
|
s = self.session
|
|
if not s.get(Project, project_id):
|
|
project_id = "me"
|
|
tid = "ag-" + uuid.uuid4().hex[:8]
|
|
t = Task(
|
|
id=tid,
|
|
title=title,
|
|
project_id=project_id,
|
|
status=TaskStatus.todo,
|
|
assignee_id="jiwoo",
|
|
prio=Prio.normal,
|
|
notes="에이전트가 만든 작업이에요.",
|
|
)
|
|
s.add(t)
|
|
s.commit()
|
|
return ToolResult(ok=True, data={"task_id": tid})
|