@purpleschool/gptbot 0.7.37-texteditor → 0.7.37
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 +0 -1
- package/build/api/controllers/http/index.js +0 -1
- package/build/commands/tools/index.js +0 -1
- package/build/constants/errors/errors.js +41 -81
- package/build/constants/file/enums/file-type.enum.js +1 -0
- package/build/constants/file/file.constants.js +11 -1
- package/build/constants/index.js +0 -1
- package/build/helpers/index.js +0 -1
- package/build/models/tools/index.js +0 -1
- package/commands/tools/index.ts +0 -1
- package/constants/errors/errors.ts +42 -81
- package/constants/file/enums/file-type.enum.ts +1 -0
- package/constants/file/file.constants.ts +12 -0
- package/constants/index.ts +0 -1
- package/helpers/index.ts +0 -1
- package/models/tools/index.ts +0 -1
- package/package.json +1 -1
- package/api/controllers/http/writer.ts +0 -20
- package/build/api/controllers/http/writer.js +0 -22
- package/build/commands/tools/writer/create-writer-document.command.js +0 -16
- package/build/commands/tools/writer/delete-all-writer-documents.command.js +0 -8
- package/build/commands/tools/writer/delete-writer-document-by-uuid.command.js +0 -11
- package/build/commands/tools/writer/export-writer-document-as-docx.command.js +0 -15
- package/build/commands/tools/writer/find-writer-document-by-uuid.command.js +0 -14
- package/build/commands/tools/writer/find-writer-documents.command.js +0 -18
- package/build/commands/tools/writer/generate-writer-document-contents.command.js +0 -14
- package/build/commands/tools/writer/get-writer-tool-config.command.js +0 -11
- package/build/commands/tools/writer/index.js +0 -31
- package/build/commands/tools/writer/update-writer-document-contents.command.js +0 -18
- package/build/commands/tools/writer/update-writer-document-outline.command.js +0 -17
- package/build/commands/tools/writer/writer-extend-text.command.js +0 -18
- package/build/commands/tools/writer/writer-fix-errors.command.js +0 -18
- package/build/commands/tools/writer/writer-generate-text.command.js +0 -21
- package/build/commands/tools/writer/writer-paraphrase.command.js +0 -18
- package/build/commands/tools/writer/writer-shorten-text.command.js +0 -18
- package/build/constants/writer/enums/index.js +0 -20
- package/build/constants/writer/enums/writer-ai-action-pricing-type.enum.js +0 -8
- package/build/constants/writer/enums/writer-ai-action-type.enum.js +0 -11
- package/build/constants/writer/enums/writer-document-section-type.enum.js +0 -9
- package/build/constants/writer/enums/writer-document-stage.enum.js +0 -14
- package/build/constants/writer/index.js +0 -17
- package/build/helpers/writer/calculate-writer-ai-action-price.util.js +0 -16
- package/build/helpers/writer/calculate-writer-content-generation-price.util.js +0 -6
- package/build/helpers/writer/index.js +0 -18
- package/build/models/tools/writer/index.js +0 -21
- package/build/models/tools/writer/writer-ai-action.schema.js +0 -26
- package/build/models/tools/writer/writer-config.schema.js +0 -13
- package/build/models/tools/writer/writer-document-outline.schema.js +0 -21
- package/build/models/tools/writer/writer-document-type.schema.js +0 -14
- package/build/models/tools/writer/writer-document.schema.js +0 -22
- package/commands/tools/writer/create-writer-document.command.ts +0 -16
- package/commands/tools/writer/delete-all-writer-documents.command.ts +0 -6
- package/commands/tools/writer/delete-writer-document-by-uuid.command.ts +0 -11
- package/commands/tools/writer/export-writer-document-as-docx.command.ts +0 -15
- package/commands/tools/writer/find-writer-document-by-uuid.command.ts +0 -14
- package/commands/tools/writer/find-writer-documents.command.ts +0 -18
- package/commands/tools/writer/generate-writer-document-contents.command.ts +0 -14
- package/commands/tools/writer/get-writer-tool-config.command.ts +0 -10
- package/commands/tools/writer/index.ts +0 -15
- package/commands/tools/writer/update-writer-document-contents.command.ts +0 -20
- package/commands/tools/writer/update-writer-document-outline.command.ts +0 -19
- package/commands/tools/writer/writer-extend-text.command.ts +0 -20
- package/commands/tools/writer/writer-fix-errors.command.ts +0 -20
- package/commands/tools/writer/writer-generate-text.command.ts +0 -23
- package/commands/tools/writer/writer-paraphrase.command.ts +0 -20
- package/commands/tools/writer/writer-shorten-text.command.ts +0 -20
- package/constants/writer/enums/index.ts +0 -4
- package/constants/writer/enums/writer-ai-action-pricing-type.enum.ts +0 -4
- package/constants/writer/enums/writer-ai-action-type.enum.ts +0 -7
- package/constants/writer/enums/writer-document-section-type.enum.ts +0 -5
- package/constants/writer/enums/writer-document-stage.enum.ts +0 -13
- package/constants/writer/index.ts +0 -1
- package/helpers/writer/calculate-writer-ai-action-price.util.ts +0 -20
- package/helpers/writer/calculate-writer-content-generation-price.util.ts +0 -3
- package/helpers/writer/index.ts +0 -2
- package/models/tools/writer/index.ts +0 -5
- package/models/tools/writer/writer-ai-action.schema.ts +0 -27
- package/models/tools/writer/writer-config.schema.ts +0 -12
- package/models/tools/writer/writer-document-outline.schema.ts +0 -28
- package/models/tools/writer/writer-document-type.schema.ts +0 -13
- package/models/tools/writer/writer-document.schema.ts +0 -21
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './enums';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { WRITER_AI_ACTION_PRICING_TYPE } from '../../constants';
|
|
2
|
-
import { WriterAiActionPricingRules } from '../../models';
|
|
3
|
-
|
|
4
|
-
export function calculateWriterAiActionPrice(
|
|
5
|
-
pricingRules: WriterAiActionPricingRules,
|
|
6
|
-
selectionText: string,
|
|
7
|
-
): number {
|
|
8
|
-
switch (pricingRules.type) {
|
|
9
|
-
case WRITER_AI_ACTION_PRICING_TYPE.PER_CHARACTER:
|
|
10
|
-
const characterCount = selectionText.length;
|
|
11
|
-
const price = characterCount * pricingRules.price;
|
|
12
|
-
return Math.max(1, Math.ceil(price));
|
|
13
|
-
|
|
14
|
-
case WRITER_AI_ACTION_PRICING_TYPE.FLAT:
|
|
15
|
-
return Math.max(1, Math.ceil(pricingRules.price));
|
|
16
|
-
|
|
17
|
-
default:
|
|
18
|
-
throw new Error(`Unknown pricing type`);
|
|
19
|
-
}
|
|
20
|
-
}
|
package/helpers/writer/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { WRITER_AI_ACTION_PRICING_TYPE, WRITER_AI_ACTION_TYPE } from '../../../constants';
|
|
3
|
-
|
|
4
|
-
export const WriterAiActionPricingRulesSchema = z.discriminatedUnion('type', [
|
|
5
|
-
z.object({
|
|
6
|
-
type: z.literal(WRITER_AI_ACTION_PRICING_TYPE.PER_CHARACTER),
|
|
7
|
-
price: z.number(),
|
|
8
|
-
}),
|
|
9
|
-
z.object({
|
|
10
|
-
type: z.literal(WRITER_AI_ACTION_PRICING_TYPE.FLAT),
|
|
11
|
-
price: z.number(),
|
|
12
|
-
}),
|
|
13
|
-
]);
|
|
14
|
-
export type WriterAiActionPricingRules = z.infer<typeof WriterAiActionPricingRulesSchema>;
|
|
15
|
-
|
|
16
|
-
export const WriterAiActionSchema = z.object({
|
|
17
|
-
uuid: z.string(),
|
|
18
|
-
type: z.nativeEnum(WRITER_AI_ACTION_TYPE),
|
|
19
|
-
pricingRules: WriterAiActionPricingRulesSchema,
|
|
20
|
-
maxPromptLength: z.number(),
|
|
21
|
-
title: z.string(),
|
|
22
|
-
icon: z.string(),
|
|
23
|
-
order: z.number(),
|
|
24
|
-
createdAt: z.date(),
|
|
25
|
-
updatedAt: z.date(),
|
|
26
|
-
});
|
|
27
|
-
export type WriterAiAction = z.infer<typeof WriterAiActionSchema>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { WriterDocumentTypeSchema } from './writer-document-type.schema';
|
|
3
|
-
import { WriterAiActionSchema } from './writer-ai-action.schema';
|
|
4
|
-
|
|
5
|
-
export const WriterConfigSchema = z.object({
|
|
6
|
-
minPages: z.number(),
|
|
7
|
-
maxPages: z.number(),
|
|
8
|
-
maxPromptLength: z.number(),
|
|
9
|
-
documentTypes: z.array(WriterDocumentTypeSchema),
|
|
10
|
-
aiActions: z.array(WriterAiActionSchema),
|
|
11
|
-
});
|
|
12
|
-
export type WriterConfig = z.infer<typeof WriterConfigSchema>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { WRITER_DOCUMENT_SECTION_TYPE } from '../../../constants';
|
|
3
|
-
|
|
4
|
-
export const WriterDocumentOutlineSubsectionSchema = z.object({
|
|
5
|
-
title: z
|
|
6
|
-
.string()
|
|
7
|
-
.min(3)
|
|
8
|
-
.max(120)
|
|
9
|
-
.describe(
|
|
10
|
-
`Concise title of the subsection. Meant to elaborate on its parent section's title.`,
|
|
11
|
-
),
|
|
12
|
-
});
|
|
13
|
-
export type WriterDocumentOutlineSubsection = z.infer<typeof WriterDocumentOutlineSubsectionSchema>;
|
|
14
|
-
|
|
15
|
-
export const WriterDocumentOutlineSectionSchema = z.object({
|
|
16
|
-
title: z.string().min(3).max(120).describe(`Concise title of the paper section.`),
|
|
17
|
-
type: z.nativeEnum(WRITER_DOCUMENT_SECTION_TYPE),
|
|
18
|
-
subsections: z
|
|
19
|
-
.array(WriterDocumentOutlineSubsectionSchema)
|
|
20
|
-
.optional()
|
|
21
|
-
.describe(
|
|
22
|
-
`Subsections of the paper section. Each subsection is a single idea that is a part of the parent section.`,
|
|
23
|
-
),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const WriterDocumentOutlineSchema = z.array(WriterDocumentOutlineSectionSchema);
|
|
27
|
-
|
|
28
|
-
export type WriterDocumentOutline = z.infer<typeof WriterDocumentOutlineSchema>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
export const WriterDocumentTypeSchema = z.object({
|
|
4
|
-
uuid: z.string().uuid(),
|
|
5
|
-
title: z.string(),
|
|
6
|
-
icon: z.string(),
|
|
7
|
-
order: z.number(),
|
|
8
|
-
minPages: z.number(),
|
|
9
|
-
maxPages: z.number(),
|
|
10
|
-
createdAt: z.date(),
|
|
11
|
-
updatedAt: z.date(),
|
|
12
|
-
});
|
|
13
|
-
export type WriterDocumentType = z.infer<typeof WriterDocumentTypeSchema>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { WriterDocumentOutlineSchema } from './writer-document-outline.schema';
|
|
3
|
-
import { WRITER_DOCUMENT_STAGE } from '../../../constants';
|
|
4
|
-
|
|
5
|
-
export const WriterDocumentSchema = z.object({
|
|
6
|
-
uuid: z.string().uuid(),
|
|
7
|
-
prompt: z.string(),
|
|
8
|
-
topic: z.string(),
|
|
9
|
-
typeId: z.string(),
|
|
10
|
-
stage: z.nativeEnum(WRITER_DOCUMENT_STAGE),
|
|
11
|
-
outline: WriterDocumentOutlineSchema,
|
|
12
|
-
sourceMd: z.string().nullable(),
|
|
13
|
-
finalMd: z.string().nullable(),
|
|
14
|
-
userId: z.string().nullable(),
|
|
15
|
-
unregisteredUserId: z.string().nullable(),
|
|
16
|
-
pages: z.number(),
|
|
17
|
-
createdAt: z.date(),
|
|
18
|
-
updatedAt: z.date(),
|
|
19
|
-
completedAt: z.date().nullable(),
|
|
20
|
-
});
|
|
21
|
-
export type WriterDocument = z.infer<typeof WriterDocumentSchema>;
|