60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
import request from '@/utils/request'
|
|
import axios from 'axios'
|
|
|
|
/**
|
|
* 调用ocr, 直接识别图像中的文字
|
|
*
|
|
* @param {string} imgUrl 图片url
|
|
* @returns {Promise<string>} 识别结果
|
|
*/
|
|
export function recognizeText({ imgUrl }) {
|
|
return request({
|
|
url: '/wms/purchasePlan/recognizeText',
|
|
method: 'post',
|
|
data: { imgUrl }
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 调用通义千问模型, 识别图片中的文字
|
|
*
|
|
* @param {string} imageUrl 图片url
|
|
* @returns {Promise<string>} 识别结果
|
|
*/
|
|
export function recognizeBomByModel({ imageUrl }) {
|
|
return request({
|
|
url: '/wms/imageRecognition/recognize',
|
|
method: 'post',
|
|
data: { imageUrl },
|
|
timeout: 100000
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 调用ocr, 识别pdf中的文字
|
|
*
|
|
* @param {string} imageUrl 图片url
|
|
* @returns {Promise<string>} 识别结果
|
|
*/
|
|
export function recognizePdfText({ pdfUrl }) {
|
|
return request({
|
|
url: '/wms/purchasePlan/recognizePdfText',
|
|
method: 'post',
|
|
data: { pdfUrl },
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 测试外网连接
|
|
*/
|
|
export function testNet() {
|
|
// ping一下百度
|
|
return new Promise((resolve, reject) => {
|
|
axios.get('https://api.thecatapi.com/v1/images/search?limit=1').then(res => {
|
|
resolve(true)
|
|
}).catch(err => {
|
|
resolve(false)
|
|
})
|
|
})
|
|
}
|