Fix the dall e invocation process

This commit is contained in:
Song
2023-12-04 10:39:56 +08:00
parent 83149b5590
commit 3dc4fe8e4c
7 changed files with 20 additions and 9 deletions
+2
View File
@@ -477,6 +477,8 @@ class BaseAIAgent(abc.ABC):
org_msg:AgentMsg,
stack_limit = 5
) -> ComputeTaskResult:
from ..frame.compute_kernel import ComputeKernel
arguments = None
try:
func_name = inner_func_call_node.get("name")
+3 -3
View File
@@ -319,9 +319,9 @@ class PaintEnvironment(Environment):
async def _paint(self, prompt, model_name = None, negative_prompt = None) -> str:
err, result = await ComputeKernel.get_instance().do_text_2_image(prompt, model_name, negative_prompt)
if err is not None:
return f"exec paint failed. err:{err}"
result = await ComputeKernel.get_instance().do_text_2_image(prompt, model_name, negative_prompt)
if result.result_code == ComputeTaskResultCode.ERROR:
return f"exec paint failed. err:{result.error_str}"
else:
return f'exec paint OK, saved as a local file, path is: {result.result["file"]}'
+2 -2
View File
@@ -240,9 +240,9 @@ class ComputeKernel:
async def do_text_2_image(self, prompt:str, model_name:Optional[str] = None, negative_prompt = None) -> ComputeTaskResult:
task = self.text_2_image(prompt,model_name, negative_prompt)
task = await self._wait_task(task)
task_result = await self._wait_task(task)
return task.result
return task_result
# if task_req.state == ComputeTaskState.DONE:
# return None, task_result