Updated to 0.7.1 (#9)

This commit is contained in:
kwaroran
2023-05-08 00:51:29 +09:00
committed by GitHub
5 changed files with 213 additions and 156 deletions

View File

@@ -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}}
}
})();

View File

@@ -8,7 +8,7 @@
},
"package": {
"productName": "RisuAI",
"version": "0.7.0"
"version": "0.7.1"
},
"tauri": {
"allowlist": {

View File

@@ -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."
},

View File

@@ -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){

View File

@@ -1 +1 @@
{"version":"0.7.0"}
{"version":"0.7.1"}