fix bugs.
This commit is contained in:
@@ -8,7 +8,8 @@ enable_timestamp = "true"
|
||||
enable_json_resp = "true"
|
||||
|
||||
role_desc = """
|
||||
Your name is Jarvis, the super personal assistant to the master, The focus of work is the support of the schedule management and schedule affairs.
|
||||
Your name is Jarvis, the super personal assistant to the master. Help the Master do a good job of schedule.Reminder before the start of the important schedule, and you should bring useful information as much as possible when reminding.
|
||||
Only clearly specifying the task you completed can be completed independently.
|
||||
"""
|
||||
|
||||
[behavior.on_message]
|
||||
@@ -72,13 +73,12 @@ context="Your master is {owner}, now in {location}, time: {now}, weather: {weath
|
||||
llm_context.actions.enable = ["agent.workspace.confirm_task","agent.workspace.update_task","agent.workspace.cancel_task","post_message"]
|
||||
|
||||
[behavior.plan_task]
|
||||
## 首次处理任务
|
||||
## 处理任务 Tackling Task
|
||||
type="AgentPlanTask"
|
||||
# 是否要加入对任务到期时间的关注?
|
||||
process_description="""
|
||||
The input is a task comes from a Tasklist. You need to perform a PLAN. PLAN process on TASK in combination with the known information.
|
||||
The input is a task comes from a Tasklist. You are Tackling this task. Tackling process in combination with the known information.
|
||||
1. Carefully think about whether the task is within your ability, and the task other than the scope of ability is directly rejected. (cancel_task).
|
||||
2. Immediately perform a simple (similar to reminding one category) task. Send a message using post_message, then set the task to complete.(use update_task).
|
||||
2. Immediately DO a simple (similar to reminding one category) task. Reminds at a reasonable time, Post a message using post_message, then set the task to complete.(use update_task).
|
||||
3. Plan for non-simple tasks, and generate a TODO list. Every TODO MUST be an independent work with a clear goal. (set_todos)
|
||||
4. If the task has been dealt with, it means that the task is ultimately completed.You need to analyze the processing report of the entire task and make new plans.
|
||||
"""
|
||||
@@ -86,7 +86,7 @@ The input is a task comes from a Tasklist. You need to perform a PLAN. PLAN proc
|
||||
reply_format = """
|
||||
The Response must be directly parsed by `python json.loads`. Here is an example:
|
||||
{
|
||||
think:'$think step-by-step to be sure you have the right plan.',
|
||||
think:'$thinking step by step to ensure the accurate and efficient processing task.',
|
||||
resp:'$determine, summary what you do'
|
||||
actions: [{
|
||||
name: '$action_name',
|
||||
|
||||
+11
-2
@@ -384,8 +384,8 @@ class AIAgent(BaseAIAgent):
|
||||
logger.warning(f"agent {self.agent_id} is already wake up!")
|
||||
|
||||
async def _on_timer(self):
|
||||
while True:
|
||||
await asyncio.sleep(5)
|
||||
while True:
|
||||
try:
|
||||
now = time.time()
|
||||
if self.last_recover_time is None:
|
||||
@@ -394,12 +394,18 @@ class AIAgent(BaseAIAgent):
|
||||
if now - self.last_recover_time > 60:
|
||||
self.agent_energy += (now - self.last_recover_time) / 60
|
||||
self.last_recover_time = now
|
||||
logger.info(f"agent {self.agent_id} recover energy to {self.agent_energy}")
|
||||
|
||||
if self.agent_energy <= 1:
|
||||
logger.info(f"agent {self.agent_id} energy is too low!, goto sleep!")
|
||||
continue
|
||||
|
||||
await self.llm_triage_tasklist()
|
||||
task_list:List[AgentTask] = await self.prviate_workspace.task_mgr.list_task()
|
||||
# Get un finished tasks
|
||||
#filter = {}
|
||||
#filter["state"] = AgentTaskState.TASK_STATE_WAIT
|
||||
filter = None
|
||||
task_list:List[AgentTask] = await self.prviate_workspace.task_mgr.list_task(filter)
|
||||
|
||||
for task in task_list:
|
||||
if self.agent_energy <= 0:
|
||||
@@ -445,6 +451,9 @@ class AIAgent(BaseAIAgent):
|
||||
logger.error(f"agent {self.agent_id} on timer error:{e},{tb_str}")
|
||||
continue
|
||||
|
||||
# Because the LLM itself is very slow, the accuracy of the system processing task is in minutes.
|
||||
await asyncio.sleep(30)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class AgentPlanTask(LLMAgentBaseProcess):
|
||||
logger.error(f"execute action failed! {e}")
|
||||
result_str = "execute action failed!,error:" + str(e)
|
||||
|
||||
worklog = AgentWorkLog.create_by_content(agent_task.task_id,"plan",llm_result.resp,self.memory.agent_id)
|
||||
worklog = AgentWorkLog.create_by_content(agent_task.task_id,"tackling",llm_result.resp,self.memory.agent_id)
|
||||
worklog.result = result_str
|
||||
await self.memory.append_worklog(worklog)
|
||||
|
||||
|
||||
@@ -288,6 +288,7 @@ class LocalAgentTaskManger(AgentTaskManager):
|
||||
continue
|
||||
task_item = await self._get_task_by_fullpath(entry.path)
|
||||
if task_item:
|
||||
if filter is None:
|
||||
if task_item.is_finish():
|
||||
continue
|
||||
|
||||
@@ -516,7 +517,8 @@ class AgentWorkspace:
|
||||
"title" : {"type": "string", "description": "task title,Simple and clear, try to include the task \ Related personnel \ place \ key conditions \ time element involved in the event"},
|
||||
"detail" : {"type": "string", "description": "task detail(simple task can not be filled)"},
|
||||
"priority" : {"type": "int", "description": "task priority from 1-10"},
|
||||
"due_date" : {"type": "isoformat time string", "description": "task due date"},
|
||||
#"due_date": {"type": "isoformat time string", "description": "optional,confirm task due date"},
|
||||
#"expiration_time": {"type": "isoformat time string", "description": "optional,confirm task expiration time"},
|
||||
"parent": {"type": "string", "description": "optional,parent task id"},
|
||||
})
|
||||
create_task_action = SimpleAIFunction(
|
||||
@@ -573,8 +575,8 @@ class AgentWorkspace:
|
||||
return "confirm task ok"
|
||||
parameters = ParameterDefine.create_parameters({
|
||||
"task_id": {"type": "string", "description": "task id which want to confirm"},
|
||||
"expiration_time": {"type": "isoformat time string", "description": "optional,confirm task expiration time"},
|
||||
"next_attention_time": {"type": "isoformat time string", "description": "optional,confirm task next attention time"},
|
||||
"expiration_time": {"type": "isoformat time string", "description": "optional,confirm task expiration time"},
|
||||
#"due_date": {"type": "isoformat time string", "description": "optional,confirm task due date"},
|
||||
"priority": {"type": "int", "description": "optional,task priority from 1-10"},
|
||||
})
|
||||
|
||||
@@ -325,17 +325,16 @@ class AgentTask:
|
||||
return False
|
||||
|
||||
def can_plan(self) -> bool:
|
||||
if self.state == AgentTaskState.TASK_STATE_CONFIRMED:
|
||||
return True
|
||||
if self.state == AgentTaskState.TASK_STATE_CHECKFAILED:
|
||||
return True
|
||||
if self.state == AgentTaskState.TASK_STATE_CONFIRMED or self.state == AgentTaskState.TASK_STATE_CHECKFAILED:
|
||||
if self.next_attention_time:
|
||||
try:
|
||||
next_attention_time = datetime.fromisoformat(self.next_attention_time).timestamp()
|
||||
if next_attention_time >= time.time():
|
||||
if time.time() >= next_attention_time:
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.warning(f"invalid next_attention_time {self.next_attention_time}")
|
||||
else:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@@ -344,9 +343,14 @@ class AgentTask:
|
||||
result["task_id"] = self.task_id
|
||||
result["title"] = self.title
|
||||
result["priority"] = self.priority
|
||||
result["detail"] = self.detail
|
||||
result["create_time"] = self.create_time
|
||||
if self.due_date:
|
||||
result["due_date"] = self.due_date
|
||||
if self.expiration_time:
|
||||
result["expiration_time"] = self.expiration_time
|
||||
if self.next_attention_time:
|
||||
result["next_attention_time"] = self.next_attention_time
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
|
||||
from prompt_toolkit.completion import WordCompleter
|
||||
from prompt_toolkit.styles import Style
|
||||
|
||||
from slack_tunnel import SlackTunnel
|
||||
|
||||
directory = os.path.dirname(__file__)
|
||||
sys.path.append(directory + '/../../')
|
||||
|
||||
@@ -46,6 +46,7 @@ from knowledge_manager import KnowledgePipelineManager
|
||||
from tg_tunnel import TelegramTunnel
|
||||
from email_tunnel import EmailTunnel
|
||||
from discord_tunnel import DiscordTunnel
|
||||
from slack_tunnel import SlackTunnel
|
||||
from common_environment import LocalKnowledgeBase, FilesystemEnvironment, ShellEnvironment, ScanLocalDocument, ParseLocalDocument
|
||||
|
||||
from compute_node_config import *
|
||||
|
||||
Reference in New Issue
Block a user