mirror of
https://github.com/matrixgpt/matrix-chatgpt-bot.git
synced 2024-09-28 20:15:56 +00:00
Add support for Azure OpenAI (#186)
Co-authored-by: 無名氏 <hello@edgerunners.eu.org>
This commit is contained in:
parent
cc8c64bf22
commit
d0d6c5d0b4
@ -1,6 +1,8 @@
|
|||||||
# ChatGPT Settings (required)
|
# ChatGPT Settings (required)
|
||||||
# Set the API Key from OpenAI
|
# Set the API Key from OpenAI
|
||||||
OPENAI_API_KEY=
|
OPENAI_API_KEY=
|
||||||
|
# To use Azure OpenAI API, set `OPENAI_AZURE` to true and `CHATGPT_REVERSE_PROXY` to your completion endpoint
|
||||||
|
# OPENAI_AZURE=false
|
||||||
|
|
||||||
# Set the ChatGPT conversation context to 'thread', 'room' or 'both'.
|
# Set the ChatGPT conversation context to 'thread', 'room' or 'both'.
|
||||||
CHATGPT_CONTEXT=thread
|
CHATGPT_CONTEXT=thread
|
||||||
|
@ -29,6 +29,7 @@ export const {
|
|||||||
MATRIX_DEFAULT_PREFIX,
|
MATRIX_DEFAULT_PREFIX,
|
||||||
MATRIX_DEFAULT_PREFIX_REPLY,
|
MATRIX_DEFAULT_PREFIX_REPLY,
|
||||||
/** ChatGPT Settings */
|
/** ChatGPT Settings */
|
||||||
|
OPENAI_AZURE,
|
||||||
OPENAI_API_KEY,
|
OPENAI_API_KEY,
|
||||||
CHATGPT_CONTEXT,
|
CHATGPT_CONTEXT,
|
||||||
CHATGPT_TIMEOUT,
|
CHATGPT_TIMEOUT,
|
||||||
@ -63,6 +64,7 @@ export const {
|
|||||||
MATRIX_DEFAULT_PREFIX: { schema: z.string().default(""), description: "Set to a string if you want the bot to respond only when messages start with this prefix. Trailing space matters. Empty for no prefix." },
|
MATRIX_DEFAULT_PREFIX: { schema: z.string().default(""), description: "Set to a string if you want the bot to respond only when messages start with this prefix. Trailing space matters. Empty for no prefix." },
|
||||||
MATRIX_DEFAULT_PREFIX_REPLY: { schema: z.boolean().default(false), description: "Set to false if you want the bot to answer to all messages in a thread/conversation" },
|
MATRIX_DEFAULT_PREFIX_REPLY: { schema: z.boolean().default(false), description: "Set to false if you want the bot to answer to all messages in a thread/conversation" },
|
||||||
/** ChatGPT Settings */
|
/** ChatGPT Settings */
|
||||||
|
OPENAI_AZURE: { schema: z.boolean().default(false), description: "Wether or not to use Azure OPENAI"},
|
||||||
OPENAI_API_KEY: { schema: z.string().default(""), description: "Set to the API key from https://platform.openai.com/account/api-keys"},
|
OPENAI_API_KEY: { schema: z.string().default(""), description: "Set to the API key from https://platform.openai.com/account/api-keys"},
|
||||||
CHATGPT_TIMEOUT: { schema: z.number().default(2 * 60 * 1000), description: "Set number of milliseconds to wait for ChatGPT responses" },
|
CHATGPT_TIMEOUT: { schema: z.number().default(2 * 60 * 1000), description: "Set number of milliseconds to wait for ChatGPT responses" },
|
||||||
CHATGPT_CONTEXT: { schema: z.enum(["thread", "room", "both"]).default("thread"), description: "Set the ChatGPT conversation context to 'thread', 'room' or 'both'" },
|
CHATGPT_CONTEXT: { schema: z.enum(["thread", "room", "both"]).default("thread"), description: "Set the ChatGPT conversation context to 'thread', 'room' or 'both'" },
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
|
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import {
|
import {
|
||||||
DATA_PATH, KEYV_URL, OPENAI_API_KEY, MATRIX_HOMESERVER_URL, MATRIX_ACCESS_TOKEN, MATRIX_AUTOJOIN,
|
DATA_PATH, KEYV_URL, OPENAI_AZURE, OPENAI_API_KEY, MATRIX_HOMESERVER_URL, MATRIX_ACCESS_TOKEN, MATRIX_AUTOJOIN,
|
||||||
MATRIX_BOT_PASSWORD, MATRIX_BOT_USERNAME, MATRIX_ENCRYPTION, MATRIX_THREADS, CHATGPT_CONTEXT,
|
MATRIX_BOT_PASSWORD, MATRIX_BOT_USERNAME, MATRIX_ENCRYPTION, MATRIX_THREADS, CHATGPT_CONTEXT,
|
||||||
CHATGPT_API_MODEL, KEYV_BOT_STORAGE, KEYV_BACKEND, CHATGPT_PROMPT_PREFIX, MATRIX_WELCOME,
|
CHATGPT_API_MODEL, KEYV_BOT_STORAGE, KEYV_BACKEND, CHATGPT_PROMPT_PREFIX, MATRIX_WELCOME,
|
||||||
CHATGPT_REVERSE_PROXY, CHATGPT_TEMPERATURE
|
CHATGPT_REVERSE_PROXY, CHATGPT_TEMPERATURE
|
||||||
@ -64,6 +64,7 @@ async function main() {
|
|||||||
},
|
},
|
||||||
promptPrefix: wrapPrompt(CHATGPT_PROMPT_PREFIX),
|
promptPrefix: wrapPrompt(CHATGPT_PROMPT_PREFIX),
|
||||||
debug: false,
|
debug: false,
|
||||||
|
azure: OPENAI_AZURE,
|
||||||
reverseProxyUrl: CHATGPT_REVERSE_PROXY,
|
reverseProxyUrl: CHATGPT_REVERSE_PROXY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user