@purpleschool/gptbot 0.12.0 → 0.12.2

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.
Files changed (65) hide show
  1. package/api/controllers/http/writer.ts +6 -0
  2. package/api/routes.ts +20 -0
  3. package/build/api/controllers/http/writer.js +5 -0
  4. package/build/api/routes.js +10 -0
  5. package/build/commands/cabinet/get-user-statistics-by-month.command.js +12 -1
  6. package/build/commands/team-account/get-team-account-statistics-by-month.command.js +12 -1
  7. package/build/commands/tools/presentation/create-presentation.command.js +2 -0
  8. package/build/commands/tools/presentation/generate-presentation-slides.command.js +3 -0
  9. package/build/commands/tools/presentation/update-presentation.command.js +1 -0
  10. package/build/commands/tools/writer/collect-writer-document-sources.command.js +15 -0
  11. package/build/commands/tools/writer/confirm-source-citation-metadata.command.js +19 -0
  12. package/build/commands/tools/writer/get-writer-document-sources.command.js +14 -0
  13. package/build/commands/tools/writer/index.js +4 -0
  14. package/build/commands/tools/writer/upload-writer-source.command.js +17 -0
  15. package/build/constants/cabinet/enums/index.js +0 -1
  16. package/build/constants/presentation/enums/index.js +1 -0
  17. package/build/constants/presentation/enums/presentation-target-audience.enum.js +10 -0
  18. package/build/constants/writer/enums/index.js +3 -0
  19. package/build/constants/writer/enums/writer-document-stage.enum.js +6 -0
  20. package/build/constants/writer/enums/writer-source-origin.enum.js +8 -0
  21. package/build/constants/writer/enums/writer-source-status.enum.js +9 -0
  22. package/build/constants/writer/enums/writer-source-type.enum.js +8 -0
  23. package/build/models/tools/presentation/index.js +1 -0
  24. package/build/models/tools/presentation/presentation-template.schema.js +2 -0
  25. package/build/models/tools/presentation/presentation-title-page.schema.js +9 -0
  26. package/build/models/tools/presentation/presentation.schema.js +3 -0
  27. package/build/models/tools/presentation/slide-content-edit.schema.js +18 -12
  28. package/build/models/tools/presentation/slide-content.schema.js +34 -24
  29. package/build/models/tools/writer/index.js +2 -0
  30. package/build/models/tools/writer/writer-document-type.schema.js +2 -0
  31. package/build/models/tools/writer/writer-document.schema.js +3 -0
  32. package/build/models/tools/writer/writer-source-bibliographic-metadata.schema.js +27 -0
  33. package/build/models/tools/writer/writer-source.schema.js +20 -0
  34. package/commands/cabinet/get-user-statistics-by-month.command.ts +13 -6
  35. package/commands/team-account/get-team-account-statistics-by-month.command.ts +13 -6
  36. package/commands/tools/presentation/create-presentation.command.ts +2 -0
  37. package/commands/tools/presentation/generate-presentation-slides.command.ts +10 -1
  38. package/commands/tools/presentation/update-presentation.command.ts +1 -0
  39. package/commands/tools/writer/collect-writer-document-sources.command.ts +17 -0
  40. package/commands/tools/writer/confirm-source-citation-metadata.command.ts +21 -0
  41. package/commands/tools/writer/get-writer-document-sources.command.ts +14 -0
  42. package/commands/tools/writer/index.ts +4 -0
  43. package/commands/tools/writer/upload-writer-source.command.ts +19 -0
  44. package/constants/cabinet/enums/index.ts +0 -1
  45. package/constants/presentation/enums/index.ts +1 -0
  46. package/constants/presentation/enums/presentation-target-audience.enum.ts +6 -0
  47. package/constants/writer/enums/index.ts +3 -0
  48. package/constants/writer/enums/writer-document-stage.enum.ts +8 -0
  49. package/constants/writer/enums/writer-source-origin.enum.ts +4 -0
  50. package/constants/writer/enums/writer-source-status.enum.ts +5 -0
  51. package/constants/writer/enums/writer-source-type.enum.ts +4 -0
  52. package/models/tools/presentation/index.ts +1 -0
  53. package/models/tools/presentation/presentation-template.schema.ts +2 -0
  54. package/models/tools/presentation/presentation-title-page.schema.ts +9 -0
  55. package/models/tools/presentation/presentation.schema.ts +8 -1
  56. package/models/tools/presentation/slide-content-edit.schema.ts +18 -12
  57. package/models/tools/presentation/slide-content.schema.ts +50 -40
  58. package/models/tools/writer/index.ts +2 -0
  59. package/models/tools/writer/writer-document-type.schema.ts +2 -0
  60. package/models/tools/writer/writer-document.schema.ts +3 -0
  61. package/models/tools/writer/writer-source-bibliographic-metadata.schema.ts +31 -0
  62. package/models/tools/writer/writer-source.schema.ts +20 -0
  63. package/package.json +1 -1
  64. package/build/constants/cabinet/enums/statistics-request-type.enum.js +0 -22
  65. package/constants/cabinet/enums/statistics-request-type.enum.ts +0 -18
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- import {
3
- JOB_REQUEST_ORIGIN,
4
- STATISTICS_METRIC_TYPE,
5
- STATISTICS_REQUEST_TYPE,
6
- } from '../../constants';
2
+ import { JOB_REQUEST_ORIGIN, STATISTICS_METRIC_TYPE } from '../../constants';
7
3
 
