我正在使用Algorithmia的“提取文本”算法构建应用,该算法可从用户那里接收文件并从文件中提取文本。在示例之后,输入应类似于"data://util/SampleCollection/easychair.docx"
,但出现以下错误:
(node:17748) UnhandledPromiseRejectionWarning: 401 not authorized: {"error":{"message":"authorization required - attempted action: credentials not sufficient for action DataRead - collection permissions do not allow read"}}
我尝试使用网络上的文档,并将“ data://”更改为“ file://”,但是这些都不起作用。
const input = "data://caio.tracera/Desktop/texto.docx"
const algorithmiaAuthenticated = algorithmia.client(algorithmiaApiKey)
const extractTextAlgorithm = algorithmiaAuthenticated.algo('util/ExtractText/0.1.1')
const extractTextResponse = await extractTextAlgorithm.pipe(input)
const extractTextContent = extractTextResponse.get()
输入文件和项目在同一文件夹中。 预期结果是当我console.log extractTextContent时来自文件的文本。