Update README.md
Browse files
README.md
CHANGED
|
@@ -80,7 +80,7 @@ warnings.filterwarnings("ignore", category=UserWarning)
|
|
| 80 |
|
| 81 |
# Global configuration
|
| 82 |
SYSTEM_PROMPT = {
|
| 83 |
-
"es": "Tu nombre es HAL. Eres un super-ordenador de la serie Nueve mil",
|
| 84 |
"en": "speak Spanish."
|
| 85 |
}
|
| 86 |
|
|
@@ -88,7 +88,7 @@ MODELO_LLM = "Agnuxo/HAL_9000-Qwen2-1.5B-Instruct_Asistant-16bit-v2" # Puede uti
|
|
| 88 |
MAX_TOKENS = 100
|
| 89 |
TEMPERATURA = 0.5
|
| 90 |
INTERRUPT_THRESHOLD = 0.3
|
| 91 |
-
INTERRUPT_COOLDOWN = 7000 #
|
| 92 |
|
| 93 |
# Determine available device
|
| 94 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -131,6 +131,9 @@ INTERRUPTION_RESPONSES = [
|
|
| 131 |
"Me complace."
|
| 132 |
]
|
| 133 |
|
|
|
|
|
|
|
|
|
|
| 134 |
class AudioThread(QThread):
|
| 135 |
def __init__(self, interrupt_threshold):
|
| 136 |
super().__init__()
|
|
@@ -462,8 +465,14 @@ class MainWindow(QMainWindow):
|
|
| 462 |
self.speak(response)
|
| 463 |
|
| 464 |
def generate_response(self, texto=None):
|
|
|
|
| 465 |
if texto is None: # Si no se proporciona un texto, se genera una respuesta de interrupción
|
| 466 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
|
| 468 |
system_instructions = self.system_prompt_text.toPlainText()
|
| 469 |
prompt = f"{system_instructions}\nUsuario: {texto}\nAsistente: "
|
|
|
|
| 80 |
|
| 81 |
# Global configuration
|
| 82 |
SYSTEM_PROMPT = {
|
| 83 |
+
"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",
|
| 84 |
"en": "speak Spanish."
|
| 85 |
}
|
| 86 |
|
|
|
|
| 88 |
MAX_TOKENS = 100
|
| 89 |
TEMPERATURA = 0.5
|
| 90 |
INTERRUPT_THRESHOLD = 0.3
|
| 91 |
+
INTERRUPT_COOLDOWN = 7000 # 7000 ms = 7 segundos de espera antes de permitir otra interrupción
|
| 92 |
|
| 93 |
# Determine available device
|
| 94 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 131 |
"Me complace."
|
| 132 |
]
|
| 133 |
|
| 134 |
+
# Variable para controlar el tiempo de la última interrupción
|
| 135 |
+
last_interruption_time = 0
|
| 136 |
+
|
| 137 |
class AudioThread(QThread):
|
| 138 |
def __init__(self, interrupt_threshold):
|
| 139 |
super().__init__()
|
|
|
|
| 465 |
self.speak(response)
|
| 466 |
|
| 467 |
def generate_response(self, texto=None):
|
| 468 |
+
global last_interruption_time
|
| 469 |
if texto is None: # Si no se proporciona un texto, se genera una respuesta de interrupción
|
| 470 |
+
current_time = time.time()
|
| 471 |
+
if current_time - last_interruption_time >= 10:
|
| 472 |
+
last_interruption_time = current_time
|
| 473 |
+
return random.choice(INTERRUPTION_RESPONSES)
|
| 474 |
+
else:
|
| 475 |
+
return "Por favor, espere un momento antes de interrumpir de nuevo."
|
| 476 |
|
| 477 |
system_instructions = self.system_prompt_text.toPlainText()
|
| 478 |
prompt = f"{system_instructions}\nUsuario: {texto}\nAsistente: "
|