@purpleschool/gptbot 0.7.39 → 0.7.40-texteditor
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/api/controllers/http/index.ts +1 -0
- package/api/controllers/http/subscription.ts +2 -0
- package/api/controllers/http/writer.ts +20 -0
- package/api/routes.ts +4 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/subscription.js +2 -0
- package/build/api/controllers/http/writer.js +22 -0
- package/build/api/routes.js +2 -0
- package/build/commands/subscription/downgrade-subscription.command.js +44 -0
- package/build/commands/subscription/index.js +1 -0
- package/build/commands/tools/index.js +1 -0
- package/build/commands/tools/writer/create-writer-document.command.js +16 -0
- package/build/commands/tools/writer/delete-all-writer-documents.command.js +8 -0
- package/build/commands/tools/writer/delete-writer-document-by-uuid.command.js +11 -0
- package/build/commands/tools/writer/export-writer-document-as-docx.command.js +15 -0
- package/build/commands/tools/writer/find-writer-document-by-uuid.command.js +14 -0
- package/build/commands/tools/writer/find-writer-documents.command.js +18 -0
- package/build/commands/tools/writer/generate-writer-document-contents.command.js +14 -0
- package/build/commands/tools/writer/get-writer-tool-config.command.js +11 -0
- package/build/commands/tools/writer/index.js +31 -0
- package/build/commands/tools/writer/update-writer-document-contents.command.js +18 -0
- package/build/commands/tools/writer/update-writer-document-outline.command.js +17 -0
- package/build/commands/tools/writer/writer-extend-text.command.js +18 -0
- package/build/commands/tools/writer/writer-fix-errors.command.js +18 -0
- package/build/commands/tools/writer/writer-generate-text.command.js +21 -0
- package/build/commands/tools/writer/writer-paraphrase.command.js +18 -0
- package/build/commands/tools/writer/writer-shorten-text.command.js +18 -0
- package/build/constants/errors/errors.js +117 -27
- package/build/constants/index.js +1 -0
- package/build/constants/order/enums/order-type.enum.js +1 -0
- package/build/constants/subscription/enums/subscription-action.enum.js +1 -0
- package/build/constants/subscription/enums/subscription-status.enum.js +3 -0
- package/build/constants/writer/enums/index.js +20 -0
- package/build/constants/writer/enums/writer-ai-action-pricing-type.enum.js +8 -0
- package/build/constants/writer/enums/writer-ai-action-type.enum.js +11 -0
- package/build/constants/writer/enums/writer-document-section-type.enum.js +9 -0
- package/build/constants/writer/enums/writer-document-stage.enum.js +14 -0
- package/build/constants/writer/index.js +17 -0
- package/build/helpers/index.js +1 -0
- package/build/helpers/writer/calculate-page-count.util.js +37 -0
- package/build/helpers/writer/calculate-writer-ai-action-price.util.js +16 -0
- package/build/helpers/writer/calculate-writer-content-generation-price.util.js +6 -0
- package/build/helpers/writer/index.js +19 -0
- package/build/models/tools/index.js +1 -0
- package/build/models/tools/writer/index.js +21 -0
- package/build/models/tools/writer/writer-ai-action.schema.js +26 -0
- package/build/models/tools/writer/writer-config.schema.js +11 -0
- package/build/models/tools/writer/writer-document-outline.schema.js +21 -0
- package/build/models/tools/writer/writer-document-type.schema.js +16 -0
- package/build/models/tools/writer/writer-document.schema.js +22 -0
- package/build/models/user-to-subscription.schema.js +1 -0
- package/commands/subscription/downgrade-subscription.command.ts +50 -0
- package/commands/subscription/index.ts +1 -0
- package/commands/tools/index.ts +1 -0
- package/commands/tools/writer/create-writer-document.command.ts +16 -0
- package/commands/tools/writer/delete-all-writer-documents.command.ts +6 -0
- package/commands/tools/writer/delete-writer-document-by-uuid.command.ts +11 -0
- package/commands/tools/writer/export-writer-document-as-docx.command.ts +15 -0
- package/commands/tools/writer/find-writer-document-by-uuid.command.ts +14 -0
- package/commands/tools/writer/find-writer-documents.command.ts +18 -0
- package/commands/tools/writer/generate-writer-document-contents.command.ts +14 -0
- package/commands/tools/writer/get-writer-tool-config.command.ts +10 -0
- package/commands/tools/writer/index.ts +15 -0
- package/commands/tools/writer/update-writer-document-contents.command.ts +20 -0
- package/commands/tools/writer/update-writer-document-outline.command.ts +19 -0
- package/commands/tools/writer/writer-extend-text.command.ts +20 -0
- package/commands/tools/writer/writer-fix-errors.command.ts +20 -0
- package/commands/tools/writer/writer-generate-text.command.ts +23 -0
- package/commands/tools/writer/writer-paraphrase.command.ts +20 -0
- package/commands/tools/writer/writer-shorten-text.command.ts +20 -0
- package/constants/errors/errors.ts +117 -27
- package/constants/index.ts +1 -0
- package/constants/order/enums/order-type.enum.ts +1 -0
- package/constants/subscription/enums/subscription-action.enum.ts +1 -0
- package/constants/subscription/enums/subscription-status.enum.ts +3 -0
- package/constants/writer/enums/index.ts +4 -0
- package/constants/writer/enums/writer-ai-action-pricing-type.enum.ts +4 -0
- package/constants/writer/enums/writer-ai-action-type.enum.ts +7 -0
- package/constants/writer/enums/writer-document-section-type.enum.ts +5 -0
- package/constants/writer/enums/writer-document-stage.enum.ts +13 -0
- package/constants/writer/index.ts +1 -0
- package/helpers/index.ts +1 -0
- package/helpers/writer/calculate-page-count.util.ts +46 -0
- package/helpers/writer/calculate-writer-ai-action-price.util.ts +20 -0
- package/helpers/writer/calculate-writer-content-generation-price.util.ts +3 -0
- package/helpers/writer/index.ts +3 -0
- package/models/tools/index.ts +1 -0
- package/models/tools/writer/index.ts +5 -0
- package/models/tools/writer/writer-ai-action.schema.ts +27 -0
- package/models/tools/writer/writer-config.schema.ts +10 -0
- package/models/tools/writer/writer-document-outline.schema.ts +28 -0
- package/models/tools/writer/writer-document-type.schema.ts +15 -0
- package/models/tools/writer/writer-document.schema.ts +21 -0
- package/models/user-to-subscription.schema.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterDocumentSchema } from '../../../models';
|
|
3
|
+
|
|
4
|
+
export namespace CreateWriterDocumentCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
prompt: z.string(),
|
|
7
|
+
numPages: z.number(),
|
|
8
|
+
documentTypeId: z.string(),
|
|
9
|
+
});
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: WriterDocumentSchema,
|
|
14
|
+
});
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeleteWriterDocumentByUUIDCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.void();
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace ExportWriterDocumentAsDocxCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.object({
|
|
11
|
+
url: z.string(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterDocumentSchema } from '../../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindWriterDocumentByUUIDCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: WriterDocumentSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterDocumentSchema } from '../../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindWriterDocumentsCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
limit: z.coerce.number().min(1).optional(),
|
|
7
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
8
|
+
title: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.array(WriterDocumentSchema),
|
|
14
|
+
totalPages: z.number(),
|
|
15
|
+
page: z.number(),
|
|
16
|
+
});
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterDocumentSchema } from '../../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GenerateWriterDocumentContentsCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: WriterDocumentSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterConfigSchema } from '../../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetWriterToolConfigCommand {
|
|
5
|
+
export const ResponseSchema = z.object({
|
|
6
|
+
data: WriterConfigSchema,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './get-writer-tool-config.command';
|
|
2
|
+
export * from './create-writer-document.command';
|
|
3
|
+
export * from './find-writer-document-by-uuid.command';
|
|
4
|
+
export * from './find-writer-documents.command';
|
|
5
|
+
export * from './generate-writer-document-contents.command';
|
|
6
|
+
export * from './update-writer-document-outline.command';
|
|
7
|
+
export * from './update-writer-document-contents.command';
|
|
8
|
+
export * from './delete-writer-document-by-uuid.command';
|
|
9
|
+
export * from './delete-all-writer-documents.command';
|
|
10
|
+
export * from './writer-paraphrase.command';
|
|
11
|
+
export * from './writer-extend-text.command';
|
|
12
|
+
export * from './writer-shorten-text.command';
|
|
13
|
+
export * from './writer-fix-errors.command';
|
|
14
|
+
export * from './writer-generate-text.command';
|
|
15
|
+
export * from './export-writer-document-as-docx.command';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace UpdateWriterDocumentContentsCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
contents: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.object({
|
|
16
|
+
success: z.boolean(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterDocumentOutlineSchema, WriterDocumentOutlineSectionSchema } from '../../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateWriterDocumentOutlineCommand {
|
|
5
|
+
export const RequestBodySchema = z.object({
|
|
6
|
+
data: WriterDocumentOutlineSchema,
|
|
7
|
+
});
|
|
8
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestParamsSchema = z.object({
|
|
11
|
+
uuid: z.string().uuid(),
|
|
12
|
+
});
|
|
13
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = z.object({
|
|
16
|
+
data: z.array(WriterDocumentOutlineSectionSchema),
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace WriterExtendTextCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
selectionText: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.object({
|
|
16
|
+
output: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace WriterFixErrorsCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
selectionText: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.object({
|
|
16
|
+
output: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace WriterGenerateTextCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
prompt: z.string(),
|
|
11
|
+
selectionText: z.string(),
|
|
12
|
+
contextBefore: z.string().max(2000).optional(),
|
|
13
|
+
contextAfter: z.string().max(2000).optional(),
|
|
14
|
+
});
|
|
15
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = z.object({
|
|
18
|
+
data: z.object({
|
|
19
|
+
output: z.string(),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace WriterParaphraseCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
selectionText: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.object({
|
|
16
|
+
output: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace WriterShortenTextCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
selectionText: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.object({
|
|
16
|
+
output: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -1715,121 +1715,211 @@ export const ERRORS = {
|
|
|
1715
1715
|
httpCode: 500,
|
|
1716
1716
|
},
|
|
1717
1717
|
DAILY_REWARD_COLLECT_ERROR: {
|
|
1718
|
-
code: '
|
|
1718
|
+
code: 'A362',
|
|
1719
1719
|
message: 'Ошибка при получении ежедневной награды',
|
|
1720
1720
|
httpCode: 500,
|
|
1721
1721
|
},
|
|
1722
1722
|
DAILY_STREAK_CREATE_ERROR: {
|
|
1723
|
-
code: '
|
|
1723
|
+
code: 'A363',
|
|
1724
1724
|
message: 'Ошибка при создании ежедневного стрика',
|
|
1725
1725
|
httpCode: 500,
|
|
1726
1726
|
},
|
|
1727
1727
|
DAILY_STREAK_FIND_ERROR: {
|
|
1728
|
-
code: '
|
|
1728
|
+
code: 'A364',
|
|
1729
1729
|
message: 'Ошибка при поиске ежедневного стрика',
|
|
1730
1730
|
httpCode: 500,
|
|
1731
1731
|
},
|
|
1732
1732
|
DAILY_STREAK_PROMOCODE_ALREADY_EXISTS_ERROR: {
|
|
1733
|
-
code: '
|
|
1733
|
+
code: 'A365',
|
|
1734
1734
|
message: 'Промокод для ежедневного стрика уже существует',
|
|
1735
1735
|
httpCode: 409,
|
|
1736
1736
|
},
|
|
1737
1737
|
DAILY_REWARD_NOT_READY_ERROR: {
|
|
1738
|
-
code: '
|
|
1738
|
+
code: 'A366',
|
|
1739
1739
|
message: 'Запрашиваемая награда ещё недоступна для получения',
|
|
1740
1740
|
httpCode: 429,
|
|
1741
1741
|
},
|
|
1742
1742
|
DAILY_REWARD_ALREADY_COLLECTED_ERROR: {
|
|
1743
|
-
code: '
|
|
1743
|
+
code: 'A367',
|
|
1744
1744
|
message: 'Запрашиваемая награда уже получена',
|
|
1745
1745
|
httpCode: 429,
|
|
1746
1746
|
},
|
|
1747
1747
|
DAILY_STREAK_UPDATE_ERROR: {
|
|
1748
|
-
code: '
|
|
1748
|
+
code: 'A368',
|
|
1749
1749
|
message: 'Ошибка при обновлении ежедневного стрика',
|
|
1750
1750
|
httpCode: 500,
|
|
1751
1751
|
},
|
|
1752
|
+
WRITER_CONFIG_ERROR: {
|
|
1753
|
+
code: 'A369',
|
|
1754
|
+
message: 'Произошла ошибка при получении конфигурации Writer',
|
|
1755
|
+
httpCode: 500,
|
|
1756
|
+
},
|
|
1757
|
+
WRITER_CREATE_DOCUMENT_ERROR: {
|
|
1758
|
+
code: 'A370',
|
|
1759
|
+
message: 'Произошла ошибка при создании документа',
|
|
1760
|
+
httpCode: 500,
|
|
1761
|
+
},
|
|
1762
|
+
WRITER_DOCUMENT_FIND_ERROR: {
|
|
1763
|
+
code: 'A371',
|
|
1764
|
+
message: 'Произошла ошибка при поиске документа',
|
|
1765
|
+
httpCode: 500,
|
|
1766
|
+
},
|
|
1767
|
+
WRITER_DOCUMENTS_FIND_ERROR: {
|
|
1768
|
+
code: 'A372',
|
|
1769
|
+
message: 'Произошла ошибка при поиске документов',
|
|
1770
|
+
httpCode: 500,
|
|
1771
|
+
},
|
|
1772
|
+
WRITER_DELETE_DOCUMENT_ERROR: {
|
|
1773
|
+
code: 'A373',
|
|
1774
|
+
message: 'Произошла ошибка при удалении документа',
|
|
1775
|
+
httpCode: 500,
|
|
1776
|
+
},
|
|
1777
|
+
WRITER_DELETE_ALL_DOCUMENTS_ERROR: {
|
|
1778
|
+
code: 'A374',
|
|
1779
|
+
message: 'Произошла ошибка при удалении всех документов пользователя',
|
|
1780
|
+
httpCode: 500,
|
|
1781
|
+
},
|
|
1782
|
+
WRITER_UPDATE_DOCUMENT_OUTLINE_ERROR: {
|
|
1783
|
+
code: 'A375',
|
|
1784
|
+
message: 'Произошла ошибка при обновлении структуры документа',
|
|
1785
|
+
httpCode: 500,
|
|
1786
|
+
},
|
|
1787
|
+
WRITER_GENERATE_DOCUMENT_CONTENTS_ERROR: {
|
|
1788
|
+
code: 'A376',
|
|
1789
|
+
message: 'Произошла ошибка при генерации содержимого документа',
|
|
1790
|
+
httpCode: 500,
|
|
1791
|
+
},
|
|
1752
1792
|
ACCOUNT_DELETE_ERROR: {
|
|
1753
|
-
code: '
|
|
1793
|
+
code: 'A377',
|
|
1754
1794
|
message: 'Аккаунт не был удалён',
|
|
1755
1795
|
httpCode: 500,
|
|
1756
1796
|
},
|
|
1757
1797
|
ACCOUNT_DELETED: {
|
|
1758
|
-
code: '
|
|
1798
|
+
code: 'A378',
|
|
1759
1799
|
message: 'Операция невозможна, аккаунт был удалён',
|
|
1760
1800
|
httpCode: 400,
|
|
1761
1801
|
},
|
|
1762
|
-
TELEGRAM_PROFILE_DELETE_ERROR: {
|
|
1763
|
-
code: 'A362',
|
|
1764
|
-
message: 'Произошла ошибка при удалении Telegram профиля',
|
|
1765
|
-
httpCode: 500,
|
|
1766
|
-
},
|
|
1767
1802
|
TOOL_NOT_FOUND_ERROR: {
|
|
1768
|
-
code: '
|
|
1803
|
+
code: 'A379',
|
|
1769
1804
|
message: 'Инструмент не найден',
|
|
1770
1805
|
httpCode: 404,
|
|
1771
1806
|
},
|
|
1807
|
+
TELEGRAM_PROFILE_DELETE_ERROR: {
|
|
1808
|
+
code: 'A380',
|
|
1809
|
+
message: 'Произошла ошибка при удалении Telegram профиля',
|
|
1810
|
+
httpCode: 500,
|
|
1811
|
+
},
|
|
1772
1812
|
ORDER_CHECK_FIRST_PURCHASE_ERROR: {
|
|
1773
|
-
code: '
|
|
1813
|
+
code: 'A381',
|
|
1774
1814
|
message: 'Произошла ошибка при проверке первой покупки',
|
|
1775
1815
|
httpCode: 500,
|
|
1776
1816
|
},
|
|
1777
1817
|
ORDER_CURRENT_ORDER_NOT_FOUND_ERROR: {
|
|
1778
|
-
code: '
|
|
1818
|
+
code: 'A382',
|
|
1779
1819
|
message: 'Текущий заказ не найден',
|
|
1780
1820
|
httpCode: 404,
|
|
1781
1821
|
},
|
|
1782
1822
|
ORDER_GET_USER_ORDERS_ERROR: {
|
|
1783
|
-
code: '
|
|
1823
|
+
code: 'A383',
|
|
1784
1824
|
message: 'Произошла ошибка при получении заказов пользователя',
|
|
1785
1825
|
httpCode: 500,
|
|
1786
1826
|
},
|
|
1787
1827
|
ORDER_NO_SUBSCRIPTION_ID_OR_PRODUCT_ID_PROVIDED_ERROR: {
|
|
1788
|
-
code: '
|
|
1828
|
+
code: 'A384',
|
|
1789
1829
|
message: 'Не указан subscriptionId или productId',
|
|
1790
1830
|
httpCode: 400,
|
|
1791
1831
|
},
|
|
1792
1832
|
FILE_TO_MD_FORMAT_ERROR: {
|
|
1793
|
-
code: '
|
|
1833
|
+
code: 'A385',
|
|
1794
1834
|
message: 'Неверный формат файла, варианты: .xlsx, .docx, .pdf',
|
|
1795
1835
|
httpCode: 400,
|
|
1796
1836
|
},
|
|
1797
1837
|
FILE_TO_MD_ERROR: {
|
|
1798
|
-
code: '
|
|
1838
|
+
code: 'A386',
|
|
1799
1839
|
message: 'Произошла ошибка при конвертации файла в markdown',
|
|
1800
1840
|
httpCode: 500,
|
|
1801
1841
|
},
|
|
1802
1842
|
FILE_TO_MD_CONVERT_ERROR: {
|
|
1803
|
-
code: '
|
|
1843
|
+
code: 'A387',
|
|
1804
1844
|
message:
|
|
1805
1845
|
'Не получилось конвертировать файл в markdown, возможно файл пуст, поврежден или невалиден',
|
|
1806
1846
|
httpCode: 400,
|
|
1807
1847
|
},
|
|
1808
1848
|
|
|
1809
1849
|
IMAGE_EDITOR_MODEL_INACTIVE: {
|
|
1810
|
-
code: '
|
|
1850
|
+
code: 'A388',
|
|
1811
1851
|
message: 'Модель редактирования картинок архивирована и недоступна для пользования',
|
|
1812
1852
|
httpCode: 403,
|
|
1813
1853
|
},
|
|
1814
1854
|
TTS_MODEL_INACTIVE: {
|
|
1815
|
-
code: '
|
|
1855
|
+
code: 'A389',
|
|
1816
1856
|
message: 'Модель генерации текста в голос архивирована и недоступна для пользования',
|
|
1817
1857
|
httpCode: 403,
|
|
1818
1858
|
},
|
|
1819
1859
|
STT_MODEL_INACTIVE: {
|
|
1820
|
-
code: '
|
|
1860
|
+
code: 'A390',
|
|
1821
1861
|
message: 'Модель генерации голоса в текст архивирована и недоступна для пользования',
|
|
1822
1862
|
httpCode: 403,
|
|
1823
1863
|
},
|
|
1824
1864
|
VIDEO_MODEL_INACTIVE: {
|
|
1825
|
-
code: '
|
|
1865
|
+
code: 'A391',
|
|
1826
1866
|
message: 'Модель генерации видео архивирована и недоступна для пользования',
|
|
1827
1867
|
httpCode: 403,
|
|
1828
1868
|
},
|
|
1829
1869
|
PDF_TO_MD_CONVERT_ERROR: {
|
|
1830
|
-
code: '
|
|
1870
|
+
code: 'A392',
|
|
1831
1871
|
message:
|
|
1832
1872
|
'Не получилось конвертировать pdf в markdown, возможно вы прикрепили скан или картинку, не имеющую текста',
|
|
1833
1873
|
httpCode: 400,
|
|
1834
1874
|
},
|
|
1875
|
+
SUBSCRIPTION_DOWNGRADE_INVALID: {
|
|
1876
|
+
code: 'A393',
|
|
1877
|
+
message: 'Невозможно понизить подписку до указанного уровня',
|
|
1878
|
+
httpCode: 400,
|
|
1879
|
+
},
|
|
1880
|
+
SUBSCRIPTION_DOWNGRADE_ERROR: {
|
|
1881
|
+
code: 'A394',
|
|
1882
|
+
message: 'Не удалось понизить подписку',
|
|
1883
|
+
httpCode: 500,
|
|
1884
|
+
},
|
|
1885
|
+
SUBSCRIPTIONS_GET_DOWNGRADE_ERROR: {
|
|
1886
|
+
code: 'A395',
|
|
1887
|
+
message: 'Не удалось получить список возможных понижений для подписок',
|
|
1888
|
+
httpCode: 500,
|
|
1889
|
+
},
|
|
1890
|
+
WRITER_PARAPHRASE_ERROR: {
|
|
1891
|
+
code: 'A396',
|
|
1892
|
+
message: 'Произошла ошибка при перефразировании текста',
|
|
1893
|
+
httpCode: 500,
|
|
1894
|
+
},
|
|
1895
|
+
WRITER_EXTEND_TEXT_ERROR: {
|
|
1896
|
+
code: 'A397',
|
|
1897
|
+
message: 'Произошла ошибка при расширении текста',
|
|
1898
|
+
httpCode: 500,
|
|
1899
|
+
},
|
|
1900
|
+
WRITER_SHORTEN_TEXT_ERROR: {
|
|
1901
|
+
code: 'A398',
|
|
1902
|
+
message: 'Произошла ошибка при сокращении текста',
|
|
1903
|
+
httpCode: 500,
|
|
1904
|
+
},
|
|
1905
|
+
WRITER_FIX_ERRORS_ERROR: {
|
|
1906
|
+
code: 'A399',
|
|
1907
|
+
message: 'Произошла ошибка при исправлении ошибок в тексте',
|
|
1908
|
+
httpCode: 500,
|
|
1909
|
+
},
|
|
1910
|
+
WRITER_UPDATE_DOCUMENT_CONTENTS_ERROR: {
|
|
1911
|
+
code: 'A400',
|
|
1912
|
+
message: 'Произошла ошибка при обновлении содержимого документа',
|
|
1913
|
+
httpCode: 500,
|
|
1914
|
+
},
|
|
1915
|
+
WRITER_GENERATE_TEXT_ERROR: {
|
|
1916
|
+
code: 'A401',
|
|
1917
|
+
message: 'Произошла ошибка при генерации текста',
|
|
1918
|
+
httpCode: 500,
|
|
1919
|
+
},
|
|
1920
|
+
WRITER_EXPORT_DOCX_ERROR: {
|
|
1921
|
+
code: 'A402',
|
|
1922
|
+
message: 'Произошла ошибка при экспорте документа в DOCX',
|
|
1923
|
+
httpCode: 500,
|
|
1924
|
+
},
|
|
1835
1925
|
};
|
package/constants/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ export * from './promocode';
|
|
|
31
31
|
export * from './ui-notification';
|
|
32
32
|
export * from './review';
|
|
33
33
|
export * from './tool-video';
|
|
34
|
+
export * from './writer';
|
|
34
35
|
export * from './tool-image-editor';
|
|
35
36
|
export * from './feedback';
|
|
36
37
|
export * from './daily-streak';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export enum WRITER_DOCUMENT_STAGE {
|
|
2
|
+
CREATED = 'CREATED',
|
|
3
|
+
|
|
4
|
+
GENERATING_OUTLINE = 'GENERATING_OUTLINE',
|
|
5
|
+
OUTLINE_GENERATED = 'OUTLINE_GENERATED',
|
|
6
|
+
OUTLINE_GENERATION_FAILED = 'OUTLINE_GENERATION_FAILED',
|
|
7
|
+
|
|
8
|
+
GENERATING_CONTENT = 'GENERATING_CONTENT',
|
|
9
|
+
CONTENT_GENERATED = 'CONTENT_GENERATED',
|
|
10
|
+
CONTENT_GENERATION_FAILED = 'CONTENT_GENERATION_FAILED',
|
|
11
|
+
|
|
12
|
+
DELETED = 'DELETED',
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
package/helpers/index.ts
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const WORD_FONT_SIZE_PT = 14;
|
|
2
|
+
const WORD_LINE_SPACING = 1.5;
|
|
3
|
+
|
|
4
|
+
const A4_WIDTH_MM = 210;
|
|
5
|
+
const A4_HEIGHT_MM = 297;
|
|
6
|
+
|
|
7
|
+
const MARGIN_TOP_MM = 20;
|
|
8
|
+
const MARGIN_BOTTOM_MM = 20;
|
|
9
|
+
const MARGIN_LEFT_MM = 30;
|
|
10
|
+
const MARGIN_RIGHT_MM = 10;
|
|
11
|
+
|
|
12
|
+
const FIRST_LINE_INDENT_MM = 12.5;
|
|
13
|
+
|
|
14
|
+
const MM_PER_POINT = 0.3527777778;
|
|
15
|
+
|
|
16
|
+
const TEXT_WIDTH_MM = A4_WIDTH_MM - MARGIN_LEFT_MM - MARGIN_RIGHT_MM;
|
|
17
|
+
const TEXT_HEIGHT_MM = A4_HEIGHT_MM - MARGIN_TOP_MM - MARGIN_BOTTOM_MM;
|
|
18
|
+
|
|
19
|
+
const LINE_HEIGHT_MM = WORD_FONT_SIZE_PT * WORD_LINE_SPACING * MM_PER_POINT;
|
|
20
|
+
const LINES_PER_PAGE = Math.floor(TEXT_HEIGHT_MM / LINE_HEIGHT_MM);
|
|
21
|
+
|
|
22
|
+
const AVG_CHAR_WIDTH_EM = 0.58;
|
|
23
|
+
const AVG_CHAR_WIDTH_MM = WORD_FONT_SIZE_PT * AVG_CHAR_WIDTH_EM * MM_PER_POINT;
|
|
24
|
+
|
|
25
|
+
const CHARS_PER_LINE = Math.floor(TEXT_WIDTH_MM / AVG_CHAR_WIDTH_MM);
|
|
26
|
+
const AVG_PARAGRAPHS_PER_PAGE = 4; // average paragraph count across typical student papers
|
|
27
|
+
const INDENT_CHARS_LOSS = Math.round(
|
|
28
|
+
(FIRST_LINE_INDENT_MM / AVG_CHAR_WIDTH_MM) * AVG_PARAGRAPHS_PER_PAGE,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const LAYOUT_FUDGE_FACTOR = 0.96;
|
|
32
|
+
|
|
33
|
+
export const CHARACTERS_PER_PAGE = Math.round(
|
|
34
|
+
(LINES_PER_PAGE * CHARS_PER_LINE - INDENT_CHARS_LOSS) * LAYOUT_FUDGE_FACTOR,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export function pagesToCharacters(pages: number): number {
|
|
38
|
+
if (!Number.isFinite(pages) || pages <= 0) return 0;
|
|
39
|
+
return Math.max(0, Math.round(pages * CHARACTERS_PER_PAGE));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function charactersToPages(characters: number): number {
|
|
43
|
+
if (!Number.isFinite(characters) || characters <= 0) return 0;
|
|
44
|
+
const raw = characters / CHARACTERS_PER_PAGE;
|
|
45
|
+
return Math.max(0, Math.ceil(raw));
|
|
46
|
+
}
|