【发布时间】:2020-11-07 09:18:47
【问题描述】:
如何从 getOperation 响应中获取 modelId?当我使用 operationId 运行 getOperation() 函数时,响应不包含 modelId,即使 done 为真。
我已经尝试了这个问题的所有内容:How to programmatically get model id from google-cloud-automl with node.js client library
但是返回给我的响应不同。
我的功能:
exports.testOperationStatus = async function(operationId) {
// Construct request
const request = {
name: `projects/${projectId}/locations/${location}/operations/${operationId}`,
};
const [response] = await client.operationsClient.getOperation(request);
console.log(`Name: ${response.name}`);
console.log(`Operation details:`);
console.log(`${JSON.stringify(response, null, 2)}`);
}
我的回应:
{
"name": "projects/projectId/locations/us-central1/operations/operationId”,
"metadata": {
"type_url": "type.googleapis.com/google.cloud.automl.v1.OperationMetadata",
"value": {
"type": "Buffer",
"data": […]
}
},
"done": true,
"response": {
"type_url": "type.googleapis.com/google.cloud.automl.v1.Model",
"value": {
"type": "Buffer",
"data": […]
}
},
"result": "response"
}
如何使用 operationId 获取我的 modelId?
【问题讨论】:
标签: node.js reactjs google-cloud-automl automl