Merge pull request #43 from matrixgpt/rich-text-fix

Rich text fix
This commit is contained in:
bertybuttface 2023-01-08 21:01:03 +00:00 committed by GitHub
commit cdbad7f529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "matrix-chatgpt-bot",
"version": "1.1.0",
"version": "1.1.1",
"main": "dist/index.js",
"repository": "git@github.com:matrixgpt/matrix-chatgpt-bot.git",
"author": "Jake Coppinger <jake@jakecoppinger.com>",

View File

@ -15,6 +15,7 @@ export const {
MATRIX_ENCRYPTION,
MATRIX_THREADS,
MATRIX_PREFIX_DM,
MATRIX_RICH_TEXT,
/** Matrix Access Control */
MATRIX_BLACKLIST,
MATRIX_WHITELIST,
@ -38,6 +39,7 @@ export const {
MATRIX_ENCRYPTION: {schema: z.boolean().default(true)},
MATRIX_THREADS: {schema: z.boolean().default(true)},
MATRIX_PREFIX_DM: {schema: z.boolean().default(false)},
MATRIX_RICH_TEXT: {schema: z.boolean().default(true)},
/** Matrix Access Control */
MATRIX_BLACKLIST: {schema: z.string().optional()},
MATRIX_WHITELIST: {schema: z.string().optional()},

View File

@ -1,6 +1,6 @@
import { ChatGPTAPIBrowser, ChatResponse } from "chatgpt";
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 { sendError, sendThreadReply } from "./utils.js";
@ -88,7 +88,7 @@ export default class CommandHandler {
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({
conversationId: result.conversationId,