feat: refine role expression and diagnose camera context in 0.5.2
This commit is contained in:
+4
-2
@@ -30,7 +30,7 @@ from protocol import WavStream, pack, unpack
|
||||
from vad import Config, Silero, VadSession
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
VERSION = '0.7.2'
|
||||
VERSION = '0.7.3'
|
||||
DEFAULT_VOICE_ID = '9a97272c-3919-5606-9c8f-9552ab602528'
|
||||
ORIGINS = {'https://192.168.31.61:5011', 'https://localhost:5011', 'https://127.0.0.1:5011'}
|
||||
|
||||
@@ -425,6 +425,7 @@ class Dialogue:
|
||||
face_message = self.face_context.take(turn)
|
||||
if face_message is not None: self.face_messages[turn] = [face_message]
|
||||
metrics['face_cue_used'] = face_message is not None
|
||||
metrics['face_context'] = self.face_context.diagnostics()
|
||||
text = text[:2000]
|
||||
if self.history:
|
||||
recorded = True
|
||||
@@ -472,6 +473,7 @@ class Dialogue:
|
||||
'\n\n' + item['content'] for item in self.face_messages.get(turn, [])) + '\n\n' + SYSTEM_FRAGMENT
|
||||
messages = [{'role': 'system', 'content': system}] + self.contexts.get(turn, []) + [{'role': 'user', 'content': text}]
|
||||
url, headers, body = self.llm_provider.request(messages, max_tokens=160)
|
||||
metrics['llm_request_count'] = 1
|
||||
raw_body = ''
|
||||
finish_reason = 'not_provided'
|
||||
usage = {}
|
||||
@@ -671,7 +673,7 @@ async def dialogue(ws: WebSocket):
|
||||
if not isinstance(data, dict): raise ValueError('control object')
|
||||
if data.get('type') == 'context.face_cue':
|
||||
if len(raw.encode('utf-8')) > 512:
|
||||
session.face_context.clear()
|
||||
session.face_context.clear('input_limit')
|
||||
else:
|
||||
session.face_context.update(data, session.turn)
|
||||
elif data.get('type') == 'debug':
|
||||
|
||||
Reference in New Issue
Block a user