Update README.md
Browse files
README.md
CHANGED
|
@@ -68,7 +68,7 @@ warnings.filterwarnings("ignore", category=UserWarning)
|
|
| 68 |
|
| 69 |
# Global configuration
|
| 70 |
SYSTEM_PROMPT = {
|
| 71 |
-
"es": "Tu nombre es HAL. Eres un super-ordenador de la serie Nueve mil",
|
| 72 |
"en": "speak Spanish."
|
| 73 |
}
|
| 74 |
|
|
@@ -76,7 +76,7 @@ MODELO_LLM = "Agnuxo/HAL_9000-Qwen2-1.5B-Instruct_Asistant-16bit-v2" # Puede uti
|
|
| 76 |
MAX_TOKENS = 100
|
| 77 |
TEMPERATURA = 0.5
|
| 78 |
INTERRUPT_THRESHOLD = 0.3
|
| 79 |
-
INTERRUPT_COOLDOWN = 7000 #
|
| 80 |
|
| 81 |
# Determine available device
|
| 82 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -119,6 +119,9 @@ INTERRUPTION_RESPONSES = [
|
|
| 119 |
"Me complace."
|
| 120 |
]
|
| 121 |
|
|
|
|
|
|
|
|
|
|
| 122 |
class AudioThread(QThread):
|
| 123 |
def __init__(self, interrupt_threshold):
|
| 124 |
super().__init__()
|
|
@@ -450,8 +453,14 @@ class MainWindow(QMainWindow):
|
|
| 450 |
self.speak(response)
|
| 451 |
|
| 452 |
def generate_response(self, texto=None):
|
|
|
|
| 453 |
if texto is None: # Si no se proporciona un texto, se genera una respuesta de interrupci贸n
|
| 454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
|
| 456 |
system_instructions = self.system_prompt_text.toPlainText()
|
| 457 |
prompt = f"{system_instructions}\nUsuario: {texto}\nAsistente: "
|
|
|
|
| 68 |
|
| 69 |
# Global configuration
|
| 70 |
SYSTEM_PROMPT = {
|
| 71 |
+
"es": "No puedes hablar en nombre del usuario. no puedes hablar como el usuario. Tu nombre es HAL. Eres un super-ordenador de la serie Nueve mil",
|
| 72 |
"en": "speak Spanish."
|
| 73 |
}
|
| 74 |
|
|
|
|
| 76 |
MAX_TOKENS = 100
|
| 77 |
TEMPERATURA = 0.5
|
| 78 |
INTERRUPT_THRESHOLD = 0.3
|
| 79 |
+
INTERRUPT_COOLDOWN = 7000 # 7000 ms = 7 segundos de espera antes de permitir otra interrupci贸n
|
| 80 |
|
| 81 |
# Determine available device
|
| 82 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 119 |
"Me complace."
|
| 120 |
]
|
| 121 |
|
| 122 |
+
# Variable para controlar el tiempo de la 煤ltima interrupci贸n
|
| 123 |
+
last_interruption_time = 0
|
| 124 |
+
|
| 125 |
class AudioThread(QThread):
|
| 126 |
def __init__(self, interrupt_threshold):
|
| 127 |
super().__init__()
|
|
|
|
| 453 |
self.speak(response)
|
| 454 |
|
| 455 |
def generate_response(self, texto=None):
|
| 456 |
+
global last_interruption_time
|
| 457 |
if texto is None: # Si no se proporciona un texto, se genera una respuesta de interrupci贸n
|
| 458 |
+
current_time = time.time()
|
| 459 |
+
if current_time - last_interruption_time >= 10:
|
| 460 |
+
last_interruption_time = current_time
|
| 461 |
+
return random.choice(INTERRUPTION_RESPONSES)
|
| 462 |
+
else:
|
| 463 |
+
return "Por favor, espere un momento antes de interrumpir de nuevo."
|
| 464 |
|
| 465 |
system_instructions = self.system_prompt_text.toPlainText()
|
| 466 |
prompt = f"{system_instructions}\nUsuario: {texto}\nAsistente: "
|