revdev 0.327.0 → 0.328.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.
@@ -0,0 +1,10 @@
1
+ import { AiPromptName, DualContribGen, ValueOption } from "../../common";
2
+ export interface BoAiPromptRecord {
3
+ name: AiPromptName;
4
+ format?: string;
5
+ system: string;
6
+ contrib: DualContribGen;
7
+ }
8
+ export interface BoAiPromptOption extends ValueOption<AiPromptName> {
9
+ format?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./entity";
2
+ export * from "./request";
@@ -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);
@@ -0,0 +1,8 @@
1
+ import { AiPromptName } from "../../common";
2
+ export interface BoUpdateAiPromptRequest {
3
+ name: AiPromptName;
4
+ format?: string;
5
+ system: string;
6
+ }
7
+ export interface BoAiPromptModifier extends BoUpdateAiPromptRequest {
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -20,3 +20,4 @@ export * from "./episode";
20
20
  export * from "./exercise";
21
21
  export * from "./item";
22
22
  export * from "./rule";
23
+ export * from "./ai";
package/lib/back/index.js CHANGED
@@ -36,3 +36,4 @@ __exportStar(require("./episode"), exports);
36
36
  __exportStar(require("./exercise"), exports);
37
37
  __exportStar(require("./item"), exports);
38
38
  __exportStar(require("./rule"), exports);
39
+ __exportStar(require("./ai"), exports);
@@ -101,3 +101,7 @@ export declare enum AudioSex {
101
101
  Male = "male",
102
102
  Female = "female"
103
103
  }
104
+ export declare enum AiPromptName {
105
+ WordTags = "wordTags",
106
+ Rule = "rule"
107
+ }
@@ -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,5 @@
1
1
  export interface AiTextResponse {
2
- content: string;
3
- choices: string[];
2
+ text: string;
4
3
  }
5
4
  export interface AIWordTagsItem {
6
5
  tag: string;
@@ -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
- systemContent?: string;
3
- userContent: string;
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
- voice?: "male" | "female";
16
+ sex?: AudioSex;
12
17
  }
@@ -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
  }
@@ -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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev",
3
- "version": "0.327.0",
3
+ "version": "0.328.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",