Skip to content

Commit

Permalink
fix: fix msg handle type error
Browse files Browse the repository at this point in the history
  • Loading branch information
adolphnov committed Dec 1, 2024
1 parent 2769352 commit 7b5b0e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/telegram/handler/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ export class InitUserConfig implements MessageHandler<WorkerContextBase> {
export class StoreHistory implements MessageHandler<WorkerContext> {
handle = async (message: Telegram.Message, context: WorkerContext): Promise<Response | null> => {
const historyDisable = ENV.AUTO_TRIM_HISTORY && ENV.MAX_HISTORY_LENGTH <= 0;
const isAsr = context.USER_CONFIG.TEXT_HANDLE_TYPE === 'asr';
const isTrans = context.USER_CONFIG.AUDIO_HANDLE_TYPE === 'trans';
if (!historyDisable && (!isAsr || !isTrans)) {
const isTts = context.USER_CONFIG.TEXT_HANDLE_TYPE === 'tts';
const isStt = context.USER_CONFIG.AUDIO_HANDLE_TYPE === 'stt';
if (!historyDisable && (!isTts || !isStt)) {
const historyKey = context.SHARE_CONTEXT.chatHistoryKey;
const history = context.MIDDLE_CONTEXT.history;
const userMessage = history.findLast(h => h.role === 'user');
Expand Down

0 comments on commit 7b5b0e6

Please sign in to comment.