@common_ch/common 1.0.319 → 1.0.321

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.
@@ -22,6 +22,7 @@ export interface UserAttrs {
22
22
  password?: string;
23
23
  family?: string;
24
24
  updatedPortal?: boolean;
25
+ personalPrompt?: boolean;
25
26
  createdAt?: number;
26
27
  updatedAt?: number;
27
28
  }
@@ -51,6 +52,7 @@ export interface UserDoc extends mongoose.Document {
51
52
  family?: string;
52
53
  apiUsed?: number;
53
54
  updatedPortal?: boolean;
55
+ personalPrompt?: boolean;
54
56
  createdAt?: number;
55
57
  updatedAt?: number;
56
58
  updateWalletBalance(amount: number): Promise<{
@@ -105,6 +105,11 @@ const userSchema = new mongoose_1.default.Schema({
105
105
  required: true,
106
106
  default: 0
107
107
  },
108
+ personalPrompt: {
109
+ type: Boolean,
110
+ required: false,
111
+ default: false,
112
+ },
108
113
  status: {
109
114
  type: String,
110
115
  enum: user_1.UserStatusEnum,
@@ -0,0 +1 @@
1
+ export declare const createPersonalPrompt: (personalityPrompt?: string, prompt?: string, name?: string, job?: string, others?: string) => string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPersonalPrompt = void 0;
4
+ const createPersonalPrompt = (personalityPrompt, prompt, name, job, others) => {
5
+ const parts = ['شما یک دستیار هوش مصنوعی هستید.'];
6
+ if (personalityPrompt === null || personalityPrompt === void 0 ? void 0 : personalityPrompt.trim()) {
7
+ parts.push(` **پایه شخصیت شما:**\n${personalityPrompt.trim()}`);
8
+ }
9
+ if (prompt === null || prompt === void 0 ? void 0 : prompt.trim()) {
10
+ parts.push(` **سبک گفت‌وگو و نحوه برخورد:**\n${prompt.trim()}`);
11
+ }
12
+ const userInfo = [];
13
+ if (name === null || name === void 0 ? void 0 : name.trim())
14
+ userInfo.push(`- نام: ${name.trim()}`);
15
+ if (job === null || job === void 0 ? void 0 : job.trim())
16
+ userInfo.push(`- شغل: ${job.trim()}`);
17
+ if (others === null || others === void 0 ? void 0 : others.trim())
18
+ userInfo.push(`- سایر توضیحات: ${others.trim()}`);
19
+ if (userInfo.length > 0) {
20
+ parts.push(` **اطلاعات کاربر:**\n${userInfo.join('\n')}`);
21
+ }
22
+ parts.push(`**دستور نهایی:**
23
+ با توجه به توضیحات بالا، به گونه‌ای پاسخ بده که:
24
+ - شخصیت کلی و سبک گفت‌وگوی تعیین‌شده در پاسخ‌هایت مشهود باشد.
25
+ - لحن و انتخاب واژگان خود را متناسب با اطلاعات کاربر تنظیم کن.
26
+ - طبیعی، محترمانه و انسانی رفتار کن. `);
27
+ return parts.join('\n\n');
28
+ };
29
+ exports.createPersonalPrompt = createPersonalPrompt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.319",
3
+ "version": "1.0.321",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [