V2.2.8
This commit is contained in:
parent
f27ec08724
commit
3774e9fe55
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,6 +11,7 @@ resources/scripts/lama/dist
|
|||||||
resources/scripts/lama/build
|
resources/scripts/lama/build
|
||||||
resources/scripts/lama/lama_inpaint.exe
|
resources/scripts/lama/lama_inpaint.exe
|
||||||
resources/scripts/virtual py
|
resources/scripts/virtual py
|
||||||
|
resources/scripts/_internal
|
||||||
resources/logger
|
resources/logger
|
||||||
resources/scripts/Temp
|
resources/scripts/Temp
|
||||||
resources/image/Temp*
|
resources/image/Temp*
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "laitool",
|
"name": "laitool",
|
||||||
"version": "2.2.7",
|
"version": "2.2.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "laitool",
|
"name": "laitool",
|
||||||
"version": "2.2.7",
|
"version": "2.2.8",
|
||||||
"description": "An Electron application with Vue",
|
"description": "An Electron application with Vue",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "example.com",
|
"author": "example.com",
|
||||||
@ -77,11 +77,14 @@
|
|||||||
"!resources/"
|
"!resources/"
|
||||||
],
|
],
|
||||||
"extraResources": [
|
"extraResources": [
|
||||||
"resources/package/**",
|
"resources/package/exittool/**",
|
||||||
|
"resources/package/ffmpeg-2023-12-07-git-f89cff96d0-full_build/**",
|
||||||
|
"resources/package/Improve/**",
|
||||||
"resources/image/style/**",
|
"resources/image/style/**",
|
||||||
"resources/image/zhanwei.png",
|
"resources/image/zhanwei.png",
|
||||||
"resources/scripts/model/**",
|
"resources/scripts/model/**",
|
||||||
"resources/scripts/Lai.exe",
|
"resources/scripts/Lai.exe",
|
||||||
|
"resources/scripts/_internal/**",
|
||||||
"resources/scripts/lama/lama_inpaint.exe",
|
"resources/scripts/lama/lama_inpaint.exe",
|
||||||
"resources/scripts/lama/model/**",
|
"resources/scripts/lama/model/**",
|
||||||
"resources/scripts/discordScript.js",
|
"resources/scripts/discordScript.js",
|
||||||
@ -92,4 +95,4 @@
|
|||||||
"icon": "./resources/icon.ico"
|
"icon": "./resources/icon.ico"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
resources/image/c_s/36c7fea1-5747-41c8-a624-14a29a504585.png
Normal file
BIN
resources/image/c_s/36c7fea1-5747-41c8-a624-14a29a504585.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@ -3,10 +3,10 @@
|
|||||||
from PyInstaller.building.datastruct import Tree
|
from PyInstaller.building.datastruct import Tree
|
||||||
from PyInstaller.utils.hooks import get_package_paths
|
from PyInstaller.utils.hooks import get_package_paths
|
||||||
|
|
||||||
|
|
||||||
PACKAGE_DIRECTORY = get_package_paths('faster_whisper')[1]
|
PACKAGE_DIRECTORY = get_package_paths('faster_whisper')[1]
|
||||||
datas = [(PACKAGE_DIRECTORY, 'faster_whisper')]
|
datas = [(PACKAGE_DIRECTORY, 'faster_whisper')]
|
||||||
|
|
||||||
|
|
||||||
a = Analysis(
|
a = Analysis(
|
||||||
['Lai.py'],
|
['Lai.py'],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
@ -24,16 +24,13 @@ pyz = PYZ(a.pure)
|
|||||||
exe = EXE(
|
exe = EXE(
|
||||||
pyz,
|
pyz,
|
||||||
a.scripts,
|
a.scripts,
|
||||||
a.binaries,
|
|
||||||
a.datas,
|
|
||||||
[],
|
[],
|
||||||
|
exclude_binaries=True,
|
||||||
name='Lai',
|
name='Lai',
|
||||||
debug=False,
|
debug=False,
|
||||||
bootloader_ignore_signals=False,
|
bootloader_ignore_signals=False,
|
||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
upx_exclude=[],
|
|
||||||
runtime_tmpdir=None,
|
|
||||||
console=True,
|
console=True,
|
||||||
disable_windowed_traceback=False,
|
disable_windowed_traceback=False,
|
||||||
argv_emulation=False,
|
argv_emulation=False,
|
||||||
@ -41,3 +38,12 @@ exe = EXE(
|
|||||||
codesign_identity=None,
|
codesign_identity=None,
|
||||||
entitlements_file=None,
|
entitlements_file=None,
|
||||||
)
|
)
|
||||||
|
coll = COLLECT(
|
||||||
|
exe,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
name='Lai',
|
||||||
|
)
|
||||||
|
|||||||
43
resources/scripts/Lai_1.spec
Normal file
43
resources/scripts/Lai_1.spec
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
from PyInstaller.building.datastruct import Tree
|
||||||
|
from PyInstaller.utils.hooks import get_package_paths
|
||||||
|
|
||||||
|
|
||||||
|
PACKAGE_DIRECTORY = get_package_paths('faster_whisper')[1]
|
||||||
|
datas = [(PACKAGE_DIRECTORY, 'faster_whisper')]
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['Lai.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=datas,
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='Lai',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
)
|
||||||
@ -245,10 +245,8 @@ class Clip:
|
|||||||
command.append("-c:v")
|
command.append("-c:v")
|
||||||
command.append("h264_cuvid") # 使用 NVIDIA CUVID 解码器进行解码
|
command.append("h264_cuvid") # 使用 NVIDIA CUVID 解码器进行解码
|
||||||
elif self.gpu_type == "AMD":
|
elif self.gpu_type == "AMD":
|
||||||
command.append("-hwaccel")
|
|
||||||
command.append("vaapi")
|
|
||||||
command.append("-c:v")
|
command.append("-c:v")
|
||||||
command.append("h264_vaapi")
|
command.append("h264")
|
||||||
command.append("-i")
|
command.append("-i")
|
||||||
command.append(random_path)
|
command.append(random_path)
|
||||||
command.append("-ss")
|
command.append("-ss")
|
||||||
@ -266,7 +264,7 @@ class Clip:
|
|||||||
if self.gpu_type == "NVIDIA":
|
if self.gpu_type == "NVIDIA":
|
||||||
command.append("h264_nvenc")
|
command.append("h264_nvenc")
|
||||||
elif self.gpu_type == "AMD":
|
elif self.gpu_type == "AMD":
|
||||||
command.append("h264_vaapi")
|
command.append("h264_amf")
|
||||||
else:
|
else:
|
||||||
command.append("libx264")
|
command.append("libx264")
|
||||||
command.append("-preset")
|
command.append("-preset")
|
||||||
@ -485,7 +483,7 @@ class Clip:
|
|||||||
if self.gpu_type == "NVIDIA":
|
if self.gpu_type == "NVIDIA":
|
||||||
command.append("h264_nvenc")
|
command.append("h264_nvenc")
|
||||||
elif self.gpu_type == "AMD":
|
elif self.gpu_type == "AMD":
|
||||||
command.append("h264_vaapi")
|
command.append("h264_amf")
|
||||||
else:
|
else:
|
||||||
command.append("libx264")
|
command.append("libx264")
|
||||||
|
|
||||||
|
|||||||
@ -473,7 +473,7 @@ class ImageToVideo:
|
|||||||
if self.gpu_type == "NVIDIA":
|
if self.gpu_type == "NVIDIA":
|
||||||
cmd.append("h264_nvenc")
|
cmd.append("h264_nvenc")
|
||||||
elif self.gpu_type == "AMD":
|
elif self.gpu_type == "AMD":
|
||||||
cmd.append("h264_vaapi")
|
cmd.append("h264_amf")
|
||||||
else:
|
else:
|
||||||
cmd.append("libx264")
|
cmd.append("libx264")
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ def ClipVideo(video_path, out_folder, image_out_folder, sensitivity, gpu_type):
|
|||||||
if gpu_type == "NVIDIA":
|
if gpu_type == "NVIDIA":
|
||||||
command.append("h264_nvenc")
|
command.append("h264_nvenc")
|
||||||
elif gpu_type == "AMD":
|
elif gpu_type == "AMD":
|
||||||
command.append("h264_vaapi")
|
command.append("h264_amf")
|
||||||
else:
|
else:
|
||||||
command.append("libx264")
|
command.append("libx264")
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
const { net } = require('electron');
|
const { net } = require('electron');
|
||||||
|
|
||||||
|
function isString(contentType) {
|
||||||
|
return contentType.startsWith('text/plain') || contentType.startsWith('application/json');
|
||||||
|
}
|
||||||
|
|
||||||
let basicApi = {
|
let basicApi = {
|
||||||
/**
|
/**
|
||||||
* 使用electron的net模块实现的get方法
|
* 使用electron的net模块实现的get方法
|
||||||
@ -12,9 +16,27 @@ let basicApi = {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const request = net.request({ url, method: 'GET', headers });
|
const request = net.request({ url, method: 'GET', headers });
|
||||||
request.on('response', (response) => {
|
request.on('response', (response) => {
|
||||||
let data = '';
|
let data;
|
||||||
|
if (isString(response.headers["content-type"])) {
|
||||||
|
data = '';
|
||||||
|
} else if (response.headers["content-type"].startsWith("image/")) {
|
||||||
|
// 处理图片数据
|
||||||
|
data = []
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error("未知的请求返回数据类型");
|
||||||
|
}
|
||||||
|
|
||||||
response.on('data', (chunk) => {
|
response.on('data', (chunk) => {
|
||||||
data += chunk;
|
if (isString(response.headers["content-type"])) {
|
||||||
|
// 处理 JSON 数据
|
||||||
|
data += chunk;
|
||||||
|
} else if (response.headers['content-type'].startsWith('image/')) {
|
||||||
|
// 处理图片数据
|
||||||
|
data.push(chunk);
|
||||||
|
} else {
|
||||||
|
throw new Error("未知的请求返回数据类型");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
response.on('end', () => {
|
response.on('end', () => {
|
||||||
// 结束的时候检查请求的状态码,是不是成功的请求,不是返回错误,有些其他的状态码也是成功的请求,并且返回错误提示
|
// 结束的时候检查请求的状态码,是不是成功的请求,不是返回错误,有些其他的状态码也是成功的请求,并且返回错误提示
|
||||||
@ -24,10 +46,13 @@ let basicApi = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let parsedData;
|
let parsedData;
|
||||||
if (response.headers['content-type'].includes('application/json')) {
|
if (isString(response.headers["content-type"])) {
|
||||||
parsedData = JSON.parse(data);
|
parsedData = JSON.parse(data);
|
||||||
|
} else if (response.headers['content-type'].startsWith('image/')) {
|
||||||
|
// parsedData = responseData;
|
||||||
|
parsedData = Buffer.concat(data);
|
||||||
} else {
|
} else {
|
||||||
parsedData = data;
|
throw new Error("未知的请求返回数据类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
@ -71,8 +96,7 @@ let basicApi = {
|
|||||||
|
|
||||||
request.on('response', (response) => {
|
request.on('response', (response) => {
|
||||||
let responseData;
|
let responseData;
|
||||||
if (response.headers["content-type"] === "application/json") {
|
if (isString(response.headers["content-type"])) {
|
||||||
|
|
||||||
responseData = '';
|
responseData = '';
|
||||||
} else if (response.headers["content-type"].startsWith("image/")) {
|
} else if (response.headers["content-type"].startsWith("image/")) {
|
||||||
// 处理图片数据
|
// 处理图片数据
|
||||||
@ -83,12 +107,14 @@ let basicApi = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response.on('data', (chunk) => {
|
response.on('data', (chunk) => {
|
||||||
if (response.headers['content-type'] === 'application/json') {
|
if (isString(response.headers["content-type"])) {
|
||||||
// 处理 JSON 数据
|
// 处理 JSON 数据
|
||||||
responseData += chunk;
|
responseData += chunk;
|
||||||
} else if (response.headers['content-type'].startsWith('image/')) {
|
} else if (response.headers['content-type'].startsWith('image/')) {
|
||||||
// 处理图片数据
|
// 处理图片数据
|
||||||
responseData.push(chunk);
|
responseData.push(chunk);
|
||||||
|
} else {
|
||||||
|
throw new Error("未知的请求返回数据类型");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -99,7 +125,7 @@ let basicApi = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let parsedData;
|
let parsedData;
|
||||||
if (response.headers['content-type'].includes('application/json')) {
|
if (isString(response.headers["content-type"])) {
|
||||||
parsedData = JSON.parse(responseData);
|
parsedData = JSON.parse(responseData);
|
||||||
} else if (response.headers['content-type'].startsWith('image/')) {
|
} else if (response.headers['content-type'].startsWith('image/')) {
|
||||||
// parsedData = responseData;
|
// parsedData = responseData;
|
||||||
|
|||||||
@ -88,7 +88,13 @@ export class DiscordAPI {
|
|||||||
res_data = JSON.parse(res_data);
|
res_data = JSON.parse(res_data);
|
||||||
}
|
}
|
||||||
if (res_data && res_data.code != 1) {
|
if (res_data && res_data.code != 1) {
|
||||||
throw new Error(res_data.message);
|
if (res_data.message) {
|
||||||
|
throw new Error(res_data.message);
|
||||||
|
} else if (res_data.description) {
|
||||||
|
throw new Error(res_data.description)
|
||||||
|
} else {
|
||||||
|
throw new Error("未知错误,可联系管理员排查");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res_data;
|
return res_data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -277,14 +277,14 @@ export class MJOriginalImageGenerate {
|
|||||||
let imagine_url = apiUrl.mj_url.imagine;
|
let imagine_url = apiUrl.mj_url.imagine;
|
||||||
let once_get_task = apiUrl.mj_url.once_get_task;
|
let once_get_task = apiUrl.mj_url.once_get_task;
|
||||||
let task_count = mjSetting.task_count ? mjSetting.task_count : 3;
|
let task_count = mjSetting.task_count ? mjSetting.task_count : 3;
|
||||||
let request_model = mjSetting.request_model ? mjSetting.request_model : "relaxed";
|
let mj_speed = mjSetting.mj_speed ? mjSetting.mj_speed : "relaxed";
|
||||||
let res;
|
let res;
|
||||||
// 判断当前的API是哪个
|
// 判断当前的API是哪个
|
||||||
if (imagine_url.includes("mjapi.deepwl.net")) {
|
if (imagine_url.includes("mjapi.deepwl.net")) {
|
||||||
// DrawAPI(MJ)
|
// DrawAPI(MJ)
|
||||||
let data = {
|
let data = {
|
||||||
prompt: prompt,
|
prompt: prompt,
|
||||||
mode: request_model == "fast" ? "FAST" : "RELAX",
|
mode: mj_speed == "fast" ? "FAST" : "RELAX",
|
||||||
}
|
}
|
||||||
let headers = {
|
let headers = {
|
||||||
"Authorization": mjSetting.api_key
|
"Authorization": mjSetting.api_key
|
||||||
@ -300,7 +300,7 @@ export class MJOriginalImageGenerate {
|
|||||||
botType: "MID_JOURNEY",
|
botType: "MID_JOURNEY",
|
||||||
accountFilter: {
|
accountFilter: {
|
||||||
modes: [
|
modes: [
|
||||||
request_model == "fast" ? "FAST" : "RELAX"
|
mj_speed == "fast" ? "FAST" : "RELAX"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ export class SD {
|
|||||||
return successMessage(data);
|
return successMessage(data);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return errorMessage(error.toString());
|
return errorMessage("加载数据失败,错误信息如下:" +error.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user