@purpleschool/gptbot 0.7.39-texteditor → 0.7.39
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 +64 -79
- 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 +67 -79
- 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-page-count.util.js +0 -37
- 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 -19
- 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 -11
- package/build/models/tools/writer/writer-document-outline.schema.js +0 -21
- package/build/models/tools/writer/writer-document-type.schema.js +0 -16
- 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-page-count.util.ts +0 -46
- 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 -3
- 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 -10
- package/models/tools/writer/writer-document-outline.schema.ts +0 -28
- package/models/tools/writer/writer-document-type.schema.ts +0 -15
- package/models/tools/writer/writer-document.schema.ts +0 -21
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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';
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -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,46 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -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,10 +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
|
-
maxPromptLength: z.number(),
|
|
7
|
-
documentTypes: z.array(WriterDocumentTypeSchema),
|
|
8
|
-
aiActions: z.array(WriterAiActionSchema),
|
|
9
|
-
});
|
|
10
|
-
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,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { IconVariantsSchema } from '../../icon-variants.schema';
|
|
3
|
-
|
|
4
|
-
export const WriterDocumentTypeSchema = z.object({
|
|
5
|
-
uuid: z.string().uuid(),
|
|
6
|
-
title: z.string(),
|
|
7
|
-
icons: IconVariantsSchema,
|
|
8
|
-
order: z.number(),
|
|
9
|
-
minPages: z.number(),
|
|
10
|
-
maxPages: z.number(),
|
|
11
|
-
pageRange: z.array(z.number()),
|
|
12
|
-
createdAt: z.date(),
|
|
13
|
-
updatedAt: z.date(),
|
|
14
|
-
});
|
|
15
|
-
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>;
|