@adminforth/agent 1.19.0 → 1.20.0
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/agent/simpleAgent.ts +2 -3
- package/dist/agent/simpleAgent.js +4 -4
- package/dist/index.js +2 -1
- package/index.ts +2 -1
- package/package.json +1 -1
package/agent/simpleAgent.ts
CHANGED
|
@@ -165,7 +165,6 @@ function createAgentLlmMetricsLogger() {
|
|
|
165
165
|
export function createAgentChatModel(params: {
|
|
166
166
|
adapter: CompletionAdapter;
|
|
167
167
|
maxTokens: number;
|
|
168
|
-
modelName?: string;
|
|
169
168
|
}) {
|
|
170
169
|
const adapter = params.adapter as OpenAIBackedCompletionAdapter;
|
|
171
170
|
const options = adapter.options ?? {};
|
|
@@ -176,7 +175,7 @@ export function createAgentChatModel(params: {
|
|
|
176
175
|
);
|
|
177
176
|
}
|
|
178
177
|
|
|
179
|
-
const model =
|
|
178
|
+
const model = options.model ?? "gpt-5-nano";
|
|
180
179
|
const baseURL = options.baseURL ?? options.baseUrl;
|
|
181
180
|
const reasoning = options.extraRequestBodyParameters
|
|
182
181
|
?.reasoning as OpenAiReasoningConfig | undefined;
|
|
@@ -195,8 +194,8 @@ export function createAgentChatModel(params: {
|
|
|
195
194
|
useResponsesApi: true,
|
|
196
195
|
outputVersion: "v1",
|
|
197
196
|
streaming: true,
|
|
198
|
-
promptCacheKey: `adminforth-agent:${model}:system-v1:tools-v1`,
|
|
199
197
|
|
|
198
|
+
promptCacheKey: `adminforth-agent:${model}:system-v1:tools-v1`,
|
|
200
199
|
promptCacheRetention: "in_memory",
|
|
201
200
|
|
|
202
201
|
...(reasoningConfig ? { reasoning: reasoningConfig } : {}),
|
|
@@ -102,15 +102,15 @@ function createAgentLlmMetricsLogger() {
|
|
|
102
102
|
return new AgentLlmMetricsLogger();
|
|
103
103
|
}
|
|
104
104
|
export function createAgentChatModel(params) {
|
|
105
|
-
var _a, _b, _c, _d
|
|
105
|
+
var _a, _b, _c, _d;
|
|
106
106
|
const adapter = params.adapter;
|
|
107
107
|
const options = (_a = adapter.options) !== null && _a !== void 0 ? _a : {};
|
|
108
108
|
if (!options.openAiApiKey) {
|
|
109
109
|
throw new Error("CompletionAdapter must expose options.openAiApiKey for ChatOpenAI");
|
|
110
110
|
}
|
|
111
|
-
const model = (
|
|
112
|
-
const baseURL = (
|
|
113
|
-
const reasoning = (
|
|
111
|
+
const model = (_b = options.model) !== null && _b !== void 0 ? _b : "gpt-5-nano";
|
|
112
|
+
const baseURL = (_c = options.baseURL) !== null && _c !== void 0 ? _c : options.baseUrl;
|
|
113
|
+
const reasoning = (_d = options.extraRequestBodyParameters) === null || _d === void 0 ? void 0 : _d.reasoning;
|
|
114
114
|
const reasoningConfig = reasoning
|
|
115
115
|
? Object.assign(Object.assign({}, reasoning), { summary: "auto" }) : undefined;
|
|
116
116
|
// @ts-ignore
|
package/dist/index.js
CHANGED
|
@@ -371,7 +371,8 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
371
371
|
path: `/agent/get-sessions`,
|
|
372
372
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser }) {
|
|
373
373
|
const userId = adminUser.pk;
|
|
374
|
-
const
|
|
374
|
+
const limit = typeof body.limit === 'number' ? body.limit : 20;
|
|
375
|
+
const sessions = yield this.adminforth.resource(this.pluginOptions.sessionResource.resourceId).list([Filters.EQ(this.pluginOptions.sessionResource.askerIdField, userId)], limit, undefined, [Sorts.DESC(this.pluginOptions.sessionResource.createdAtField)]);
|
|
375
376
|
const sessionsToReturn = [];
|
|
376
377
|
for (const session of sessions) {
|
|
377
378
|
sessionsToReturn.push({
|
package/index.ts
CHANGED
|
@@ -422,8 +422,9 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
422
422
|
path: `/agent/get-sessions`,
|
|
423
423
|
handler: async ({body, adminUser }) => {
|
|
424
424
|
const userId = adminUser.pk;
|
|
425
|
+
const limit = typeof body.limit === 'number' ? body.limit : 20;
|
|
425
426
|
const sessions = await this.adminforth.resource(this.pluginOptions.sessionResource.resourceId).list(
|
|
426
|
-
[Filters.EQ(this.pluginOptions.sessionResource.askerIdField, userId)],
|
|
427
|
+
[Filters.EQ(this.pluginOptions.sessionResource.askerIdField, userId)], limit, undefined, [Sorts.DESC(this.pluginOptions.sessionResource.createdAtField)]
|
|
427
428
|
);
|
|
428
429
|
const sessionsToReturn = [];
|
|
429
430
|
for (const session of sessions) {
|