@axiom-lattice/gateway 2.1.45 → 2.1.47
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +19 -0
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/controllers/models.ts +8 -0
- package/src/controllers/run.ts +19 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiom-lattice/gateway",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.47",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"pg": "^8.11.0",
|
|
39
39
|
"redis": "^5.0.1",
|
|
40
40
|
"uuid": "^9.0.1",
|
|
41
|
-
"@axiom-lattice/core": "2.1.
|
|
42
|
-
"@axiom-lattice/pg-stores": "1.0.
|
|
43
|
-
"@axiom-lattice/protocols": "2.1.
|
|
44
|
-
"@axiom-lattice/queue-redis": "1.0.
|
|
41
|
+
"@axiom-lattice/core": "2.1.41",
|
|
42
|
+
"@axiom-lattice/pg-stores": "1.0.31",
|
|
43
|
+
"@axiom-lattice/protocols": "2.1.22",
|
|
44
|
+
"@axiom-lattice/queue-redis": "1.0.21"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/jest": "^29.5.14",
|
|
@@ -43,6 +43,7 @@ function extractModelKey(tenantId: string, tenantModelKey: string): string {
|
|
|
43
43
|
interface ModelConfig {
|
|
44
44
|
key: string;
|
|
45
45
|
model: string;
|
|
46
|
+
displayName?: string;
|
|
46
47
|
provider: "azure" | "openai" | "deepseek" | "siliconcloud" | "volcengine";
|
|
47
48
|
streaming?: boolean;
|
|
48
49
|
apiKey?: string;
|
|
@@ -75,10 +76,16 @@ export async function getModels(request: FastifyRequest, reply: FastifyReply) {
|
|
|
75
76
|
// Extract config from the lattice client
|
|
76
77
|
// Note: This is a simplified approach - you may need to adjust based on actual implementation
|
|
77
78
|
const config = (lattice.client as any).config || {};
|
|
79
|
+
// Use provided displayName or auto-generate from key
|
|
80
|
+
const displayName = config.displayName || lattice.key
|
|
81
|
+
.split('-')
|
|
82
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
83
|
+
.join(' ');
|
|
78
84
|
return {
|
|
79
85
|
key: lattice.key,
|
|
80
86
|
model: config.model || "",
|
|
81
87
|
provider: config.provider || "openai",
|
|
88
|
+
displayName: displayName,
|
|
82
89
|
streaming: config.streaming || false,
|
|
83
90
|
apiKey: config.apiKey || "",
|
|
84
91
|
baseURL: config.baseURL || "",
|
|
@@ -144,6 +151,7 @@ export async function updateModels(
|
|
|
144
151
|
const llmConfig: LLMConfig = {
|
|
145
152
|
provider: modelConfig.provider,
|
|
146
153
|
model: modelConfig.model,
|
|
154
|
+
displayName: modelConfig.displayName,
|
|
147
155
|
streaming: modelConfig.streaming ?? false,
|
|
148
156
|
apiKey: modelConfig.apiKey,
|
|
149
157
|
baseURL: modelConfig.baseURL,
|
package/src/controllers/run.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
interface ResumeStreamRequest {
|
|
12
12
|
thread_id: string;
|
|
13
|
+
assistant_id: string
|
|
13
14
|
message_id: string;
|
|
14
15
|
known_content: string;
|
|
15
16
|
poll_interval?: number;
|
|
@@ -73,6 +74,7 @@ export const createRun = async (
|
|
|
73
74
|
const result = await agent.addMessage({
|
|
74
75
|
input,
|
|
75
76
|
command,
|
|
77
|
+
custom_run_config,
|
|
76
78
|
});
|
|
77
79
|
|
|
78
80
|
// const agentStatus = await agent.getRunStatus()
|
|
@@ -114,6 +116,7 @@ export const createRun = async (
|
|
|
114
116
|
const result = await agent.invoke({
|
|
115
117
|
input: { message: msg, ...restInputNonStream },
|
|
116
118
|
command,
|
|
119
|
+
custom_run_config,
|
|
117
120
|
});
|
|
118
121
|
reply.status(200).send({
|
|
119
122
|
success: true,
|
|
@@ -134,14 +137,21 @@ export const resumeStream = async (
|
|
|
134
137
|
reply: FastifyReply
|
|
135
138
|
): Promise<void> => {
|
|
136
139
|
try {
|
|
137
|
-
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
const { thread_id, message_id, assistant_id, known_content, poll_interval } =
|
|
138
145
|
request.body as ResumeStreamRequest;
|
|
146
|
+
const tenant_id = request.headers["x-tenant-id"] as string;
|
|
147
|
+
const workspace_id = request.headers["x-workspace-id"] as string;
|
|
148
|
+
const project_id = request.headers["x-project-id"] as string;
|
|
139
149
|
|
|
140
150
|
// Validate request data
|
|
141
|
-
if (!thread_id || !message_id || known_content === undefined) {
|
|
151
|
+
if (!thread_id || !message_id || !assistant_id || known_content === undefined) {
|
|
142
152
|
reply.status(400).send({
|
|
143
153
|
success: false,
|
|
144
|
-
error: "thread_id, message_id, and known_content are required",
|
|
154
|
+
error: "thread_id, message_id, assistant_id, and known_content are required",
|
|
145
155
|
});
|
|
146
156
|
return;
|
|
147
157
|
}
|
|
@@ -160,10 +170,13 @@ export const resumeStream = async (
|
|
|
160
170
|
try {
|
|
161
171
|
// Create Agent instance for accessing chunk buffer
|
|
162
172
|
// Note: assistant_id, tenant_id are not required for chunkStream
|
|
163
|
-
|
|
164
|
-
|
|
173
|
+
// Get or create Agent instance (ensures single instance per thread)
|
|
174
|
+
const agent = agentInstanceManager.getAgent({
|
|
175
|
+
assistant_id,
|
|
165
176
|
thread_id,
|
|
166
|
-
tenant_id
|
|
177
|
+
tenant_id,
|
|
178
|
+
workspace_id,
|
|
179
|
+
project_id,
|
|
167
180
|
});
|
|
168
181
|
|
|
169
182
|
// Get the stream from agent's chunk buffer
|