xvai-loi 0.1.86 → 0.1.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/co.txt +1 -1
- package/package.json +1 -1
- package/xvai-loi.js +26 -7
package/co.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
xvaiLoi120538
|
package/package.json
CHANGED
package/xvai-loi.js
CHANGED
|
@@ -11549,6 +11549,12 @@ function lapCuongMe(o) {
|
|
|
11549
11549
|
the0(a, a + (t1 - t0), d);
|
|
11550
11550
|
};
|
|
11551
11551
|
const F = (fa, fb) => matRa(fm, nguon3(fa), nguon3(fb), [0, 0, 0, 0], 1, zc);
|
|
11552
|
+
const yenMat = (fa, fb) => {
|
|
11553
|
+
const a0 = nguon3(fa), b0 = nguon3(fb), ss = (fm || []).filter((x) => x && x.face && x.t >= a0 && x.t <= b0).map((x) => x.face);
|
|
11554
|
+
if (ss.length < 2) return true;
|
|
11555
|
+
const cx = ss.map((q) => q.x + q.w / 2), cy = ss.map((q) => q.y + q.h / 2), hh = ss.map((q) => q.h);
|
|
11556
|
+
return Math.max(...cx) - Math.min(...cx) <= 0.12 && Math.max(...cy) - Math.min(...cy) <= 0.08 && Math.max(...hh) / Math.max(1e-6, Math.min(...hh)) <= 1.35;
|
|
11557
|
+
};
|
|
11552
11558
|
const tyLeMat = (fa, fb) => {
|
|
11553
11559
|
const a0 = nguon3(fa), b0 = nguon3(fb), ss = (fm || []).filter((x) => x && x.t >= a0 && x.t <= b0);
|
|
11554
11560
|
return ss.length ? ss.filter((x) => x.face).length / ss.length : 0;
|
|
@@ -11953,7 +11959,7 @@ function lapCuongMe(o) {
|
|
|
11953
11959
|
if (x.kieu === "anh" && dV) {
|
|
11954
11960
|
de(f2, dV, { uuTien: UT.so + 5, bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh", video: 1 }, 3, datAnh);
|
|
11955
11961
|
ghiL("video", { bo: "anh", f: f2, d: dV }, "kho video: ung vien clip " + dV.toFixed(1) + " s thay anh: " + String(x.tu || ""));
|
|
11956
|
-
} else if (x.kieu === "anh" && (co || chuK)) de(f2, (f2 < f1 ? 2 : 2.4) * kTram(), { uuTien: UT.anh, ...co ? ((o2) => x.khuon ? { ...o2, keu: "" } : o2)(nAnh++ % 3 === 0 || !((fb) => fb && fb[3] - fb[1] < KHUON_TOPN.nguoi.matToiDa)(F(f2, f2 + 2.4)) || tyLeMat(f2, f2 + 2.4) < 0.7 ? { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh" } : (nAnh - 1) % 3 === 1 ? { bo: "chia", ten: ten2, chu: chuK, keu: "whoosh" } : { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, pip: 1, keu: "whoosh" }) : { bo: "kinh", dong: [chuK, chu22].filter(Boolean), keu: "whoosh" } }, 3, datAnh);
|
|
11962
|
+
} else if (x.kieu === "anh" && (co || chuK)) de(f2, (f2 < f1 ? 2 : 2.4) * kTram(), { uuTien: UT.anh, ...co ? ((o2) => x.khuon ? { ...o2, keu: "" } : o2)(nAnh++ % 3 === 0 || !((fb) => fb && fb[3] - fb[1] < KHUON_TOPN.nguoi.matToiDa)(F(f2, f2 + 2.4)) || tyLeMat(f2, f2 + 2.4) < 0.7 || !yenMat(f2, f2 + 3.6) ? { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh" } : (nAnh - 1) % 3 === 1 ? { bo: "chia", ten: ten2, chu: chuK, keu: "whoosh" } : { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, pip: 1, keu: "whoosh" }) : { bo: "kinh", dong: [chuK, chu22].filter(Boolean), keu: "whoosh" } }, 3, datAnh);
|
|
11957
11963
|
else if (x.kieu === "vat") {
|
|
11958
11964
|
const LG = timLogo(suaChu(chuK + " " + sach3(String(x.tu || ""))))[0];
|
|
11959
11965
|
if (LG) napHinhLogo(LG.slug);
|
|
@@ -16023,7 +16029,12 @@ var MontagePanel = ({ project, onUpdate, onExport }) => {
|
|
|
16023
16029
|
var parse2 = (text2) => {
|
|
16024
16030
|
const a = text2.indexOf("{"), b = text2.lastIndexOf("}");
|
|
16025
16031
|
if (a < 0 || b < a) throw new Error("AI ch\u01B0a tr\u1EA3 d\u1EEF li\u1EC7u l\u1EDDi n\xF3i.");
|
|
16026
|
-
|
|
16032
|
+
const t = text2.slice(a, b + 1);
|
|
16033
|
+
try {
|
|
16034
|
+
return JSON.parse(t);
|
|
16035
|
+
} catch (e) {
|
|
16036
|
+
return JSON.parse(t.replace(/([{,]\s*)([A-Za-z_][A-Za-z0-9_]*)\s*:/g, '$1"$2":').replace(/,\s*([}\]])/g, "$1"));
|
|
16037
|
+
}
|
|
16027
16038
|
};
|
|
16028
16039
|
async function analyzeSpeech(project, scene, item, request, onProgress, onCache, cancel, templateMode = false, dense = false, boNhan = false) {
|
|
16029
16040
|
const active = () => {
|
|
@@ -16054,10 +16065,18 @@ async function analyzeSpeech(project, scene, item, request, onProgress, onCache,
|
|
|
16054
16065
|
let part = cached[n];
|
|
16055
16066
|
if (!part) {
|
|
16056
16067
|
const prompt = "Ch\xE9p CH\xCDNH X\xC1C ti\u1EBFng Vi\u1EC7t nghe \u0111\u01B0\u1EE3c, kh\xF4ng vi\u1EBFt l\u1EA1i, kh\xF4ng th\xEAm l\u1EDDi t\u1EEB ki\u1EBFn th\u1EE9c. Ch\u1ED7 im l\u1EB7ng/nh\u1EA1c kh\xF4ng c\xF3 l\u1EDDi tr\u1EA3 r\u1ED7ng. Tr\u1EA3 JSON {words:[{t0,t1,text}],unclear:[]}. M\u1ED7i text l\xE0 m\u1ED9t ti\u1EBFng/t\u1EEB nghe \u0111\u01B0\u1EE3c, timestamp gi\xE2y t\xEDnh t\u1EEB \u0111\u1EA7u t\u1EC7p \xE2m thanh n\xE0y, t\u0103ng d\u1EA7n, kh\xF4ng ch\u1ED3ng, trong 0.." + (b - a).toFixed(3) + ". Kh\xF4ng g\u1ED9p c\xE2u v\xE0o m\u1ED9t t\u1EEB. Gi\u1EEF t\xEAn ri\xEAng v\xE0 d\u1EA5u ti\u1EBFng Vi\u1EC7t. N\u1EBFu kh\xF4ng ch\u1EAFc ghi unclear, kh\xF4ng b\u1ECBa.";
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16068
|
+
let parsed = null;
|
|
16069
|
+
for (let lan2 = 0; lan2 < 2 && !parsed; lan2++) {
|
|
16070
|
+
const result = await Flow.generate.text(prompt, { audios: [{ base64: wav64(pcm.subarray(Math.round(a * 16e3), Math.round(b * 16e3))), mimeType: "audio/wav" }], thinkingLevel: "medium" });
|
|
16071
|
+
calls++;
|
|
16072
|
+
active();
|
|
16073
|
+
try {
|
|
16074
|
+
parsed = parse2(result.text);
|
|
16075
|
+
} catch (e) {
|
|
16076
|
+
if (lan2) throw e;
|
|
16077
|
+
}
|
|
16078
|
+
}
|
|
16079
|
+
const valid2 = validateWords(parsed.words, 0, b - a);
|
|
16061
16080
|
part = { start, end, words: valid2.map((w) => ({ ...w, t0: w.t0 + a, t1: w.t1 + a })).filter((w) => (w.t0 + w.t1) / 2 >= start && (w.t0 + w.t1) / 2 < end), unclear: Array.isArray(parsed.unclear) ? parsed.unclear : [] };
|
|
16062
16081
|
}
|
|
16063
16082
|
parts.push(part);
|
|
@@ -21003,7 +21022,7 @@ function datCauLenh(a) {
|
|
|
21003
21022
|
on2 = true;
|
|
21004
21023
|
window.addEventListener("message", async (ev) => {
|
|
21005
21024
|
const d = ev.data;
|
|
21006
|
-
if (!d || d.
|
|
21025
|
+
if (!d || d.xvaiLoi120538 !== true) return;
|
|
21007
21026
|
const o = String(ev.origin || "");
|
|
21008
21027
|
if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
|
|
21009
21028
|
const tra = (kq) => {
|