Skip to content

Commit beb9868

Browse files
authored
Add logs for query ask AI in slack (#997)
* Add logs for query ask AI * changeset
1 parent 23036c5 commit beb9868

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.changeset/sweet-lies-ask.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/integration-slack': patch
3+
---
4+
5+
Add logs while querying askAI in slack

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
},
173173
"integrations/github-files": {
174174
"name": "@gitbook/integration-github-files",
175-
"version": "0.2.4",
175+
"version": "0.2.5",
176176
"dependencies": {
177177
"@gitbook/api": "*",
178178
"@gitbook/runtime": "*",
@@ -204,7 +204,7 @@
204204
},
205205
"integrations/gitlab-files": {
206206
"name": "@gitbook/integration-gitlab-files",
207-
"version": "0.2.3",
207+
"version": "0.2.4",
208208
"dependencies": {
209209
"@gitbook/runtime": "*",
210210
"dotenv": "^16.1.1",

integrations/slack/src/actions/queryAskAI.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import {
1515
import { slackAPI } from '../slack';
1616
import { QueryDisplayBlock, ShareTools, decodeSlackEscapeChars, Spacer, SourcesBlock } from '../ui';
1717
import { getInstallationApiClient, stripBotName, stripMarkdown } from '../utils';
18+
import { Logger } from '@gitbook/runtime';
19+
20+
const logger = Logger('slack:queryAskAI');
1821

1922
export type RelatedSource = {
2023
id: string;
@@ -160,6 +163,10 @@ export async function queryAskAI({
160163
channelName,
161164
}: IQueryAskAI) {
162165
const { environment, api } = context;
166+
167+
const askText = `_Asking: ${stripMarkdown(text)}_`;
168+
logger.info(`${{ channelId, teamId, threadId }} -> ${askText}`);
169+
163170
const { client, installation } = await getInstallationApiClient(api, teamId);
164171
if (!installation) {
165172
throw new Error('Installation not found');
@@ -181,7 +188,7 @@ export async function queryAskAI({
181188
responseUrl,
182189
payload: {
183190
channel: channelId,
184-
text: `_Asking: ${stripMarkdown(text)}_`,
191+
text: askText,
185192
...(userId ? { user: userId } : {}), // actually shouldn't be optional
186193
...(threadId ? { thread_ts: threadId } : {}),
187194
},

0 commit comments

Comments
 (0)