mirror of
https://github.com/matrixgpt/matrix-chatgpt-bot.git
synced 2024-10-01 01:25:41 -04:00
commit
cdbad7f529
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "matrix-chatgpt-bot",
|
"name": "matrix-chatgpt-bot",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"repository": "git@github.com:matrixgpt/matrix-chatgpt-bot.git",
|
"repository": "git@github.com:matrixgpt/matrix-chatgpt-bot.git",
|
||||||
"author": "Jake Coppinger <jake@jakecoppinger.com>",
|
"author": "Jake Coppinger <jake@jakecoppinger.com>",
|
||||||
|
@ -15,6 +15,7 @@ export const {
|
|||||||
MATRIX_ENCRYPTION,
|
MATRIX_ENCRYPTION,
|
||||||
MATRIX_THREADS,
|
MATRIX_THREADS,
|
||||||
MATRIX_PREFIX_DM,
|
MATRIX_PREFIX_DM,
|
||||||
|
MATRIX_RICH_TEXT,
|
||||||
/** Matrix Access Control */
|
/** Matrix Access Control */
|
||||||
MATRIX_BLACKLIST,
|
MATRIX_BLACKLIST,
|
||||||
MATRIX_WHITELIST,
|
MATRIX_WHITELIST,
|
||||||
@ -38,6 +39,7 @@ export const {
|
|||||||
MATRIX_ENCRYPTION: {schema: z.boolean().default(true)},
|
MATRIX_ENCRYPTION: {schema: z.boolean().default(true)},
|
||||||
MATRIX_THREADS: {schema: z.boolean().default(true)},
|
MATRIX_THREADS: {schema: z.boolean().default(true)},
|
||||||
MATRIX_PREFIX_DM: {schema: z.boolean().default(false)},
|
MATRIX_PREFIX_DM: {schema: z.boolean().default(false)},
|
||||||
|
MATRIX_RICH_TEXT: {schema: z.boolean().default(true)},
|
||||||
/** Matrix Access Control */
|
/** Matrix Access Control */
|
||||||
MATRIX_BLACKLIST: {schema: z.string().optional()},
|
MATRIX_BLACKLIST: {schema: z.string().optional()},
|
||||||
MATRIX_WHITELIST: {schema: z.string().optional()},
|
MATRIX_WHITELIST: {schema: z.string().optional()},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ChatGPTAPIBrowser, ChatResponse } from "chatgpt";
|
import { ChatGPTAPIBrowser, ChatResponse } from "chatgpt";
|
||||||
import { LogService, MatrixClient, UserID } from "matrix-bot-sdk";
|
import { LogService, MatrixClient, UserID } from "matrix-bot-sdk";
|
||||||
import { CHATGPT_TIMEOUT, MATRIX_DEFAULT_PREFIX_REPLY, MATRIX_DEFAULT_PREFIX, MATRIX_BLACKLIST, MATRIX_WHITELIST} from "./env.js";
|
import { CHATGPT_TIMEOUT, MATRIX_DEFAULT_PREFIX_REPLY, MATRIX_DEFAULT_PREFIX, MATRIX_BLACKLIST, MATRIX_WHITELIST, MATRIX_RICH_TEXT} from "./env.js";
|
||||||
import { RelatesTo, MessageEvent, StoredConversation, StoredConversationConfig } from "./interfaces.js";
|
import { RelatesTo, MessageEvent, StoredConversation, StoredConversationConfig } from "./interfaces.js";
|
||||||
import { sendError, sendThreadReply } from "./utils.js";
|
import { sendError, sendThreadReply } from "./utils.js";
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ export default class CommandHandler {
|
|||||||
result = await this.chatGPT.sendMessage(question, {timeoutMs: CHATGPT_TIMEOUT});
|
result = await this.chatGPT.sendMessage(question, {timeoutMs: CHATGPT_TIMEOUT});
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all([this.client.setTyping(roomId, false, 500), sendThreadReply(this.client, roomId, rootEventId,`${result.response}`, true)]);
|
await Promise.all([this.client.setTyping(roomId, false, 500), sendThreadReply(this.client, roomId, rootEventId,`${result.response}`, MATRIX_RICH_TEXT)]);
|
||||||
|
|
||||||
await this.client.storageProvider.storeValue('gpt-' + rootEventId, JSON.stringify({
|
await this.client.storageProvider.storeValue('gpt-' + rootEventId, JSON.stringify({
|
||||||
conversationId: result.conversationId,
|
conversationId: result.conversationId,
|
||||||
|
Loading…
Reference in New Issue
Block a user