@zodic/shared 0.0.47 → 0.0.49
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 → app/api}/index.ts
RENAMED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BackendBindings,
|
|
3
3
|
BatchInputItem,
|
|
4
|
-
BatchProcessingResult,
|
|
5
|
-
BatchResponse,
|
|
6
4
|
ChatGPTBatchResponse,
|
|
7
5
|
ChatGPTFileUploadResponse,
|
|
8
6
|
ChatMessages,
|
|
9
7
|
NatalChartInterpretation,
|
|
10
|
-
} from '
|
|
8
|
+
} from '../../types';
|
|
11
9
|
import {
|
|
12
10
|
AstrologyApiResponse,
|
|
13
11
|
ChatGPTOptions,
|
|
@@ -19,7 +17,7 @@ import {
|
|
|
19
17
|
LeonardoUploadImageParams,
|
|
20
18
|
NatalHouseCuspReport,
|
|
21
19
|
TimezoneResponse,
|
|
22
|
-
} from '
|
|
20
|
+
} from '../../types/scopes/legacy';
|
|
23
21
|
import { makeAstrologyApiCall } from './astrology';
|
|
24
22
|
|
|
25
23
|
export const Api = (env: BackendBindings) => ({
|
|
@@ -120,16 +118,12 @@ export const Api = (env: BackendBindings) => ({
|
|
|
120
118
|
);
|
|
121
119
|
}
|
|
122
120
|
|
|
123
|
-
const batchData = (await batchResponse.json()) as
|
|
121
|
+
const batchData = (await batchResponse.json()) as ChatGPTBatchResponse;
|
|
124
122
|
console.log(`Batch created successfully. Batch ID: ${batchData.id}`);
|
|
125
123
|
|
|
126
124
|
// Step 3: Poll for batch results (not shown here; depends on the implementation)
|
|
127
125
|
|
|
128
|
-
return
|
|
129
|
-
id: item.id,
|
|
130
|
-
status: 'completed', // Placeholder; actual status would depend on polling results
|
|
131
|
-
content: undefined, // Placeholder for actual response
|
|
132
|
-
}));
|
|
126
|
+
return batchData;
|
|
133
127
|
} catch (error) {
|
|
134
128
|
console.error('Error in callChatGPTBatch:', error);
|
|
135
129
|
throw error;
|
package/app/base/AppContext.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { drizzle } from 'drizzle-orm/d1';
|
|
2
|
-
import { Api } from '../../api';
|
|
3
2
|
import * as schema from '../../db/schema';
|
|
4
3
|
import { BackendBindings } from '../../types';
|
|
5
4
|
import { buildChatGPTMessages } from '../../utils/buildMessages';
|
|
5
|
+
import { Api } from '../api';
|
|
6
6
|
|
|
7
7
|
export class AppContext {
|
|
8
8
|
private _drizzle?: ReturnType<typeof drizzle>;
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ export type CentralBindings = {
|
|
|
21
21
|
KV_USER_GENERATIONS: KVNamespace;
|
|
22
22
|
KV_COSMIC_MIRROR_ARCHETYPES: KVNamespace;
|
|
23
23
|
KV_CONCEPTS: KVNamespace;
|
|
24
|
+
KV_CONCEPTS_MANAGEMENT: KVNamespace;
|
|
24
25
|
KV_LEONARDO_PROMPTS: KVNamespace;
|
|
25
26
|
KV_TEST: KVNamespace;
|
|
26
27
|
KV_USER_PRODUCT_STATUS: KVNamespace;
|
|
@@ -111,6 +112,7 @@ export type BackendBindings = Env &
|
|
|
111
112
|
| 'KV_USER_PRODUCT_STATUS'
|
|
112
113
|
| 'PIAPI_API_KEY'
|
|
113
114
|
| 'CONCEPT_GENERATION_QUEUE'
|
|
115
|
+
| 'KV_CONCEPTS_MANAGEMENT'
|
|
114
116
|
>;
|
|
115
117
|
|
|
116
118
|
export type BackendCtx = Context<
|
|
File without changes
|