Skip to content
Snippets Groups Projects
Commit 2c15c688 authored by Sangamithra Panneer Selvam's avatar Sangamithra Panneer Selvam
Browse files

modified to accept repeatative questions

parent e10f1688
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ import json
from datetime import datetime
import logging
from queue import Queue
import uuid
app = Flask(__name__)
......@@ -136,6 +137,7 @@ def handle_request():
# Append the new question
user_question.clear()
user_question.append(question)
user_question.append(str(uuid.uuid4()))
return jsonify({"response": "Question recieved"})
......
......@@ -7,6 +7,7 @@ import rag_pb2
import rag_pb2_grpc
from app import app_run, get_user_question, get_user_prompt
import json
import os
import uuid
import ast
......@@ -27,11 +28,13 @@ class RAGService(rag_pb2_grpc.RAGServiceServicer):
def __init__(self):
super().__init__()
self.responses = {}
self.current_question = None # Store the last processed question
#self.current_question = None # Store the last processed question
self.last_question_id = None
def instruct_llm_query(self, request, context):
while True:
params = get_user_question()
# print("Params:", params)
custom_prompt = get_user_prompt()
# Ensure both prompt and question are checked
......@@ -44,15 +47,14 @@ class RAGService(rag_pb2_grpc.RAGServiceServicer):
continue
self.new_question = params[0]
if self.new_question == self.current_question:
question_id= params[1]
if self.last_question_id == question_id:
time.sleep(0.5)
continue
continue
self.current_question = self.new_question
self.last_question_id = question_id
print("Prompt received:", self.system_prompt)
question_id = str(uuid.uuid4())
input_text = f"You asked: {self.new_question}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment