|
1 | 1 | // see src/types/bing-ai-client.d.ts |
2 | | -// @ts-ignore |
3 | | -import type { BingAIClientResponse, SuggestedResponse } from "@waylaidwanderer/chatgpt-api"; |
4 | | - |
5 | | -// see src/types/bing-ai-client.d.ts |
6 | | -// @ts-ignore |
7 | | -import type { SourceAttribution } from "@waylaidwanderer/chatgpt-api"; |
| 2 | +import type { |
| 3 | + BingAIClientResponse, |
| 4 | + SuggestedResponse, |
| 5 | + SourceAttribution, |
| 6 | + // @ts-ignore |
| 7 | +} from "@waylaidwanderer/chatgpt-api"; |
8 | 8 |
|
9 | 9 | import { Message } from "whatsapp-web.js"; |
10 | 10 | import { prisma } from "../clients/prisma"; |
11 | 11 | import { bing } from "../clients/bing"; |
12 | | -import { SYSTEM_MESSAGE } from "../constants"; |
| 12 | +import { ENABLE_SOURCES, SYSTEM_MESSAGE } from "../constants"; |
13 | 13 | import { createConversation, getConversationFor } from "../crud/conversation"; |
14 | 14 | import { createChat, getChatFor } from "../crud/chat"; |
15 | 15 |
|
@@ -45,10 +45,13 @@ export async function getCompletionFor(message: Message, context: string, reply: |
45 | 45 |
|
46 | 46 | const completion = await generateCompletionFor(message, context, onProgress); |
47 | 47 | completion.response = removeFootnotes(completion.response); |
48 | | - completion.response = completion.response + "\n\n" + getSources(completion); |
| 48 | + |
| 49 | + if (ENABLE_SOURCES === "true") |
| 50 | + completion.response = completion.response + "\n\n" + getSources(completion); |
49 | 51 |
|
50 | 52 | // TODO: suggestions will be added later; must have a way to select them when replying |
51 | | - // completion.response = completion.response + "\n\n" + getSuggestions(completion); |
| 53 | + // if (ENABLE_SUGGESTIONS === "true") |
| 54 | + // completion.response = completion.response + "\n\n" + getSuggestions(completion); |
52 | 55 |
|
53 | 56 | // @ts-ignore |
54 | 57 | return Promise.all([completion, replyEditing]).then(([completion]) => completion); |
|
0 commit comments