bat-6 commited on
Commit
46d9d7a
·
1 Parent(s): f5b408a

feat: implement chatbot engine with input validation, command handling, and project generation utilities

Browse files
src/recommendation_engine/chatbot_engine.py CHANGED
@@ -18,7 +18,7 @@ from src.recommendation_engine.llm_client import generate_text
18
  from src.recommendation_engine.prompt_builder import build_chat_prompt
19
  from src.recommendation_engine.response_formatter import format_response
20
  from src.recommendation_engine.state_manager import update_state
21
- from src.recommendation_engine.context_builder import extract_domain
22
 
23
  from src.recommendation_engine.full_project_generator import (
24
  generate_full_project
@@ -1230,19 +1230,9 @@ Choose what you want:
1230
  is_question = any(q in text_lower for q in question_words) or "?" in text_lower
1231
 
1232
  if is_question and "other" not in text_lower:
1233
- # Answer conversational question directly via LLM
1234
- history_text = "\n".join(
1235
- f"User: {h.get('user', '')}\nBot: {h.get('bot', '')}"
1236
- for h in history[-3:]
1237
- )
1238
- prompt = build_chat_prompt(state)
1239
- full_prompt = (
1240
- f"{prompt}\n\n"
1241
- f"User History:\n{history_text}\n\n"
1242
- f"User Input: {user_input}\n\n"
1243
- "AI Assistant:"
1244
- )
1245
- response = generate_text(full_prompt, task="chat")
1246
 
1247
  save_user_memory(user_id, {"history": history, "state": state})
1248
  return finalize_response(user_input, response, history, state, user_id)
 
18
  from src.recommendation_engine.prompt_builder import build_chat_prompt
19
  from src.recommendation_engine.response_formatter import format_response
20
  from src.recommendation_engine.state_manager import update_state
21
+ from src.recommendation_engine.context_builder import extract_domain, DOMAIN_KEYWORDS
22
 
23
  from src.recommendation_engine.full_project_generator import (
24
  generate_full_project
 
1230
  is_question = any(q in text_lower for q in question_words) or "?" in text_lower
1231
 
1232
  if is_question and "other" not in text_lower:
1233
+ # Return hardcoded domain list instead of using LLM
1234
+ domain_list = "\n".join(f"- {d}" for d in DOMAIN_KEYWORDS.keys())
1235
+ response = f"Here are the available domains you can choose from:\n\n{domain_list}"
 
 
 
 
 
 
 
 
 
 
1236
 
1237
  save_user_memory(user_id, {"history": history, "state": state})
1238
  return finalize_response(user_input, response, history, state, user_id)