@zodic/shared 0.0.48 → 0.0.50

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.
@@ -61,6 +61,13 @@ export class AppContext {
61
61
  return this.env.KV_USER_PRODUCT_STATUS;
62
62
  }
63
63
 
64
+ kvConceptsManagementStore() {
65
+ if (!this.env.KV_CONCEPTS_MANAGEMENT) {
66
+ throw new Error('KV_LEONARDO_PROMPTS is not defined in the environment.');
67
+ }
68
+ return this.env.KV_CONCEPTS_MANAGEMENT;
69
+ }
70
+
64
71
  api() {
65
72
  return Api(this.env);
66
73
  }
@@ -26,7 +26,7 @@ export class ConceptService {
26
26
  conceptSlug,
27
27
  });
28
28
 
29
- const response = await this.context.api().callChatGPT(messages, {});
29
+ const response = await this.context.api().callChatGPT.single(messages, {});
30
30
  if (!response) {
31
31
  throw new Error(
32
32
  `Failed to generate basic info for concept: ${conceptSlug}`
@@ -92,7 +92,7 @@ export class ConceptService {
92
92
  combination: combinationString,
93
93
  });
94
94
 
95
- const response = await this.context.api().callChatGPT(messages, {});
95
+ const response = await this.context.api().callChatGPT.single(messages, {});
96
96
  if (!response) {
97
97
  throw new Error(
98
98
  `Failed to generate Leonardo prompt for concept: ${conceptSlug}`
@@ -135,7 +135,7 @@ export class ConceptService {
135
135
  poem: concept.poem,
136
136
  });
137
137
 
138
- const response = await this.context.api().callChatGPT(messages, {});
138
+ const response = await this.context.api().callChatGPT.single(messages, {});
139
139
  if (!response) {
140
140
  throw new Error(`Failed to generate content for concept: ${conceptSlug}`);
141
141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.48",
3
+ "version": "0.0.50",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,5 +1,3 @@
1
- import { ConceptPhase } from "./legacy";
2
-
3
1
  export type Provider = 'google' | 'facebook';
4
2
 
5
3
  export type ProviderInfo = {
@@ -167,14 +165,14 @@ export type ChatGPTBatchResponse = {
167
165
  input_file_id: string; // ID of the input file
168
166
  completion_window: string; // Time window for completions (e.g., "24h")
169
167
  status:
170
- | "validating"
171
- | "in_progress"
172
- | "finalizing"
173
- | "completed"
174
- | "failed"
175
- | "expired"
176
- | "cancelling"
177
- | "cancelled"; // Current status of the batch
168
+ | 'validating'
169
+ | 'in_progress'
170
+ | 'finalizing'
171
+ | 'completed'
172
+ | 'failed'
173
+ | 'expired'
174
+ | 'cancelling'
175
+ | 'cancelled'; // Current status of the batch
178
176
  output_file_id: string | null; // ID of the output file, if available
179
177
  error_file_id: string | null; // ID of the error file, if available
180
178
  created_at: number; // Timestamp when the batch was created
@@ -218,4 +216,17 @@ export type ChatGPTFileUploadResponse = {
218
216
  created_at: number; // Timestamp when the file was created
219
217
  filename: string; // Name of the uploaded file
220
218
  purpose: string; // Purpose of the file, e.g., "fine-tune"
221
- };
219
+ };
220
+
221
+ export type ConceptPhase =
222
+ | 'basic-info'
223
+ | 'leonardo-prompt'
224
+ | 'content'
225
+ | 'images';
226
+
227
+ export const ConceptPhases: Record<string, ConceptPhase> = {
228
+ BASIC_INFO: 'basic-info',
229
+ LEONARDO_PROMPT: 'leonardo-prompt',
230
+ CONTENT: 'content',
231
+ IMAGES: 'images',
232
+ };
@@ -1,11 +1,7 @@
1
1
  import { BackendBindings } from './cloudflare';
2
2
  import { Gender } from './generic';
3
3
 
4
- export type ConceptPhase =
5
- | 'basic-info'
6
- | 'leonardo-prompt'
7
- | 'content'
8
- | 'images';
4
+
9
5
 
10
6
  export const zodiacSigns = [
11
7
  'Aries',