Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/apps/chat/api/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from apps.swagger.i18n import PLACEHOLDER_PREFIX
from apps.system.schemas.permission import SqlbotPermission, require_permissions
from common.core.deps import CurrentAssistant, SessionDep, CurrentUser, Trans
from common.core.config import settings
from common.utils.command_utils import parse_quick_command
from common.utils.data_format import DataFormat
from common.audit.models.log_model import OperationType, OperationModules
Expand Down Expand Up @@ -198,6 +199,9 @@ async def ask_recommend_questions(session: SessionDep, current_user: CurrentUser
def _return_empty():
yield 'data:' + orjson.dumps({'content': '[]', 'type': 'recommended_question'}).decode() + '\n\n'

if not settings.RECOMMENDED_QUESTIONS_ENABLED:
return StreamingResponse(_return_empty(), media_type="text/event-stream")

try:
record = get_chat_record_by_id(session, chat_record_id)

Expand Down
4 changes: 4 additions & 0 deletions backend/common/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn | str:
TABLE_EMBEDDING_COUNT: int = 10
DS_EMBEDDING_COUNT: int = 10

# 推荐问题配置(LLM生成)
RECOMMENDED_QUESTIONS_ENABLED: bool = True

ORACLE_CLIENT_PATH: str = '/opt/sqlbot/db_client/oracle_instant_client'

@field_validator('SQL_DEBUG',
Expand All @@ -132,6 +135,7 @@ def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn | str:
'PARSE_REASONING_BLOCK_ENABLED',
'PG_POOL_PRE_PING',
'TABLE_EMBEDDING_ENABLED',
'RECOMMENDED_QUESTIONS_ENABLED',
mode='before')
@classmethod
def lowercase_bool(cls, v: Any) -> Any:
Expand Down