testImg.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. /**
  2. * 测试获取数据接口
  3. * @param {*} workId
  4. * @param {*} routerName
  5. */
  6. async function testgetDataByTask(workId, routerName) {
  7. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getDataByTask02'
  8. try {
  9. let a = await fetch(url, {
  10. "headers": {
  11. "Content-Type": "application/json",
  12. },
  13. "method": 'POST',
  14. "mode": "cors",
  15. "referrer": "http://localhost:4200/",
  16. body: JSON.stringify({
  17. workId,
  18. routerName,
  19. // logo_info: {
  20. // "add_logo": true, // 是否添加水印
  21. // "position": 1, // 水印位置(0-3)
  22. // "language": 0, // 水印语言(0中文/1英文)
  23. // "opacity": 0.5, // 不透明度(0-1)
  24. // "logo_text_content": '非常好看的水印' // 自定义水印文本
  25. // },
  26. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  27. })
  28. })
  29. let data = await a.json()
  30. console.log('运行成功', data)
  31. } catch (error) {
  32. console.log('运行失败', error)
  33. }
  34. }
  35. // testgetImgV4()
  36. // testgetDataByTask('u1XrdyaG2f', 'getClothesV2')
  37. /**测试图片生成v4接口 */
  38. async function testgetImgV4() {
  39. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getImgV4'
  40. try {
  41. let a = await fetch(url, {
  42. "headers": {
  43. "Content-Type": "application/json",
  44. },
  45. "method": 'POST',
  46. "mode": "cors",
  47. "referrer": "http://localhost:4200/",
  48. body: JSON.stringify({
  49. image_urls: [
  50. // 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg',//模特
  51. // 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20251010/110201038.png',//衣服
  52. // 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250718/042053608.jpg',//裤子
  53. // 'https://img95.699pic.com/photo/60070/7188.jpg_wh860.jpg',//鞋子
  54. // 'https://img95.699pic.com/photo/60046/9255.jpg_wh860.jpg',//刺绣
  55. ],
  56. prompt: '帮我生成一个涵盖友情、独特、文化底蕴、科技的可爱日漫风但人物为中国人的图片',
  57. sizeDate: {
  58. width: 2048,
  59. height: 2048,
  60. },
  61. scale: 0.6,
  62. force_single: false,
  63. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  64. })
  65. })
  66. let data = await a.json()
  67. console.log('运行成功', data)
  68. } catch (error) {
  69. console.log('运行失败', error)
  70. }
  71. }
  72. // testgetText2ImgV3()
  73. // testgetDataByTask('fCF1wWWAvd', 'getText2ImgV3')
  74. /**测试文生图v3.0接口 */
  75. async function testgetText2ImgV3() {
  76. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getText2ImgV3'
  77. try {
  78. let a = await fetch(url, {
  79. "headers": {
  80. "Content-Type": "application/json",
  81. },
  82. "method": 'POST',
  83. "mode": "cors",
  84. "referrer": "http://localhost:4200/",
  85. body: JSON.stringify({
  86. prompt: '芙蓉面美如远山秀,杏仁眼灵性儿透。',
  87. use_pre_llm: true,
  88. sizeDate: {
  89. width: 599,
  90. height: 1328,
  91. },
  92. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  93. })
  94. })
  95. let data = await a.json()
  96. console.log('运行成功', data)
  97. } catch (error) {
  98. console.log('运行失败', error)
  99. }
  100. }
  101. // testgetText2ImgV31()
  102. // testgetDataByTask('F7Jg20O8kT', 'getText2ImgV31')
  103. /**测试文生图v3.1接口 */
  104. async function testgetText2ImgV31() {
  105. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getText2ImgV31'
  106. try {
  107. let a = await fetch(url, {
  108. "headers": {
  109. "Content-Type": "application/json",
  110. },
  111. "method": 'POST',
  112. "mode": "cors",
  113. "referrer": "http://localhost:4200/",
  114. body: JSON.stringify({
  115. prompt: '淡蓝紫的冷清感,一束小雏菊,右下角展示一串小的艺术字”手捧一束小雏菊赠与你,那是藏于内心的光芒。“',
  116. use_pre_llm: true,
  117. sizeDate: {
  118. width: 599,
  119. height: 1328,
  120. },
  121. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  122. })
  123. })
  124. let data = await a.json()
  125. console.log('运行成功', data)
  126. } catch (error) {
  127. console.log('运行失败', error)
  128. }
  129. }
  130. // testgetImg2ImgV3()
  131. // testgetDataByTask('o4BVp8Jkis', 'getImg2ImgV3')
  132. /**测试图生图v3.0接口 */
  133. async function testgetImg2ImgV3() {
  134. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getImg2ImgV3'
  135. try {
  136. let a = await fetch(url, {
  137. "headers": {
  138. "Content-Type": "application/json",
  139. },
  140. "method": 'POST',
  141. "mode": "cors",
  142. "referrer": "http://localhost:4200/",
  143. body: JSON.stringify({
  144. image_url: 'https://portal.volccdn.com/obj/volcfe/cloud-universal-doc/upload_cb41187994a982411145b758a9bf3241.png',
  145. prompt: '背景换成秋天落叶',
  146. scale: 0.5,
  147. sizeDate: {
  148. width: 1328,
  149. height: 1328,
  150. },
  151. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  152. })
  153. })
  154. let data = await a.json()
  155. console.log('运行成功', data)
  156. } catch (error) {
  157. console.log('运行失败', error)
  158. }
  159. }
  160. // testgetVideoV3_Pro()
  161. // testgetDataByTask('UHY260ah4C', 'getVideoV3_Pro')
  162. async function testgetVideoV3_Pro() {
  163. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_Pro'
  164. try {
  165. let a = await fetch(url, {
  166. "headers": {
  167. "Content-Type": "application/json",
  168. },
  169. "method": 'POST',
  170. "mode": "cors",
  171. "referrer": "http://localhost:4200/",
  172. body: JSON.stringify({
  173. prompt: '两个q版小女孩笑着面向镜头慢慢地跑',
  174. frames: 121,
  175. image_url: 'https://portal.volccdn.com/obj/volcfe/cloud-universal-doc/upload_cb41187994a982411145b758a9bf3241.png',
  176. aspect_ratio: 5,
  177. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  178. })
  179. })
  180. let data = await a.json()
  181. console.log('运行成功', data)
  182. } catch (error) {
  183. console.log('运行失败', error)
  184. }
  185. }
  186. // testgetImgV4_pod()
  187. // testgetDataByTask('hzTkHHsCjo', 'getImgV4_pod')
  188. /**测试图片生成4.0-素材提取(POD按需定制)接口 */
  189. async function testgetImgV4_pod() {
  190. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getImgV4_pod'
  191. try {
  192. let a = await fetch(url, {
  193. "headers": {
  194. "Content-Type": "application/json",
  195. },
  196. "method": 'POST',
  197. "mode": "cors",
  198. "referrer": "http://localhost:4200/",
  199. body: JSON.stringify({
  200. image_url:'https://img95.699pic.com/photo/60046/9255.jpg_wh860.jpg',//刺绣
  201. instruction: 1,
  202. prompt: '改成淡紫色的花朵,深绿色的枝叶',
  203. sizeDate: {
  204. width: 2048,
  205. height: 2048,
  206. },
  207. lora_weight:0.5,
  208. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  209. })
  210. })
  211. let data = await a.json()
  212. console.log('运行成功', data)
  213. } catch (error) {
  214. console.log('运行失败', error)
  215. }
  216. }
  217. // testgetImgV4_goods()
  218. // testgetDataByTask('LwoFZ892Ut', 'getImgV4_goods')
  219. /**测试图片生成4.0-素材提取(POD按需定制)接口 */
  220. async function testgetImgV4_goods() {
  221. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getImgV4_goods'
  222. try {
  223. let a = await fetch(url, {
  224. "headers": {
  225. "Content-Type": "application/json",
  226. },
  227. "method": 'POST',
  228. "mode": "cors",
  229. "referrer": "http://localhost:4200/",
  230. body: JSON.stringify({
  231. image_url:'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20260312/040725626.jpg',//模特
  232. instruction: 1,
  233. sizeDate: {
  234. width: 2560,
  235. height: 1440,
  236. },
  237. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  238. })
  239. })
  240. let data = await a.json()
  241. console.log('运行成功', data)
  242. } catch (error) {
  243. console.log('运行失败', error)
  244. }
  245. }
  246. // testgetInpaint()
  247. // testgetDataByTask('gsMphbw7Gd', 'getInpaint')
  248. /**测试交互编辑接口 */
  249. async function testgetInpaint() {
  250. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getInpaint'
  251. try {
  252. let a = await fetch(url, {
  253. "headers": {
  254. "Content-Type": "application/json",
  255. },
  256. "method": 'POST',
  257. "mode": "cors",
  258. "referrer": "http://localhost:4200/",
  259. body: JSON.stringify({
  260. image_urls: [
  261. 'https://portal.volccdn.com/obj/volcfe/cloud-universal-doc/upload_cb41187994a982411145b758a9bf3241.png',
  262. 'https://portal.volccdn.com/obj/volcfe/cloud-universal-doc/upload_f8f192dc0a831c6ccc3a342fb43d0c97.png'
  263. ],
  264. prompt: '将小女孩换成《白蛇传》里面的人形青白蛇姐妹',
  265. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  266. })
  267. })
  268. let data = await a.json()
  269. console.log('运行成功', data)
  270. } catch (error) {
  271. console.log('运行失败', error)
  272. }
  273. }
  274. // testgetSuperResolution()
  275. // testgetDataByTask('EdXi31Dvro', 'getSuperResolution')
  276. /**测试智能超清接口 */
  277. async function testgetSuperResolution() {
  278. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getSuperResolution'
  279. try {
  280. let a = await fetch(url, {
  281. "headers": {
  282. "Content-Type": "application/json",
  283. },
  284. "method": 'POST',
  285. "mode": "cors",
  286. "referrer": "http://localhost:4200/",
  287. body: JSON.stringify({
  288. image_urls: [
  289. 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg'
  290. ],
  291. resolution: '4k',
  292. scale: 100,
  293. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  294. })
  295. })
  296. let data = await a.json()
  297. console.log('运行成功', data)
  298. } catch (error) {
  299. console.log('运行失败', error)
  300. }
  301. }
  302. // 测试换装v2接口
  303. function testgetClothesV2() {
  304. const body = {
  305. model: 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250723/023647101.jpg', // 模特图URL
  306. upper: 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250723/054650783.png', // 上装图URL
  307. bottom: 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250718/042053608.jpg', // 下装图URL
  308. inference_config: {
  309. do_sr: false,
  310. seed: -1,
  311. keep_head: true,
  312. keep_hand: false,
  313. keep_foot: false,
  314. num_steps: 16,
  315. keep_upper: false,
  316. keep_lower: false,
  317. tight_mask: "loose",
  318. p_bbox_iou_ratio: 0.3,
  319. p_bbox_expand_ratio: 1.1,
  320. max_process_side_length: 1920
  321. },
  322. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  323. };
  324. fetch('https://server.fmode.cn/api/volcengine/jimeng/getClothesV2', {
  325. method: 'POST',
  326. headers: {
  327. 'Content-Type': 'application/json'
  328. },
  329. body: JSON.stringify(body)
  330. })
  331. .then(response => response.json())
  332. .then(data => {
  333. console.log('换装v2接口响应:', data);
  334. })
  335. .catch(error => {
  336. console.error('换装v2接口错误:', error);
  337. });
  338. }
  339. // testgetClothesV2()
  340. //测试视频生成v3 720p接口
  341. async function testgetVideoV3_720p_method1() {
  342. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_720p'
  343. try {
  344. let a = await fetch(url, {
  345. "headers": {
  346. "Content-Type": "application/json",
  347. },
  348. "method": 'POST',
  349. "mode": "cors",
  350. "referrer": "http://localhost:4200/",
  351. body: JSON.stringify({
  352. prompt: '一只小猫在草地上奔跑',
  353. frames: 121,
  354. method: '1',
  355. config: {
  356. aspect_ratio: '16:9',
  357. },
  358. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  359. })
  360. })
  361. let data = await a.json()
  362. console.log('运行成功', JSON.stringify(data))
  363. } catch (error) {
  364. console.log('运行失败', error)
  365. }
  366. }
  367. // testgetDataByTask('CFiUzNn6Yv', 'getClothesV2')
  368. // testgetVideoV3_720p_method1()
  369. // testgetVideoV3_720p_method2()
  370. // testgetVideoV3_720p_method3()
  371. // testgetVideoV3_720p_method4()
  372. async function testgetVideoV3_720p_method2() {
  373. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_720p'
  374. try {
  375. let a = await fetch(url, {
  376. "headers": {
  377. "Content-Type": "application/json",
  378. },
  379. "method": 'POST',
  380. "mode": "cors",
  381. "referrer": "http://localhost:4200/",
  382. body: JSON.stringify({
  383. prompt: '根据首帧延展生成视频',
  384. frames: 121,
  385. method: '2',
  386. config: {
  387. image_urls: ['https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg'],
  388. },
  389. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  390. })
  391. })
  392. let data = await a.json()
  393. console.log('运行成功', data)
  394. } catch (error) {
  395. console.log('运行失败', error)
  396. }
  397. }
  398. async function testgetVideoV3_720p_method3() {
  399. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_720p'
  400. try {
  401. let a = await fetch(url, {
  402. "headers": {
  403. "Content-Type": "application/json",
  404. },
  405. "method": 'POST',
  406. "mode": "cors",
  407. "referrer": "http://localhost:4200/",
  408. body: JSON.stringify({
  409. prompt: '根据首尾帧生成视频',
  410. frames: 121,
  411. method: '3',
  412. config: {
  413. image_urls: [
  414. 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg',
  415. 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20251010/110201038.png'
  416. ],
  417. },
  418. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  419. })
  420. })
  421. let data = await a.json()
  422. console.log('运行成功', JSON.stringify(data))
  423. } catch (error) {
  424. console.log('运行失败', error)
  425. }
  426. }
  427. async function testgetVideoV3_720p_method4() {
  428. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_720p'
  429. try {
  430. let a = await fetch(url, {
  431. "headers": {
  432. "Content-Type": "application/json",
  433. },
  434. "method": 'POST',
  435. "mode": "cors",
  436. "referrer": "http://localhost:4200/",
  437. body: JSON.stringify({
  438. prompt: '根据首帧生成运镜视频',
  439. frames: 121,
  440. method: '4',
  441. config: {
  442. image_urls: ['https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg'],
  443. template_id: 'quick_pull_back',
  444. camera_strength: 'medium',
  445. },
  446. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  447. })
  448. })
  449. let data = await a.json()
  450. console.log('运行成功', JSON.stringify(data))
  451. } catch (error) {
  452. console.log('运行失败', error)
  453. }
  454. }
  455. // testgetDataByTask('3ZLpNkBudx', 'getVideoV3_1080p')
  456. // testgetVideoV3_1080p_method1()
  457. // testgetVideoV3_1080p_method2()
  458. // testgetVideoV3_1080p_method3()
  459. async function testgetVideoV3_1080p_method1() {
  460. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_1080p'
  461. try {
  462. let a = await fetch(url, {
  463. "headers": {
  464. "Content-Type": "application/json",
  465. },
  466. "method": 'POST',
  467. "mode": "cors",
  468. "referrer": "http://localhost:4200/",
  469. body: JSON.stringify({
  470. prompt: '表达友情、信任、尊重、合作,一种二次元+可爱风格',
  471. frames: 121,
  472. method: '1',
  473. config: {
  474. aspect_ratio: '16:9'
  475. },
  476. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  477. })
  478. })
  479. let data = await a.json()
  480. console.log('运行成功', JSON.stringify(data))
  481. } catch (error) {
  482. console.log('运行失败', error)
  483. }
  484. }
  485. // testgetVideoV3_1080p_method2()
  486. testgetDataByTask('W30Axg9ujJ', 'getVideoV3_1080p')
  487. async function testgetVideoV3_1080p_method2() {
  488. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_1080p'
  489. try {
  490. let a = await fetch(url, {
  491. "headers": {
  492. "Content-Type": "application/json",
  493. },
  494. "method": 'POST',
  495. "mode": "cors",
  496. "referrer": "http://localhost:4200/",
  497. body: JSON.stringify({
  498. prompt: '根据首帧延展生成视频',
  499. frames: 121,
  500. method: '2',
  501. config: {
  502. image_urls: ['https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg']
  503. },
  504. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  505. })
  506. })
  507. let data = await a.json()
  508. console.log('运行成功', JSON.stringify(data))
  509. } catch (error) {
  510. console.log('运行失败', error)
  511. }
  512. }
  513. async function testgetVideoV3_1080p_method3() {
  514. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getVideoV3_1080p'
  515. try {
  516. let a = await fetch(url, {
  517. "headers": {
  518. "Content-Type": "application/json",
  519. },
  520. "method": 'POST',
  521. "mode": "cors",
  522. "referrer": "http://localhost:4200/",
  523. body: JSON.stringify({
  524. prompt: '根据首尾帧生成视频',
  525. frames: 121,
  526. method: '3',
  527. config: {
  528. image_urls: [
  529. 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg',
  530. 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20251010/110201038.png'
  531. ]
  532. },
  533. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  534. })
  535. })
  536. let data = await a.json()
  537. console.log('运行成功', JSON.stringify(data))
  538. } catch (error) {
  539. console.log('运行失败', error)
  540. }
  541. }
  542. // testgetDataByTask('mC56nNhM4o', 'getActor')
  543. // testgetActor()
  544. /**测试动作模仿接口 */
  545. async function testgetActor() {
  546. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getActor'
  547. try {
  548. let a = await fetch(url, {
  549. "headers": {
  550. "Content-Type": "application/json",
  551. },
  552. "method": 'POST',
  553. "mode": "cors",
  554. "referrer": "http://localhost:4200/",
  555. body: JSON.stringify({
  556. video_url: 'https://file-cloud.fmode.cn/storage/company/UEoqWqwz8f/20251121/023425380.mp4',
  557. image_url: 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg',
  558. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  559. })
  560. })
  561. let data = await a.json()
  562. console.log('运行成功', data)
  563. } catch (error) {
  564. console.log('运行失败', error)
  565. }
  566. }
  567. // testgetActorV2()
  568. // testgetDataByTask('6QMQVuYMYN', 'getActorV2')
  569. /**测试动作模仿v2.0 */
  570. async function testgetActorV2() {
  571. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getActorV2'
  572. try {
  573. let a = await fetch(url, {
  574. headers: { 'Content-Type': 'application/json' },
  575. method: 'POST',
  576. mode: 'cors',
  577. referrer: 'http://localhost:4200/',
  578. body: JSON.stringify({
  579. image_url: 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250829/050458620.jpg',
  580. video_url: 'https://file-cloud.fmode.cn/storage/company/UEoqWqwz8f/20251121/023425380.mp4',
  581. cut_result_first_second_switch: false,
  582. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  583. })
  584. })
  585. let data = await a.json()
  586. console.log('运行成功', data)
  587. } catch (error) {
  588. console.log('运行失败', error)
  589. }
  590. }
  591. // testGetOhIdentifyMain()//qH58sm1wMr
  592. // testGetOhDateByTask('qH58sm1wMr','getOhIdentifyMain')
  593. // testGetOhDetectMain('qH58sm1wMr')
  594. // testGetOmniHuman('qH58sm1wMr')
  595. // testGetOhDateByTask('qH58sm1wMr','getOmniHuman')
  596. //测试数字人接口
  597. async function testGetOhIdentifyMain() {
  598. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getOhIdentifyMain'
  599. try {
  600. let a = await fetch(url, {
  601. headers: { 'Content-Type': 'application/json' },
  602. method: 'POST',
  603. mode: 'cors',
  604. referrer: 'http://localhost:4200/',
  605. body: JSON.stringify({
  606. image_url: 'https://file-cloud.fmode.cn/storage/company/sV8QE3WJUS/20250723/030012209.jpg',
  607. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  608. })
  609. })
  610. let data = await a.json()
  611. console.log('运行成功', data)
  612. } catch (error) {
  613. console.log('运行失败', error)
  614. }
  615. }
  616. async function testGetOhDetectMain(workId) {
  617. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getOhDetectMain'
  618. try {
  619. let a = await fetch(url, {
  620. headers: { 'Content-Type': 'application/json' },
  621. method: 'POST',
  622. mode: 'cors',
  623. referrer: 'http://localhost:4200/',
  624. body: JSON.stringify({
  625. workId,
  626. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  627. })
  628. })
  629. let data = await a.json()
  630. console.log('运行成功', data)
  631. } catch (error) {
  632. console.log('运行失败', error)
  633. }
  634. }
  635. async function testGetOmniHuman(workId) {
  636. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getOmniHuman'
  637. try {
  638. let a = await fetch(url, {
  639. headers: { 'Content-Type': 'application/json' },
  640. method: 'POST',
  641. mode: 'cors',
  642. referrer: 'http://localhost:4200/',
  643. body: JSON.stringify({
  644. workId,
  645. audio_url: 'https://file-cloud.fmode.cn/storage/company/UEoqWqwz8f/20251126/103708457.mp3',
  646. prompt: '数字人朗读测试',
  647. pe_fast_mode: false,
  648. mask_url:[],
  649. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  650. })
  651. })
  652. let data = await a.json()
  653. console.log('运行成功', data)
  654. } catch (error) {
  655. console.log('运行失败', error)
  656. }
  657. }
  658. async function testGetOhDateByTask(workId, routerName, logo_info) {
  659. let url = 'https://server.fmode.cn/api/volcengine/jimeng/getOhDateByTask'
  660. try {
  661. let a = await fetch(url, {
  662. headers: { 'Content-Type': 'application/json' },
  663. method: 'POST',
  664. mode: 'cors',
  665. referrer: 'http://localhost:4200/',
  666. body: JSON.stringify({
  667. workId,
  668. routerName,
  669. logo_info,
  670. token: `Bearer r:f0333969e312a40e4703e8fe4ed1c600`
  671. })
  672. })
  673. let data = await a.json()
  674. console.log('运行成功', data)
  675. } catch (error) {
  676. console.log('运行失败', error)
  677. }
  678. }