mirror of
https://github.com/hempyhemp/hh-auto-reply.git
synced 2026-06-08 18:04:57 +00:00
🔧 fix(file): Изменено использование DEFAULT_PROMPT в handlePrompt()
All checks were successful
Deploy / deploy (push) Successful in 48s
All checks were successful
Deploy / deploy (push) Successful in 48s
This commit is contained in:
@@ -6,7 +6,7 @@ import { doLogin, handleLogin } from './handlers/auth.js'
|
|||||||
import { handleApply } from './handlers/apply.js'
|
import { handleApply } from './handlers/apply.js'
|
||||||
import { handleStatus, handleSkipped } from './handlers/info.js'
|
import { handleStatus, handleSkipped } from './handlers/info.js'
|
||||||
import { handleMyResume, handleResumeList, handleResumePick } from './handlers/resume.js'
|
import { handleMyResume, handleResumeList, handleResumePick } from './handlers/resume.js'
|
||||||
import { handleAutoToggle, handleMax, handlePrompt, handleQuery } from './handlers/settings.js'
|
import { DEFAULT_PROMPT, handleAutoToggle, handleMax, handlePrompt, handleQuery } from './handlers/settings.js'
|
||||||
|
|
||||||
type MsgHandler = (chatId: number) => Promise<void>
|
type MsgHandler = (chatId: number) => Promise<void>
|
||||||
type CallbackHandler = (chatId: number, messageId: number) => Promise<void>
|
type CallbackHandler = (chatId: number, messageId: number) => Promise<void>
|
||||||
@@ -67,6 +67,14 @@ const CALLBACK_HANDLERS: Record<string, CallbackHandler> = {
|
|||||||
state.promptPromptMessageId = null
|
state.promptPromptMessageId = null
|
||||||
await bot.deleteMessage(chatId, messageId).catch(() => {})
|
await bot.deleteMessage(chatId, messageId).catch(() => {})
|
||||||
},
|
},
|
||||||
|
hh_reset_prompt: async (chatId, messageId) => {
|
||||||
|
const state = getState(chatId)
|
||||||
|
state.awaitingPrompt = false
|
||||||
|
state.promptPromptMessageId = null
|
||||||
|
await prisma.user.update({ where: { telegramId: chatId }, data: { prompt: DEFAULT_PROMPT } })
|
||||||
|
await bot.deleteMessage(chatId, messageId).catch(() => {})
|
||||||
|
await bot.sendMessage(chatId, '✅ Промт сброшен на дефолтный')
|
||||||
|
},
|
||||||
hh_resume_list: async (chatId, messageId) => {
|
hh_resume_list: async (chatId, messageId) => {
|
||||||
await bot.deleteMessage(chatId, messageId).catch(() => {})
|
await bot.deleteMessage(chatId, messageId).catch(() => {})
|
||||||
await handleResumeList(chatId)
|
await handleResumeList(chatId)
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ export async function handleMax(chatId: number): Promise<void> {
|
|||||||
state.maxPromptMessageId = msg.message_id
|
state.maxPromptMessageId = msg.message_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_PROMPT = 'Ты — помощник по написанию сопроводительных писем. Отвечай только текстом самого письма, без вступлений, ремарок и пояснений. Опирайся на резюме и ничего не выдумывай, чего недостаточно в резюме лучше умолчать. Пиши по короче и простыми словами. В конце письма оставляй все контакты для связи.'
|
||||||
|
|
||||||
export async function handlePrompt(chatId: number): Promise<void> {
|
export async function handlePrompt(chatId: number): Promise<void> {
|
||||||
const state = getState(chatId)
|
const state = getState(chatId)
|
||||||
state.awaitingPrompt = true
|
state.awaitingPrompt = true
|
||||||
@@ -52,12 +54,15 @@ export async function handlePrompt(chatId: number): Promise<void> {
|
|||||||
const text = currentPrompt
|
const text = currentPrompt
|
||||||
? `📝 Текущий промт:\n<pre>${escapeHtml(currentPrompt)}</pre>\n\nВведи новый или оставь текущий:`
|
? `📝 Текущий промт:\n<pre>${escapeHtml(currentPrompt)}</pre>\n\nВведи новый или оставь текущий:`
|
||||||
: '📝 Введи промт для AI (пока не задан):'
|
: '📝 Введи промт для AI (пока не задан):'
|
||||||
const keepButton = currentPrompt
|
const buttons: { text: string; callback_data: string }[] = []
|
||||||
? [[{ text: '✅ Оставить текущий промт', callback_data: 'hh_keep_prompt' }]]
|
if (currentPrompt) {
|
||||||
: []
|
buttons.push({ text: '✅ Оставить текущий', callback_data: 'hh_keep_prompt' })
|
||||||
|
if (currentPrompt !== DEFAULT_PROMPT)
|
||||||
|
buttons.push({ text: '🔄 Вернуть дефолтный', callback_data: 'hh_reset_prompt' })
|
||||||
|
}
|
||||||
const msg = await bot.sendMessage(chatId, text, {
|
const msg = await bot.sendMessage(chatId, text, {
|
||||||
parse_mode: 'HTML',
|
parse_mode: 'HTML',
|
||||||
reply_markup: { inline_keyboard: keepButton },
|
reply_markup: { inline_keyboard: buttons.length ? [buttons] : [] },
|
||||||
})
|
})
|
||||||
state.promptPromptMessageId = msg.message_id
|
state.promptPromptMessageId = msg.message_id
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user