fix: workflow as tool type

This commit is contained in:
Yeuoly
2024-08-29 14:09:47 +08:00
parent c8b0160ea9
commit 4a8d3c54ca
3 changed files with 27 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import os
import threading
import uuid
from collections.abc import Generator
from typing import Union
from typing import Literal, Union, overload
from flask import Flask, current_app
from pydantic import ValidationError
@ -32,6 +32,28 @@ logger = logging.getLogger(__name__)
class WorkflowAppGenerator(BaseAppGenerator):
@overload
def generate(
self, app_model: App,
workflow: Workflow,
user: Union[Account, EndUser],
args: dict,
invoke_from: InvokeFrom,
stream: Literal[True] = True,
call_depth: int = 0,
) -> Generator[dict, None, None]: ...
@overload
def generate(
self, app_model: App,
workflow: Workflow,
user: Union[Account, EndUser],
args: dict,
invoke_from: InvokeFrom,
stream: Literal[False] = False,
call_depth: int = 0,
) -> dict: ...
def generate(
self, app_model: App,
workflow: Workflow,