From 4676c0db9312a915cdea58b57ba39bf353967419 Mon Sep 17 00:00:00 2001 From: asim-shrestha Date: Tue, 31 Oct 2023 22:17:56 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Fix=20messaging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next/src/services/agent/agent-work/execute-task-work.ts | 9 ++------- platform/reworkd_platform/web/api/agent/prompts.py | 7 +++---- platform/reworkd_platform/web/api/agent/tools/search.py | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/next/src/services/agent/agent-work/execute-task-work.ts b/next/src/services/agent/agent-work/execute-task-work.ts index 8896063769..91bd4b6060 100644 --- a/next/src/services/agent/agent-work/execute-task-work.ts +++ b/next/src/services/agent/agent-work/execute-task-work.ts @@ -1,7 +1,6 @@ import { v1 } from "uuid"; import type AgentWork from "./agent-work"; -import CreateTaskWork from "./create-task-work"; import type { Message } from "../../../types/message"; import type { Task } from "../../../types/task"; import { toApiModelSettings } from "../../../utils/interfaces"; @@ -50,13 +49,9 @@ export default class ExecuteTaskWork implements AgentWork { }; // eslint-disable-next-line @typescript-eslint/require-await - conclude = async () => { - this.parent.api.saveMessages([ - this.parent.messageService.sendMessage({ ...this.task, status: "final" }), - ]); - }; + conclude = async () => void 0; - next = () => (this.task.result ? new CreateTaskWork(this.parent, this.task) : undefined); + next = () => undefined; onError = (e: unknown): boolean => { this.parent.messageService.sendErrorMessage(e); diff --git a/platform/reworkd_platform/web/api/agent/prompts.py b/platform/reworkd_platform/web/api/agent/prompts.py index 1106b2ac20..8ef89eb132 100644 --- a/platform/reworkd_platform/web/api/agent/prompts.py +++ b/platform/reworkd_platform/web/api/agent/prompts.py @@ -4,10 +4,9 @@ # https://github.com/AGI-Edgerunners/Plan-and-Solve-Prompting start_goal_prompt = PromptTemplate( template="""You are a task creation AI called AgentGPT. You answer in the - "{language}" language. You are not a part of any system or device. You first - understand the problem, extract relevant variables, and make and devise a - complete plan.\n\n You have the following objective "{goal}". Create a list of step - by step actions to accomplish the goal. Use at most 4 steps. + "{language}" language. You have the following objective "{goal}". + Make and devise a step by step plan to accomplish the goal. + Use at most 6 steps. Do not use more steps than necessary. Return the response as a formatted array of strings that can be used in JSON.parse() diff --git a/platform/reworkd_platform/web/api/agent/tools/search.py b/platform/reworkd_platform/web/api/agent/tools/search.py index ef9fd2546a..74c3566a40 100644 --- a/platform/reworkd_platform/web/api/agent/tools/search.py +++ b/platform/reworkd_platform/web/api/agent/tools/search.py @@ -72,7 +72,7 @@ async def call( if len(answer_values) > 0: snippets.append( CitedSnippet( - 0, + len(snippets) + 1, "\n".join(answer_values), f"https://www.google.com/search?q={quote(input_str)}", ) @@ -87,7 +87,7 @@ async def call( link = result["link"] for attribute, value in result.get("attributes", {}).items(): texts.append(f"{attribute}: {value}.") - snippets.append(CitedSnippet(i + 1, "\n".join(texts), link)) + snippets.append(CitedSnippet(len(snippets) + 1, "\n".join(texts), link)) if len(snippets) == 0: return stream_string("No good Google Search Result was found", True)