8
4
  export namespace GetUserStatisticsByMonthCommand {
9
5
  export const RequestSchema = z.object({
@@ -18,7 +14,18 @@ export namespace GetUserStatisticsByMonthCommand {
18
14
 
19
15
  export const UserStatisticsByMonthResponseSchema = z.object({
20
16
  month: z.string(),
21
- statistics: z.record(z.nativeEnum(STATISTICS_REQUEST_TYPE), z.number()),
17
+ total_texts: z.number(),
18
+ total_audios: z.number(),
19
+ total_images: z.number(),
20
+ total_videos: z.number(),
21
+ total_presentations: z.number(),
22
+ total_paraphrases: z.number(),
23
+ writers: z.object({
24
+ total_writers: z.number(),
25
+ total_writer_actions: z.number(),
26
+ }),
27
+ total_video_edits: z.number(),
28
+ total_musics: z.number(),
22
29
  });
23
30
 
24
31
  export const ResponseSchema = z.object({
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- import {
3
- JOB_REQUEST_ORIGIN,
4
- STATISTICS_METRIC_TYPE,
5
- STATISTICS_REQUEST_TYPE,
6
- } from '../../constants';
2
+ import { JOB_REQUEST_ORIGIN, STATISTICS_METRIC_TYPE } from '../../constants';
7
3
 
8
4
  export namespace GetTeamAccountStatisticsByMonthCommand {
9
5
  export const RequestSchema = z.object({
@@ -19,7 +15,18 @@ export namespace GetTeamAccountStatisticsByMonthCommand {
19
15
 
20
16
  export const TeamAccountStatisticsByMonthItemSchema = z.object({
21
17
  month: z.string(),
22
- statistics: z.record(z.nativeEnum(STATISTICS_REQUEST_TYPE), z.number()),
18
+ total_texts: z.number(),
19
+ total_audios: z.number(),
20
+ total_images: z.number(),
21
+ total_videos: z.number(),
22
+ total_presentations: z.number(),
23
+ total_paraphrases: z.number(),
24
+ writers: z.object({
25
+ total_writers: z.number(),
26
+ total_writer_actions: z.number(),
27
+ }),
28
+ total_video_edits: z.number(),
29
+ total_musics: z.number(),
23
30
  });
24
31
 
25
32
  export const ResponseSchema = z.object({
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { PresentationSchema } from '../../../models/tools/presentation';
3
+ import { PRESENTATION_TARGET_AUDIENCE } from '../../../constants';
3
4
 
4
5
  export namespace CreatePresentationCommand {
5
6
  export const RequestSchema = z.object({
@@ -7,6 +8,7 @@ export namespace CreatePresentationCommand {
7
8
  slideCount: z.number().min(1).max(20),
8
9
  templateId: z.string().uuid(),
9
10
  languageId: z.string().uuid(),
11
+ targetAudience: z.nativeEnum(PRESENTATION_TARGET_AUDIENCE).optional(),
10
12
  });
11
13
 
12
14
  export type Request = z.infer<typeof RequestSchema>;
@@ -1,11 +1,20 @@
1
1
  import { z } from 'zod';
2
- import { PresentationSchema } from '../../../models/tools/presentation';
2
+ import {
3
+ PresentationSchema,
4
+ PresentationTitlePageSchema,
5
+ } from '../../../models/tools/presentation';
3
6
 
4
7
  export namespace GeneratePresentationSlidesCommand {
5
8
  export const RequestParamsSchema = z.object({
6
9
  uuid: z.string().uuid(),
7
10
  });
8
11
 
12
+ export type Request = z.infer<typeof RequestParamsSchema>;
13
+
14
+ export const RequestSchema = z.object({
15
+ titlePage: PresentationTitlePageSchema.optional().nullable(),
16
+ });
17
+
9
18
  export type RequestParams = z.infer<typeof RequestParamsSchema>;
10
19
 
11
20
  export const ResponseSchema = z.object({
@@ -10,6 +10,7 @@ export namespace UpdatePresentationCommand {
10
10
  export const RequestBodySchema = PresentationSchema.pick({
11
11
  title: true,
12
12
  templateId: true,
13
+ titlePage: true,
13
14
  }).partial();
14
15
  export type Request = z.infer<typeof RequestBodySchema>;
15
16
 
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { WriterDocumentSchema } from '../../../models';
3
+
4
+ export namespace CollectWriterDocumentSourcesCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const RequestBodySchema = z.object({});
11
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: WriterDocumentSchema,
15
+ });
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { WriterSourceSchema } from '../../../models';
3
+ import { WriterSourceBibliographicMetadataSchema } from '../../../models';
4
+
5
+ export namespace ConfirmSourceCitationMetadataCommand {
6
+ export const RequestParamsSchema = z.object({
7
+ docId: z.string().uuid(),
8
+ sourceId: z.string().uuid(),
9
+ });
10
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
11
+
12
+ export const RequestBodySchema = z.object({
13
+ bibliographicMetadata: WriterSourceBibliographicMetadataSchema,
14
+ });
15
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
16
+
17
+ export const ResponseSchema = z.object({
18
+ data: WriterSourceSchema,
19
+ });
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { WriterSourceSchema } from '../../../models';
3
+
4
+ export namespace GetWriterDocumentSourcesCommand {
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: z.array(WriterSourceSchema),
12
+ });
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -16,3 +16,7 @@ export * from './writer-fix-errors.command';
16
16
  export * from './writer-generate-text.command';
17
17
  export * from './export-writer-document-as-docx.command';
18
18
  export * from './set-reaction.writer-document.command';
19
+ export * from './collect-writer-document-sources.command';
20
+ export * from './get-writer-document-sources.command';
21
+ export * from './upload-writer-source.command';
22
+ export * from './confirm-source-citation-metadata.command';
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { WriterSourceSchema } from '../../../models';
3
+
4
+ export namespace UploadWriterSourceCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const RequestBodySchema = z.object({
11
+ fileId: z.string().uuid(),
12
+ });
13
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: WriterSourceSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -1,3 +1,2 @@
1
1
  export * from './group-by.enum';
2
2
  export * from './statistics-metric-type.enum';
3
- export * from './statistics-request-type.enum';
@@ -7,3 +7,4 @@ export * from './slide-image-slot-action.enum';
7
7
  export * from './presentation-ai-action-type.enum';
8
8
  export * from './presentation-ai-action-pricing-type.enum';
9
9
  export * from './presentation-ai-action-call-status.enum';
10
+ export * from './presentation-target-audience.enum';
@@ -0,0 +1,6 @@
1
+ export enum PRESENTATION_TARGET_AUDIENCE {
2
+ NONE = 'NONE',
3
+ SCHOOL = 'SCHOOL',
4
+ UNIVERSITY = 'UNIVERSITY',
5
+ BUSINESS = 'BUSINESS',
6
+ }
@@ -3,3 +3,6 @@ export * from './writer-document-stage.enum';
3
3
  export * from './writer-ai-action-pricing-type.enum';
4
4
  export * from './writer-ai-action-type.enum';
5
5
  export * from './tool-model-status.enum';
6
+ export * from './writer-source-status.enum';
7
+ export * from './writer-source-origin.enum';
8
+ export * from './writer-source-type.enum';
@@ -1,10 +1,18 @@
1
1
  export enum WRITER_DOCUMENT_STAGE {
2
2
  CREATED = 'CREATED',
3
3
 
4
+ ANALYZING_TOPIC = 'ANALYZING_TOPIC',
5
+ TOPIC_ANALYZED = 'TOPIC_ANALYZED',
6
+ TOPIC_ANALYSIS_FAILED = 'TOPIC_ANALYSIS_FAILED',
7
+
4
8
  GENERATING_OUTLINE = 'GENERATING_OUTLINE',
5
9
  OUTLINE_GENERATED = 'OUTLINE_GENERATED',
6
10
  OUTLINE_GENERATION_FAILED = 'OUTLINE_GENERATION_FAILED',
7
11
 
12
+ COLLECTING_SOURCES = 'COLLECTING_SOURCES',
13
+ SOURCES_COLLECTED = 'SOURCES_COLLECTED',
14
+ SOURCES_COLLECTION_FAILED = 'SOURCES_COLLECTION_FAILED',
15
+
8
16
  GENERATING_CONTENT = 'GENERATING_CONTENT',
9
17
  CONTENT_GENERATED = 'CONTENT_GENERATED',
10
18
  CONTENT_GENERATION_FAILED = 'CONTENT_GENERATION_FAILED',
@@ -0,0 +1,4 @@
1
+ export enum WRITER_SOURCE_ORIGIN {
2
+ WEB_SEARCH = 'WEB_SEARCH',
3
+ USER_UPLOAD = 'USER_UPLOAD',
4
+ }
@@ -0,0 +1,5 @@
1
+ export enum WRITER_SOURCE_STATUS {
2
+ READY = 'READY',
3
+ REQUIRES_CITATION_METADATA_CONFIRMATION = 'REQUIRES_CITATION_METADATA_CONFIRMATION',
4
+ DISCARDED = 'DISCARDED',
5
+ }
@@ -0,0 +1,4 @@
1
+ export enum WRITER_SOURCE_TYPE {
2
+ JOURNAL_ARTICLE = 'JOURNAL_ARTICLE',
3
+ BOOK = 'BOOK',
4
+ }
@@ -6,3 +6,4 @@ export * from './slide.schema';
6
6
  export * from './slide-content.schema';
7
7
  export * from './presentation-config.schema';
8
8
  export * from './presentation-ai-action.schema';
9
+ export * from './presentation-title-page.schema';
@@ -6,6 +6,8 @@ export const PresentationTemplateSchema = z.object({
6
6
  image: z.string(),
7
7
  order: z.number(),
8
8
  imagePlaceholder: z.string(),
9
+ price: z.number(),
10
+ isPremium: z.boolean(),
9
11
  createdAt: z.date(),
10
12
  updatedAt: z.date(),
11
13
  });
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+
3
+ export const PresentationTitlePageSchema = z.object({
4
+ author: z.string().optional().nullable(),
5
+ createdAt: z.coerce.date().optional().nullable(),
6
+ email: z.string().email().optional().nullable(),
7
+ });
8
+
9
+ export type PresentationTitlePage = z.infer<typeof PresentationTitlePageSchema>;
@@ -1,7 +1,12 @@
1
1
  import { z } from 'zod';
2
- import { PRESENTATION_STAGE, USER_REACTION } from '../../../constants';
2
+ import {
3
+ PRESENTATION_STAGE,
4
+ PRESENTATION_TARGET_AUDIENCE,
5
+ USER_REACTION,
6
+ } from '../../../constants';
3
7
  import { SlideOutlineSchema } from './slide-outline.schema';
4
8
  import { SlideSchema } from './slide.schema';
9
+ import { PresentationTitlePageSchema } from './presentation-title-page.schema';
5
10
 
6
11
  export const PresentationSchema = z.object({
7
12
  uuid: z.string().uuid(),
@@ -17,6 +22,8 @@ export const PresentationSchema = z.object({
17
22
  slideCount: z.number(),
18
23
  lastContentUpdateAt: z.date().nullable(),
19
24
  lastPptxExportedAt: z.date().nullable(),
25
+ titlePage: PresentationTitlePageSchema.nullable(),
26
+ targetAudience: z.nativeEnum(PRESENTATION_TARGET_AUDIENCE),
20
27
  createdAt: z.date(),
21
28
  updatedAt: z.date(),
22
29
  });
@@ -19,18 +19,24 @@ import { SLIDE_CONTENT_TYPE } from '../../../constants';
19
19
  export const CoverSlideDataUserEditSchema = z.object({
20
20
  contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
21
21
  title: z.string().max(1000),
22
- author: z.object({
23
- label: z.string().max(200),
24
- value: z.string().max(500),
25
- }),
26
- date: z.object({
27
- label: z.string().max(200),
28
- value: z.string().max(500),
29
- }),
30
- email: z.object({
31
- label: z.string().max(200),
32
- value: z.string().max(500),
33
- }),
22
+ author: z
23
+ .object({
24
+ label: z.string().min(1).max(100),
25
+ value: z.string().min(1).max(200),
26
+ })
27
+ .optional(),
28
+ date: z
29
+ .object({
30
+ label: z.string().min(1).max(100),
31
+ value: z.string().min(1).max(200),
32
+ })
33
+ .optional(),
34
+ email: z
35
+ .object({
36
+ label: z.string().min(1).max(100),
37
+ value: z.string().min(1).max(200),
38
+ })
39
+ .optional(),
34
40
  version: z.literal(1),
35
41
  }) satisfies z.ZodType<ICoverSlideDataStructure>;
36
42
 
@@ -26,18 +26,18 @@ export type IconSlot = z.infer<typeof IconSlotSchema>;
26
26
  export interface ICoverSlideDataStructure {
27
27
  contentType: SLIDE_CONTENT_TYPE.COVER;
28
28
  title: string;
29
- author: { label: string; value: string };
30
- date: { label: string; value: string };
31
- email: { label: string; value: string };
29
+ author?: { label: string; value: string };
30
+ date?: { label: string; value: string };
31
+ email?: { label: string; value: string };
32
32
  version: 1;
33
33
  }
34
34
 
35
35
  export interface IThankYouSlideDataStructure {
36
36
  contentType: SLIDE_CONTENT_TYPE.THANK_YOU;
37
37
  title: string;
38
- author: { label: string; value: string };
39
- date: { label: string; value: string };
40
- email: { label: string; value: string };
38
+ author?: { label: string; value: string };
39
+ date?: { label: string; value: string };
40
+ email?: { label: string; value: string };
41
41
  version: 1;
42
42
  }
43
43
 
@@ -125,24 +125,28 @@ export interface ITimelineSlideDataStructure {
125
125
  export const CoverSlideDataSchema = z.object({
126
126
  contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
127
127
  title: z.string().describe('Slide title in about 6 words').min(10).max(150),
128
- author: z.object({
129
- label: z.string().describe('Literal "Author" in presentation\'s language'),
130
- value: z
131
- .string()
132
- .describe('Literal "Author of the presentation" in presentation\'s language'),
133
- }),
134
- date: z.object({
135
- label: z.string().describe('Literal "Date" in presentation\'s language'),
136
- value: z
137
- .string()
138
- .describe(
139
- 'Date of the presentation in the "dd month yyyy" format in presentation\'s locale',
140
- ),
141
- }),
142
- email: z.object({
143
- label: z.string().describe('Just default word "Email"'),
144
- value: z.string().describe('Just default "email@example.com"'),
145
- }),
128
+ author: z
129
+ .object({
130
+ label: z.string().describe('Literal "Author" in presentation\'s language'),
131
+ value: z.string().describe('Author value from titlePage if provided'),
132
+ })
133
+ .optional(),
134
+ date: z
135
+ .object({
136
+ label: z.string().describe('Literal "Date" in presentation\'s language'),
137
+ value: z
138
+ .string()
139
+ .describe(
140
+ 'Date from titlePage in the "dd month yyyy" format in presentation\'s locale',
141
+ ),
142
+ })
143
+ .optional(),
144
+ email: z
145
+ .object({
146
+ label: z.string().describe('Localized contact/email label'),
147
+ value: z.string().describe('Email value from titlePage if provided'),
148
+ })
149
+ .optional(),
146
150
  version: z.literal(1),
147
151
  }) satisfies z.ZodType<ICoverSlideDataStructure>;
148
152
  export type CoverSlideData = z.infer<typeof CoverSlideDataSchema>;
@@ -154,22 +158,28 @@ export const ThankYouSlideDataSchema = z.object({
154
158
  .describe('"Thank you for your attention" in presentation\'s language')
155
159
  .min(10)
156
160
  .max(150),
157
- author: z.object({
158
- label: z.string().describe('"Author" in presentation\'s language'),
159
- value: z.string().describe('"Author of the presentation" in presentation\'s language'),
160
- }),
161
- date: z.object({
162
- label: z.string().describe('"Date" in presentation\'s language'),
163
- value: z
164
- .string()
165
- .describe(
166
- 'Date of the presentation in the "dd month yyyy" format in presentation\'s locale',
167
- ),
168
- }),
169
- email: z.object({
170
- label: z.string().describe('Just default word "Email"'),
171
- value: z.string().describe('Just default "email@example.com"'),
172
- }),
161
+ author: z
162
+ .object({
163
+ label: z.string().describe('Literal "Author" in presentation\'s language'),
164
+ value: z.string().describe('Author value from titlePage if provided'),
165
+ })
166
+ .optional(),
167
+ date: z
168
+ .object({
169
+ label: z.string().describe('Literal "Date" in presentation\'s language'),
170
+ value: z
171
+ .string()
172
+ .describe(
173
+ 'Date from titlePage in the "dd month yyyy" format in presentation\'s locale',
174
+ ),
175
+ })
176
+ .optional(),
177
+ email: z
178
+ .object({
179
+ label: z.string().describe('Localized contact/email label'),
180
+ value: z.string().describe('Email value from titlePage if provided'),
181
+ })
182
+ .optional(),
173
183
  version: z.literal(1),
174
184
  }) satisfies z.ZodType<IThankYouSlideDataStructure>;
175
185
  export type ThankYouSlideData = z.infer<typeof ThankYouSlideDataSchema>;
@@ -4,3 +4,5 @@ export * from './writer-document-outline.schema';
4
4
  export * from './writer-document.schema';
5
5
  export * from './writer-document-type.schema';
6
6
  export * from './writer-document-title-page.schema';
7
+ export * from './writer-source.schema';
8
+ export * from './writer-source-bibliographic-metadata.schema';
@@ -8,7 +8,9 @@ export const WriterDocumentTypeSchema = z.object({
8
8
  order: z.number(),
9
9
  minPages: z.number(),
10
10
  maxPages: z.number(),
11
+ skipSources: z.boolean(),
11
12
  pageRange: z.array(z.number()),
13
+ needsTableOfContents: z.boolean(),
12
14
  createdAt: z.date(),
13
15
  updatedAt: z.date(),
14
16
  });
@@ -18,6 +18,9 @@ export const WriterDocumentSchema = z.object({
18
18
  unregisteredUserId: z.string().nullable(),
19
19
  modelId: z.string().nullable(),
20
20
  reaction: z.nativeEnum(USER_REACTION).nullable(),
21
+ dislikeReason: z.string().nullable(),
22
+ description: z.string().nullable(),
23
+ skipSources: z.boolean(),
21
24
  pages: z.number(),
22
25
  createdAt: z.date(),
23
26
  updatedAt: z.date(),
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { WRITER_SOURCE_TYPE } from '../../../constants';
3
+
4
+ export const WriterSourceBibliographicMetadataBookSchema = z.object({
5
+ type: z.literal(WRITER_SOURCE_TYPE.BOOK),
6
+ title: z.string(),
7
+ authors: z.string(),
8
+ year: z.number(),
9
+ publicationCity: z.string(),
10
+ publisher: z.string(),
11
+ pageCount: z.number().nullable(),
12
+ });
13
+
14
+ export const WriterSourceBibliographicMetadataJournalArticleSchema = z.object({
15
+ type: z.literal(WRITER_SOURCE_TYPE.JOURNAL_ARTICLE),
16
+ title: z.string(),
17
+ authors: z.string(),
18
+ year: z.number(),
19
+ journalName: z.string(),
20
+ issueNumber: z.string(),
21
+ pageRange: z.string(),
22
+ });
23
+
24
+ export const WriterSourceBibliographicMetadataSchema = z.discriminatedUnion('type', [
25
+ WriterSourceBibliographicMetadataBookSchema,
26
+ WriterSourceBibliographicMetadataJournalArticleSchema,
27
+ ]);
28
+
29
+ export type WriterSourceBibliographicMetadata = z.infer<
30
+ typeof WriterSourceBibliographicMetadataSchema
31
+ >;
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { WRITER_SOURCE_STATUS, WRITER_SOURCE_ORIGIN } from '../../../constants';
3
+ import { WriterSourceBibliographicMetadataSchema } from './writer-source-bibliographic-metadata.schema';
4
+
5
+ export const WriterSourceSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ query: z.string().nullable(),
8
+ url: z.string(),
9
+ snippet: z.string().nullable(),
10
+ sourceOrigin: z.nativeEnum(WRITER_SOURCE_ORIGIN),
11
+ documentId: z.string().uuid(),
12
+ fileId: z.string().nullable(),
13
+ citation: z.string().nullable(),
14
+ status: z.nativeEnum(WRITER_SOURCE_STATUS),
15
+ bibliographicMetadata: WriterSourceBibliographicMetadataSchema.nullable(),
16
+ createdAt: z.date(),
17
+ updatedAt: z.date(),
18
+ });
19
+
20
+ export type WriterSource = z.infer<typeof WriterSourceSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STATISTICS_REQUEST_TYPE = void 0;
4
- var STATISTICS_REQUEST_TYPE;
5
- (function (STATISTICS_REQUEST_TYPE) {
6
- STATISTICS_REQUEST_TYPE["IMAGE"] = "IMAGE";
7
- STATISTICS_REQUEST_TYPE["VIDEO"] = "VIDEO";
8
- STATISTICS_REQUEST_TYPE["PRESENTATION"] = "PRESENTATION";
9
- STATISTICS_REQUEST_TYPE["TEXT"] = "TEXT";
10
- STATISTICS_REQUEST_TYPE["AUDIO"] = "AUDIO";
11
- STATISTICS_REQUEST_TYPE["PARAPHRASE"] = "PARAPHRASE";
12
- STATISTICS_REQUEST_TYPE["WRITER"] = "WRITER";
13
- STATISTICS_REQUEST_TYPE["PRESENTATION_AI_ACTION"] = "PRESENTATION_AI_ACTION";
14
- STATISTICS_REQUEST_TYPE["WRITER_ACTION"] = "WRITER_ACTION";
15
- STATISTICS_REQUEST_TYPE["VIDEO_EDITOR"] = "VIDEO_EDITOR";
16
- STATISTICS_REQUEST_TYPE["MUSIC"] = "MUSIC";
17
- STATISTICS_REQUEST_TYPE["MUSIC_ACTION"] = "MUSIC_ACTION";
18
- STATISTICS_REQUEST_TYPE["INTERIOR_DESIGN"] = "INTERIOR_DESIGN";
19
- STATISTICS_REQUEST_TYPE["MARKETPLACE_CARD"] = "MARKETPLACE_CARD";
20
- STATISTICS_REQUEST_TYPE["SOLVING_EDU_TASK"] = "SOLVING_EDU_TASK";
21
- STATISTICS_REQUEST_TYPE["SPELL_CORRECTOR"] = "SPELL_CORRECTOR";
22
- })(STATISTICS_REQUEST_TYPE || (exports.STATISTICS_REQUEST_TYPE = STATISTICS_REQUEST_TYPE = {}));
@@ -1,18 +0,0 @@
1
- export enum STATISTICS_REQUEST_TYPE {
2
- IMAGE = 'IMAGE',
3
- VIDEO = 'VIDEO',
4
- PRESENTATION = 'PRESENTATION',
5
- TEXT = 'TEXT',
6
- AUDIO = 'AUDIO',
7
- PARAPHRASE = 'PARAPHRASE',
8
- WRITER = 'WRITER',
9
- PRESENTATION_AI_ACTION = 'PRESENTATION_AI_ACTION',
10
- WRITER_ACTION = 'WRITER_ACTION',
11
- VIDEO_EDITOR = 'VIDEO_EDITOR',
12
- MUSIC = 'MUSIC',
13
- MUSIC_ACTION = 'MUSIC_ACTION',
14
- INTERIOR_DESIGN = 'INTERIOR_DESIGN',
15
- MARKETPLACE_CARD = 'MARKETPLACE_CARD',
16
- SOLVING_EDU_TASK = 'SOLVING_EDU_TASK',
17
- SPELL_CORRECTOR = 'SPELL_CORRECTOR',
18
- }