Fix the dall e invocation process
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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"]}'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user