@zodic/shared 0.0.71 → 0.0.72
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/app/api/index.ts +2 -2
- package/app/base/AppContext.ts +3 -3
- package/app/services/ConceptService.ts +12 -16
- package/package.json +1 -1
- package/utils/buildMessages.ts +2 -2
package/app/api/index.ts
CHANGED
|
@@ -26,8 +26,8 @@ import { makeAstrologyApiCall } from './astrology';
|
|
|
26
26
|
|
|
27
27
|
const deepseek = (env: BackendBindings) =>
|
|
28
28
|
new OpenAI({
|
|
29
|
-
apiKey: env.DEEPSEEK_API_KEY,
|
|
30
|
-
baseURL: 'https://api.deepseek.com/v1',
|
|
29
|
+
apiKey: env.DEEPSEEK_API_KEY,
|
|
30
|
+
baseURL: 'https://api.deepseek.com/v1',
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
export const Api = (env: BackendBindings) => ({
|
package/app/base/AppContext.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { drizzle } from 'drizzle-orm/d1';
|
|
2
2
|
import * as schema from '../../db/schema';
|
|
3
3
|
import { BackendBindings } from '../../types';
|
|
4
|
-
import {
|
|
4
|
+
import { buildLLMMessages } from '../../utils/buildMessages';
|
|
5
5
|
import { Api } from '../api';
|
|
6
6
|
|
|
7
7
|
export class AppContext {
|
|
@@ -9,8 +9,8 @@ export class AppContext {
|
|
|
9
9
|
|
|
10
10
|
constructor(public env: BackendBindings) {}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
buildLLMMessages() {
|
|
13
|
+
return buildLLMMessages(this.env);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
kvCosmicMirrorArchetypesStore() {
|
|
@@ -19,12 +19,10 @@ export class ConceptService {
|
|
|
19
19
|
`Generating basic info for concept: ${conceptSlug}, combination: ${combinationString}`
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
const messages = this.context
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
conceptSlug,
|
|
27
|
-
});
|
|
22
|
+
const messages = this.context.buildLLMMessages().generateConceptBasicInfo({
|
|
23
|
+
combination: combinationString,
|
|
24
|
+
conceptSlug,
|
|
25
|
+
});
|
|
28
26
|
|
|
29
27
|
const response = await this.context.api().callChatGPT.single(messages, {});
|
|
30
28
|
if (!response) {
|
|
@@ -86,7 +84,7 @@ export class ConceptService {
|
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
const messages = this.context
|
|
89
|
-
.
|
|
87
|
+
.buildLLMMessages()
|
|
90
88
|
.generateConceptLeonardoPrompt({
|
|
91
89
|
conceptSlug,
|
|
92
90
|
combination: combinationString,
|
|
@@ -125,15 +123,13 @@ export class ConceptService {
|
|
|
125
123
|
);
|
|
126
124
|
}
|
|
127
125
|
|
|
128
|
-
const messages = this.context
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
poem: concept.poem,
|
|
136
|
-
});
|
|
126
|
+
const messages = this.context.buildLLMMessages().generateConceptContent({
|
|
127
|
+
conceptSlug,
|
|
128
|
+
combination: combinationString,
|
|
129
|
+
name: concept.name,
|
|
130
|
+
description: concept.description,
|
|
131
|
+
poem: concept.poem,
|
|
132
|
+
});
|
|
137
133
|
|
|
138
134
|
const response = await this.context.api().callChatGPT.single(messages, {});
|
|
139
135
|
if (!response) {
|
package/package.json
CHANGED
package/utils/buildMessages.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BackendBindings, ChatMessages, Crown } from '../types';
|
|
2
2
|
import { conceptPrompts } from './conceptPrompts';
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const buildLLMMessages = (env: BackendBindings) => ({
|
|
5
5
|
generateCosmicMirrorArchetypeBasicInfo: ({
|
|
6
6
|
sun,
|
|
7
7
|
ascendant,
|
|
@@ -106,7 +106,7 @@ export const buildChatGPTMessages = (env: BackendBindings) => ({
|
|
|
106
106
|
description,
|
|
107
107
|
poem,
|
|
108
108
|
combination,
|
|
109
|
-
conceptSlug
|
|
109
|
+
conceptSlug,
|
|
110
110
|
}: {
|
|
111
111
|
name: string;
|
|
112
112
|
description: string;
|