revdev 0.327.0 → 0.329.0
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/lib/back/ai/entity.d.ts +7 -0
- package/lib/back/ai/entity.js +2 -0
- package/lib/back/ai/index.d.ts +2 -0
- package/lib/back/ai/index.js +18 -0
- package/lib/back/ai/request.d.ts +8 -0
- package/lib/back/ai/request.js +2 -0
- package/lib/back/index.d.ts +1 -0
- package/lib/back/index.js +1 -0
- package/lib/common/enums.d.ts +4 -0
- package/lib/common/enums.js +6 -1
- package/lib/shared/ai/entity.d.ts +1 -2
- package/lib/shared/ai/request.d.ts +8 -3
- package/lib/utils/string.d.ts +3 -0
- package/lib/utils/string.js +16 -0
- package/lib/utils/tests/string.test.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./entity"), exports);
|
|
18
|
+
__exportStar(require("./request"), exports);
|
package/lib/back/index.d.ts
CHANGED
package/lib/back/index.js
CHANGED
package/lib/common/enums.d.ts
CHANGED
package/lib/common/enums.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AudioSex = exports.ImageKind = exports.AudioKind = exports.PointerMode = exports.ContentType = exports.PositionDirection = exports.PassExerciseStatus = exports.PassEpisodeStatus = exports.PassStatus = exports.PostStatus = exports.SetType = exports.ItemType = exports.ExerciseMode = exports.ExerciseType = exports.SmmCampaignType = exports.SmmCampaignStatus = exports.SocialProvider = exports.EntryStatus = exports.QuizMode = exports.UserReaction = exports.WordMode = exports.Knowing = void 0;
|
|
3
|
+
exports.AiPromptName = exports.AudioSex = exports.ImageKind = exports.AudioKind = exports.PointerMode = exports.ContentType = exports.PositionDirection = exports.PassExerciseStatus = exports.PassEpisodeStatus = exports.PassStatus = exports.PostStatus = exports.SetType = exports.ItemType = exports.ExerciseMode = exports.ExerciseType = exports.SmmCampaignType = exports.SmmCampaignStatus = exports.SocialProvider = exports.EntryStatus = exports.QuizMode = exports.UserReaction = exports.WordMode = exports.Knowing = void 0;
|
|
4
4
|
var Knowing;
|
|
5
5
|
(function (Knowing) {
|
|
6
6
|
Knowing[Knowing["Known"] = 1] = "Known";
|
|
@@ -130,3 +130,8 @@ var AudioSex;
|
|
|
130
130
|
AudioSex["Male"] = "male";
|
|
131
131
|
AudioSex["Female"] = "female";
|
|
132
132
|
})(AudioSex || (exports.AudioSex = AudioSex = {}));
|
|
133
|
+
var AiPromptName;
|
|
134
|
+
(function (AiPromptName) {
|
|
135
|
+
AiPromptName["WordTags"] = "wordTags";
|
|
136
|
+
AiPromptName["Rule"] = "rule";
|
|
137
|
+
})(AiPromptName || (exports.AiPromptName = AiPromptName = {}));
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { AiPromptName, AudioSex } from "../../common";
|
|
2
|
+
export interface AiRawTextRequest {
|
|
3
|
+
system?: string;
|
|
4
|
+
prompt: string;
|
|
5
|
+
}
|
|
1
6
|
export interface AiTextRequest {
|
|
2
|
-
|
|
3
|
-
|
|
7
|
+
name: AiPromptName;
|
|
8
|
+
prompt: string;
|
|
4
9
|
}
|
|
5
10
|
export interface AiImageRequest {
|
|
6
11
|
prompt: string;
|
|
@@ -8,5 +13,5 @@ export interface AiImageRequest {
|
|
|
8
13
|
export interface AiSpeechRequest {
|
|
9
14
|
text: string;
|
|
10
15
|
langCode: string;
|
|
11
|
-
|
|
16
|
+
sex?: AudioSex;
|
|
12
17
|
}
|
package/lib/utils/string.d.ts
CHANGED
|
@@ -3,4 +3,7 @@ export declare class StringUtil {
|
|
|
3
3
|
static isSame<TLiteral extends string = string>(str1: TLiteral, str2: string): boolean;
|
|
4
4
|
static isNumeric(text: string | undefined): boolean;
|
|
5
5
|
static capitalize(text: string | undefined): string;
|
|
6
|
+
static format(text: string | undefined, options?: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}): string;
|
|
6
9
|
}
|
package/lib/utils/string.js
CHANGED
|
@@ -19,6 +19,22 @@ var StringUtil = /** @class */ (function () {
|
|
|
19
19
|
}
|
|
20
20
|
return text || "";
|
|
21
21
|
};
|
|
22
|
+
StringUtil.format = function (text, options) {
|
|
23
|
+
if (!text) {
|
|
24
|
+
return "";
|
|
25
|
+
}
|
|
26
|
+
var formattedText = text;
|
|
27
|
+
if (options) {
|
|
28
|
+
for (var key in options) {
|
|
29
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
30
|
+
if (options.hasOwnProperty(key)) {
|
|
31
|
+
var value = options[key];
|
|
32
|
+
formattedText = formattedText.replace(new RegExp("{".concat(key, "}"), "g"), value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return formattedText;
|
|
37
|
+
};
|
|
22
38
|
return StringUtil;
|
|
23
39
|
}());
|
|
24
40
|
exports.StringUtil = StringUtil;
|
|
@@ -13,4 +13,13 @@ describe("StringUtil", function () {
|
|
|
13
13
|
expect(string_1.StringUtil.capitalize("")).toBe("");
|
|
14
14
|
expect(string_1.StringUtil.capitalize(undefined)).toBe("");
|
|
15
15
|
});
|
|
16
|
+
test("format", function () {
|
|
17
|
+
expect(string_1.StringUtil.format("Hello, {name}!", { name: "Alice" })).toBe("Hello, Alice!");
|
|
18
|
+
expect(string_1.StringUtil.format("The value is {value}.", { value: 42 })).toBe("The value is 42.");
|
|
19
|
+
expect(string_1.StringUtil.format("No placeholders here.")).toBe("No placeholders here.");
|
|
20
|
+
expect(string_1.StringUtil.format("Missing {placeholder}.")).toBe("Missing {placeholder}.");
|
|
21
|
+
expect(string_1.StringUtil.format("Hello, {name}!", { name: "Alice", age: 30 })).toBe("Hello, Alice!");
|
|
22
|
+
// multiple using same argument
|
|
23
|
+
expect(string_1.StringUtil.format("{greet}, {name}! {greet} again!", { greet: "Hello", name: "Bob" })).toBe("Hello, Bob! Hello again!");
|
|
24
|
+
});
|
|
16
25
|
});
|