| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | let Parse = require('parse/node');Parse.initialize("dev");Parse.serverURL = "http://dev.fmode.cn:1337/parse";Parse.masterKey = "devmk";global.Parse = Parseconst {IndexesService} = require("../indexes.service")main()async function main(){    let docs    // 测试接口    docs = await testApiLoad("https://file-cloud.fmode.cn/Svehl6FceL/20240422/063634869.docx","1bcd2a1b5d47fb3f53ff6adc4066c15e")    // docs = await testApiLoad("https://file-cloud.fmode.cn/Svehl6FceL/20240421/112544165.docx")    // 测试网络文件    // docs = await testLoad("https://file-cloud.fmode.cn/Svehl6FceL/20240421/112544165.docx","测试网络docx")    // 测试本地文件        // docs = await testLoad("temp/温清简历.docx")    // docs = await testLoad("temp/姐姐叙述稿件.docx")    // docs = await testLoad("temp/AI自传语伴介绍.pptx")    // docs = await testLoad("temp/AI自传语伴介绍.pdf")    // docs = await testLoad("temp/AI原型稿5:航价比与补能:VS比亚迪唐DM-i.docx")    // docs = await testLoad("temp/使用说明:脑控科技——用智慧引领未来20221128.docx","测试docx")    // docs = await testLoad("temp/案例正文:脑控科技——用智慧引领未来20221128.pdf","测试pdf")    // docs = await testLoad("temp/如影AI直播软件使用说明(v1.1.1).pdf","测试pdf")    // docs = await testLoad("temp/刘雨飏-区块链技术应用-路演版20220803.pptx","测试pptx")    // docs = await testLoad("https://baijiahao.baidu.com/s?id=1747645032390512034&wfr=spider&for=pc","测试webpage")    }async function testApiLoad(filelink,md5){    console.log(filelink)    // let host = "http://127.0.0.1:7337"    // let host = "https://server.fmode.cn"    let host = "https://test.fmode.cn"    let response = await fetch(host+"/api/aiagent/indexes/loader",{        method:"POST",        headers: {            'Content-Type': 'application/json'  // 设置Content-Type为application/json        },        body: JSON.stringify({  // 将对象转换为JSON字符串            url: filelink,            md5: md5        })    })    let json = await response.json()    console.log(json)    return json}async function testLoad(filelink,msg){    let indexes = new IndexesService();    docs = await indexes.load(filelink)    if(docs?.length>0){        docOutput = await indexes.split(docs)        console.log(docOutput)    }}
 |