Update 86 files
- /rag/commands/expert.py - /core/services/__init__.py - /core/services/embedding_service.py - /core/services/file_service.py - /core/services/giga_client.py - /core/services/kb_service.py - /core/services/postgres_service.py - /core/services/qdrant_service.py - /core/services/reranker_service.py - /core/functions/__init__.py - /core/functions/check_consistency.py - /core/functions/check_spelling.py - /core/functions/critique_answer.py - /core/functions/expand_query.py - /core/functions/extract_metrics.py - /core/functions/file_processor.py - /core/functions/generate_document.py - /core/functions/intent_classify.py - /core/functions/rerank_context.py - /core/functions/summarize_document.py - /core/utils/__init__.py - /core/utils/arg_parser.py - /core/utils/config_loader.py - /core/utils/layout_converter.py - /core/utils/logger.py - /core/utils/text_utils.py - /core/utils/web_utils.py - /bots/commands/__init__.py - /bots/commands/base.py - /bots/commands/create.py - /core/commands/global_remove.py - /core/commands/help.py - /core/commands/info.py - /core/commands/kb.py - /core/commands/learn.py - /core/commands/other.py - /core/commands/registry.py - /core/commands/stats.py - /core/commands/template.py - /core/handlers/__init__.py - /core/handlers/message_handler.py - /core/workers/__init__.py - /core/workers/indexing_worker.py - /core/xmpp/__init__.py - /core/xmpp/client.py - /bots/commands/global_remove.py - /bots/commands/help.py - /bots/commands/info.py - /bots/commands/kb.py - /bots/commands/registry.py - /bots/commands/other.py - /bots/commands/template.py - /bots/commands/learn.py - /bots/commands/stats.py - /bots/handlers/message_handler.py - /bots/handlers/__init__.py - /bots/workers/__init__.py - /bots/workers/indexing_worker.py - /bots/xmpp/__init__.py - /bots/xmpp/client.py - /rag/services/qdrant_service.py - /rag/services/giga_client.py - /rag/services/embedding_service.py - /rag/services/reranker_service.py - /rag/services/__init__.py - /rag/services/file_service.py - /rag/services/postgres_service.py - /rag/services/kb_service.py - /rag/functions/check_spelling.py - /rag/functions/__init__.py - /rag/functions/extract_metrics.py - /rag/functions/generate_document.py - /rag/functions/expand_query.py - /rag/functions/critique_answer.py - /rag/functions/file_processor.py - /rag/functions/check_consistency.py - /rag/functions/summarize_document.py - /rag/functions/rerank_context.py - /rag/functions/intent_classify.py - /rag/utils/__init__.py - /rag/utils/layout_converter.py - /rag/utils/text_utils.py - /rag/utils/arg_parser.py - /rag/utils/config_loader.py - /rag/utils/logger.py - /rag/utils/web_utils.py
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from core.commands.base import Command
|
||||
from core.functions.generate_document import generate_document_from_template
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CreateCommand(Command):
|
||||
name = "!create"
|
||||
aliases = ["/create"]
|
||||
|
||||
async def execute(self, msg, args: str, user_jid: str, room_jid: str = None):
|
||||
if not room_jid:
|
||||
reply = msg.reply("⚠️ Команда !create работает только в комнатах.")
|
||||
if reply:
|
||||
reply.send()
|
||||
return
|
||||
|
||||
clean_args = args.strip()
|
||||
if clean_args.startswith(self.name):
|
||||
clean_args = clean_args[len(self.name):].lstrip()
|
||||
name = clean_args.strip()
|
||||
if name.startswith('"') and name.endswith('"'):
|
||||
name = name[1:-1]
|
||||
|
||||
if not name:
|
||||
reply = msg.reply("Укажите название шаблона: !create \"Название\"")
|
||||
if reply:
|
||||
reply.send()
|
||||
return
|
||||
|
||||
template_info = await self.bot.db.get_template(room_jid, name)
|
||||
if not template_info:
|
||||
reply = msg.reply(f"❌ Шаблон '{name}' не найден.")
|
||||
if reply:
|
||||
reply.send()
|
||||
return
|
||||
|
||||
reply = msg.reply("🔄 Начинаю генерацию документа. Это может занять несколько минут. Я сообщу, когда будет готово.")
|
||||
if reply:
|
||||
reply.send()
|
||||
|
||||
asyncio.create_task(
|
||||
generate_document_from_template(
|
||||
bot=self.bot,
|
||||
msg=msg,
|
||||
room_jid=room_jid,
|
||||
template_path=template_info['file_path'],
|
||||
template_name=name,
|
||||
user_jid=user_jid
|
||||
)
|
||||
)
|
||||
|
||||
def get_help(self) -> str:
|
||||
return (
|
||||
"Генерирует документ по шаблону из базы знаний. "
|
||||
"Использование: `!create \"Название шаблона\"` (только в комнате)"
|
||||
)
|
||||
Reference in New Issue
Block a user