@deepagents/text2sql 0.28.0 → 0.29.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/dist/index.js +21 -0
- package/dist/index.js.map +2 -2
- package/dist/lib/sql.d.ts +1 -0
- package/dist/lib/sql.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -5156,6 +5156,8 @@ import {
|
|
|
5156
5156
|
assistant,
|
|
5157
5157
|
chatMessageToUIMessage,
|
|
5158
5158
|
errorRecoveryGuardrail,
|
|
5159
|
+
generateChatTitle,
|
|
5160
|
+
staticChatTitle,
|
|
5159
5161
|
toMessageFragment
|
|
5160
5162
|
} from "@deepagents/context";
|
|
5161
5163
|
var Text2Sql = class {
|
|
@@ -5242,6 +5244,22 @@ var Text2Sql = class {
|
|
|
5242
5244
|
assistantMsgId = generateId();
|
|
5243
5245
|
}
|
|
5244
5246
|
const uiMessages = messages.map(chatMessageToUIMessage);
|
|
5247
|
+
let title = null;
|
|
5248
|
+
if (!context.chat?.title) {
|
|
5249
|
+
const firstUserMsg = uiMessages.find((m) => m.role === "user");
|
|
5250
|
+
if (firstUserMsg) {
|
|
5251
|
+
if (options?.generateTitle) {
|
|
5252
|
+
title = await generateChatTitle({
|
|
5253
|
+
message: firstUserMsg,
|
|
5254
|
+
model: this.#config.model,
|
|
5255
|
+
abortSignal: options?.abortSignal
|
|
5256
|
+
});
|
|
5257
|
+
} else {
|
|
5258
|
+
title = staticChatTitle(firstUserMsg);
|
|
5259
|
+
}
|
|
5260
|
+
await context.updateChat({ title });
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5245
5263
|
const { mounts: skillMounts } = context.getSkillMounts();
|
|
5246
5264
|
const { tools } = await createResultTools({
|
|
5247
5265
|
adapter: this.#config.adapter,
|
|
@@ -5311,6 +5329,9 @@ var Text2Sql = class {
|
|
|
5311
5329
|
},
|
|
5312
5330
|
execute: async ({ writer }) => {
|
|
5313
5331
|
writer.merge(uiStream);
|
|
5332
|
+
if (title) {
|
|
5333
|
+
writer.write({ type: "data-chat-title", data: title });
|
|
5334
|
+
}
|
|
5314
5335
|
}
|
|
5315
5336
|
});
|
|
5316
5337
|
}
|