使用ES API获取服务器地址和端口

This commit is contained in:
zhangkeyang 2024-04-26 11:21:35 +08:00
parent f7b65feb6b
commit e33a94bd72
1 changed files with 5 additions and 5 deletions

View File

@ -238,7 +238,7 @@ function uploadFile(index, file) {
var formData = new FormData();
formData.append('file', file);
$.ajax({
url: 'http://127.0.0.1:8000/upload',
url: `http://${window.location.hostname}:${window.location.port}/upload`,
type: 'POST',
data: formData,
processData: false, // 不处理发送的数据
@ -284,7 +284,7 @@ function uploadFile(index, file) {
*/
function playFile(index, file, id) {
$('#video-modal').find('.modal-title').text(`预览${file ? file.name : '此视频'}的关键镜头`);
$('#video-modal').find('video').attr('src', `http://127.0.0.1:8000/fetch/${id}`);
$('#video-modal').find('video').attr('src', `http://${window.location.hostname}:${window.location.port}/fetch/${id}`);
var player = new Plyr('video');
$('#video-modal').on('hidden.bs.modal', function(event) {
player.pause();
@ -303,7 +303,7 @@ function extractFile(index, file, id) {
var formData = new FormData();
formData.append('id', id);
$.ajax({
url: 'http://127.0.0.1:8000/extract',
url: `http://${window.location.hostname}:${window.location.port}/extract`,
type: 'POST',
data: formData,
processData: false, // 不处理发送的数据
@ -331,7 +331,7 @@ function analyseFile(index, file, id) {
var formData = new FormData();
formData.append('id', id);
$.ajax({
url: 'http://127.0.0.1:8000/analyse',
url: `http://${window.location.hostname}:${window.location.port}/analyse`,
type: 'POST',
data: formData,
processData: false, // 不处理发送的数据
@ -359,7 +359,7 @@ function generateFile(index, file, id) {
var formData = new FormData();
formData.append('id', id);
$.ajax({
url: 'http://127.0.0.1:8000/generate',
url: `http://${window.location.hostname}:${window.location.port}/generate`,
type: 'POST',
data: formData,
processData: false, // 不处理发送的数据