gpt4 book ai didi

python - Azure Durable 函数 python DurableOrchestrationContext get_input 返回 null

转载 作者:行者123 更新时间:2023-12-03 02:21:07 27 4
gpt4 key购买 nike

我正在测试此函数,即来自 Azure 持久函数的 Orchestra 函数的 get_input()。 More details of the function .

我现在面临的是,当我尝试使用 postman 进行测试并输入 json 输入时,例如

{
"points": 222
}

作为 json 正文,同时调用 http://localhost:<portnumber>/api/orchestrators/DurableFunctionsOrchestrator1 ,当我尝试返回 get_input 函数的值时,它总是返回一个空值

下面是它返回给我的屏幕截图。正如您所看到的,自完成状态以来一切都工作正常,但输出总是返回 null。

enter image description here

最佳答案

Instance_id 中,您可以将 Client_input 传递到那里,以从 Durable Orchestration 客户端获取请求正文 参数。通过编排器传递 Json 序列化负载。

async  def  main(req: func.HttpRequest, starter: str) -> func.HttpResponse:

client = df.DurableOrchestrationClient(starter)

function_name = req.route_params["functionName"]

requestBody = json.loads(req.get_body().decode())

instance_id = await client.start_new(function_name, client_input=requestBody)

在协调器中,您可以使用相同的get_input()代码:

requestBody : str  =  context.get_input()

我尝试过 blog 。我在 get_input() 上没有得到任何 Null 值。

关于python - Azure Durable 函数 python DurableOrchestrationContext get_input 返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68970988/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com