From ea03a1f17a6dab5414be62c0ec20177107fd8423 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Mon, 8 May 2023 00:47:36 +0900 Subject: [PATCH 1/3] [fix] fixed some strings --- src/lang/en.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lang/en.ts b/src/lang/en.ts index db40da85..01476fc2 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -44,7 +44,7 @@ export const languageEnglish = { bias:"bias is a key-value data which modifies the likelihood of string appearing.\nit can be -100 to 100, higher values will be more likely to appear, and lower values will be more unlikely to appear \nWarning: if the tokenizer is wrong, it not work properly.", emotion: "Emotion Images option shows image depending at character's emotion which is analized by character's response. you must input emotion name as words *(like joy, happy, fear and etc.)* .emotion named **netural** will be default emotion if it exists. must be more then 3 images to work properly.", imggen: "Image Generation option generates and shows image from external program. the image is generated by image prompt, which is made by analizing current chat. \n\n image generation is analized based on key-value arguments, which are configarable in below." - + "\n\n**'always'** key applys always, and dosen't changes. **'negative'** key applys always in negative value for image generation." + + "\n\Zn**'always'** key applys always, and dosen't changes. **'negative'** key applys always in negative value for image generation." + "\n\nobjects with other key's value will change according to the key's name as the chat progresses." + "\n\nIf a key has a special character in front of its name, it has a special effect." + "\n- if the key starts with **|**, the key's value will not change." @@ -55,7 +55,7 @@ export const languageEnglish = { + "- **Modify Input** modifys user's input" + "- **Modify Output** modifys character's output" + "- **Modify Request Data** modifys current chat data when sent.\n\nIN must be a regex without flags and *\\*.\n\nOUT is a normal string." - + "\n\n If OUT starts with @@, it doesn't replaces the string, but instead does a special effect if matching string founds." + + "\n\n If OUT starts with **@@**, it doesn't replaces the string, but instead does a special effect if matching string founds." + "\n\n- @@emo (emotion name)\n\n if character is Emotion Images mode, sets (emotion name) as emotion and prevents default.", experimental: "This is a experimental setting. it might be unstable." }, From 30fc620385e5853a80f59fd6c9321976340f4f15 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Mon, 8 May 2023 00:49:02 +0900 Subject: [PATCH 2/3] [fix] pluginApi not compiled --- public/pluginApi.js | 359 +++++++++++++++++++++++++------------------- 1 file changed, 208 insertions(+), 151 deletions(-) diff --git a/public/pluginApi.js b/public/pluginApi.js index ba34eaec..d903acff 100644 --- a/public/pluginApi.js +++ b/public/pluginApi.js @@ -1,3 +1,14 @@ +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -34,163 +45,209 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; -var __risuPlugin__ = { - providers: [], - fetchResponseQueue: [] -}; -var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); }; -function risuFetch(url, arg) { - return __awaiter(this, void 0, void 0, function () { - var id, i, q; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - id = "".concat(Date.now(), "_").concat(Math.random()); - postMessage({ - type: 'fetch', - body: { - id: id, - url: url, - arg: arg +(function () { + var __risuPlugin__ = { + providers: [], + fetchResponseQueue: [] + }; + var sleep = function (ms) { return new Promise(function (r) { return setTimeout(r, ms); }); }; + function transferDataAsync(type, body) { + return __awaiter(this, void 0, void 0, function () { + var id, i, q; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + id = "".concat(Date.now(), "_").concat(Math.random()); + postMessage({ + type: 'fetch', + body: __assign({ id: id }, body) + }); + _a.label = 1; + case 1: + if (!true) return [3 /*break*/, 3]; + return [4 /*yield*/, sleep(50)]; + case 2: + _a.sent(); + for (i = 0; i < __risuPlugin__.fetchResponseQueue.length; i++) { + q = __risuPlugin__.fetchResponseQueue[i]; + if (q.id === id) { + __risuPlugin__.fetchResponseQueue.splice(i, 1); + return [2 /*return*/, q.data]; + } } - }); - _a.label = 1; - case 1: - if (!true) return [3 /*break*/, 3]; - return [4 /*yield*/, sleep(50)]; - case 2: - _a.sent(); - for (i = 0; i < __risuPlugin__.fetchResponseQueue.length; i++) { - q = __risuPlugin__.fetchResponseQueue[i]; - if (q.id === id) { - __risuPlugin__.fetchResponseQueue.splice(i, 1); - return [2 /*return*/, q.data]; - } - } - return [3 /*break*/, 1]; - case 3: return [2 /*return*/]; - } + return [3 /*break*/, 1]; + case 3: return [2 /*return*/]; + } + }); }); - }); -} -function getArg(arg) { - return __awaiter(this, void 0, void 0, function () { - var id, i, q; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - id = "".concat(Date.now(), "_").concat(Math.random()); - postMessage({ - type: 'getArg', - body: { - id: id, - arg: arg + } + function risuFetch(url, arg) { + return __awaiter(this, void 0, void 0, function () { + var id, i, q; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + id = "".concat(Date.now(), "_").concat(Math.random()); + postMessage({ + type: 'fetch', + body: { + id: id, + url: url, + arg: arg + } + }); + _a.label = 1; + case 1: + if (!true) return [3 /*break*/, 3]; + return [4 /*yield*/, sleep(50)]; + case 2: + _a.sent(); + for (i = 0; i < __risuPlugin__.fetchResponseQueue.length; i++) { + q = __risuPlugin__.fetchResponseQueue[i]; + if (q.id === id) { + __risuPlugin__.fetchResponseQueue.splice(i, 1); + return [2 /*return*/, q.data]; + } } - }); - _a.label = 1; - case 1: - if (!true) return [3 /*break*/, 3]; - return [4 /*yield*/, sleep(50)]; - case 2: - _a.sent(); - for (i = 0; i < __risuPlugin__.fetchResponseQueue.length; i++) { - q = __risuPlugin__.fetchResponseQueue[i]; - if (q.id === id) { - __risuPlugin__.fetchResponseQueue.splice(i, 1); - return [2 /*return*/, q.data]; - } - } - return [3 /*break*/, 1]; - case 3: return [2 /*return*/]; - } + return [3 /*break*/, 1]; + case 3: return [2 /*return*/]; + } + }); }); - }); -} -function addProvider(name, func) { - postMessage({ - type: 'addProvider', - body: name - }); - __risuPlugin__.providers.push({ - name: name, - func: func - }); -} -function printLog(data) { - postMessage({ - type: 'log', - body: data - }); -} -function handleOnmessage(data) { - return __awaiter(this, void 0, void 0, function () { - var _a, body, providers, providerfunc, _i, providers_1, provider, _b, error_1; - var _c; - return __generator(this, function (_d) { - switch (_d.label) { - case 0: - if (!data.type) { - return [2 /*return*/]; - } - _a = data.type; - switch (_a) { - case "requestProvider": return [3 /*break*/, 1]; - case "fetchData": return [3 /*break*/, 6]; - } - return [3 /*break*/, 7]; - case 1: - body = data.body; - providers = __risuPlugin__.providers; - providerfunc = null; - for (_i = 0, providers_1 = providers; _i < providers_1.length; _i++) { - provider = providers_1[_i]; - if (provider.name === body.key) { - providerfunc = provider.func; + } + function getArg(arg) { + return __awaiter(this, void 0, void 0, function () { + var id, i, q; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + id = "".concat(Date.now(), "_").concat(Math.random()); + postMessage({ + type: 'getArg', + body: { + id: id, + arg: arg + } + }); + _a.label = 1; + case 1: + if (!true) return [3 /*break*/, 3]; + return [4 /*yield*/, sleep(50)]; + case 2: + _a.sent(); + for (i = 0; i < __risuPlugin__.fetchResponseQueue.length; i++) { + q = __risuPlugin__.fetchResponseQueue[i]; + if (q.id === id) { + __risuPlugin__.fetchResponseQueue.splice(i, 1); + return [2 /*return*/, q.data]; + } } - } - if (!!providerfunc) return [3 /*break*/, 2]; - postMessage({ - type: 'resProvider', - body: { - 'success': false, - 'content': 'unknown provider' + return [3 /*break*/, 1]; + case 3: return [2 /*return*/]; + } + }); + }); + } + function addProvider(name, func) { + postMessage({ + type: 'addProvider', + body: name + }); + __risuPlugin__.providers.push({ + name: name, + func: func + }); + } + function printLog(data) { + postMessage({ + type: 'log', + body: data + }); + } + function getChar() { + return transferDataAsync('getChar', ''); + } + function setChar(char) { + postMessage({ + type: 'setChar', + body: char + }); + } + function handleOnmessage(data) { + return __awaiter(this, void 0, void 0, function () { + var _a, body, providers, providerfunc, _i, providers_1, provider, _b, error_1; + var _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + if (!data.type) { + return [2 /*return*/]; } - }); - return [3 /*break*/, 5]; - case 2: - _d.trys.push([2, 4, , 5]); - _b = postMessage; - _c = { - type: 'resProvider' - }; - return [4 /*yield*/, providerfunc(body.arg)]; - case 3: - _b.apply(void 0, [(_c.body = _d.sent(), - _c)]); - return [3 /*break*/, 5]; - case 4: - error_1 = _d.sent(); - postMessage({ - type: 'resProvider', - body: { - 'success': false, - 'content': "providerError: ".concat(error_1) + _a = data.type; + switch (_a) { + case "requestProvider": return [3 /*break*/, 1]; + case "fetchData": return [3 /*break*/, 6]; } - }); - return [3 /*break*/, 5]; - case 5: return [3 /*break*/, 7]; - case 6: - { - __risuPlugin__.fetchResponseQueue.push(data.body); return [3 /*break*/, 7]; - } - _d.label = 7; - case 7: return [2 /*return*/]; - } + case 1: + body = data.body; + providers = __risuPlugin__.providers; + providerfunc = null; + for (_i = 0, providers_1 = providers; _i < providers_1.length; _i++) { + provider = providers_1[_i]; + if (provider.name === body.key) { + providerfunc = provider.func; + } + } + if (!!providerfunc) return [3 /*break*/, 2]; + postMessage({ + type: 'resProvider', + body: { + 'success': false, + 'content': 'unknown provider' + } + }); + return [3 /*break*/, 5]; + case 2: + _d.trys.push([2, 4, , 5]); + _b = postMessage; + _c = { + type: 'resProvider' + }; + return [4 /*yield*/, providerfunc(body.arg)]; + case 3: + _b.apply(void 0, [(_c.body = _d.sent(), + _c)]); + return [3 /*break*/, 5]; + case 4: + error_1 = _d.sent(); + postMessage({ + type: 'resProvider', + body: { + 'success': false, + 'content': "providerError: ".concat(error_1) + } + }); + return [3 /*break*/, 5]; + case 5: return [3 /*break*/, 7]; + case 6: + { + __risuPlugin__.fetchResponseQueue.push(data.body); + return [3 /*break*/, 7]; + } + _d.label = 7; + case 7: return [2 /*return*/]; + } + }); }); - }); -} -onmessage = function (ev) { - handleOnmessage(ev.data); - var data = ev.data; -}; + } + onmessage = function (ev) { + handleOnmessage(ev.data); + var data = ev.data; + }; + { + var __risuPlugin__1 = null; + var transferDataAsync_1 = null; + //{{placeholder}} + } +})(); From 3f18d3627d496ac77d662abaf4b98eec323bc710 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Mon, 8 May 2023 00:49:43 +0900 Subject: [PATCH 3/3] update version to 0.7.1 --- src-tauri/tauri.conf.json | 2 +- src/ts/database.ts | 2 +- version.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index dd028581..6fc3de8b 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "RisuAI", - "version": "0.7.0" + "version": "0.7.1" }, "tauri": { "allowlist": { diff --git a/src/ts/database.ts b/src/ts/database.ts index 1203131d..c1b071fb 100644 --- a/src/ts/database.ts +++ b/src/ts/database.ts @@ -6,7 +6,7 @@ import { saveImage as saveImageGlobal } from './globalApi'; export const DataBase = writable({} as any as Database) export const loadedStore = writable(false) -export let appVer = '0.7.0' +export let appVer = '0.7.1' export function setDatabase(data:Database){ diff --git a/version.json b/version.json index 4ec93ab1..54a45e10 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{"version":"0.7.0"} +{"version":"0.7.1"}