@friendlyrobot/discord-pi-agent 0.8.0 → 0.8.1
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 +16 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -952,7 +952,7 @@ function isAuthorized(message, scope, authConfig) {
|
|
|
952
952
|
}
|
|
953
953
|
return false;
|
|
954
954
|
}
|
|
955
|
-
var TYPING_INTERVAL_MS =
|
|
955
|
+
var TYPING_INTERVAL_MS = 9000;
|
|
956
956
|
function startTypingInterval(channel) {
|
|
957
957
|
channel.sendTyping();
|
|
958
958
|
return setInterval(() => {
|
|
@@ -1134,18 +1134,22 @@ async function onMessage(message, config, agentService, sessionRegistry, authCon
|
|
|
1134
1134
|
if (queuePosition > 0) {
|
|
1135
1135
|
await sendReply(message, `Queued. ${queuePosition} request(s) ahead of this one.`);
|
|
1136
1136
|
}
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1137
|
+
let response;
|
|
1138
|
+
try {
|
|
1139
|
+
response = await promptQueue.enqueue(async () => {
|
|
1140
|
+
logger5.debug({
|
|
1141
|
+
messageId: message.id,
|
|
1142
|
+
scope
|
|
1143
|
+
}, "processing message");
|
|
1144
|
+
const promptContent = buildDiscordPromptContent(message, scope, content, config);
|
|
1145
|
+
const transformedPrompt = await config.promptTransform(promptContent);
|
|
1146
|
+
return collectReply(session, transformedPrompt, {
|
|
1147
|
+
logPrefix: `[agent:${session.sessionId}]`
|
|
1148
|
+
});
|
|
1146
1149
|
});
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1150
|
+
} finally {
|
|
1151
|
+
stopTypingInterval(typingInterval);
|
|
1152
|
+
}
|
|
1149
1153
|
logger5.info({
|
|
1150
1154
|
direction: "OUT",
|
|
1151
1155
|
scope,
|