1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-11-23 09:43:19 +03:00

chore: upgrade nodemon to 3.1.0 and minor improvements

This commit is contained in:
louistiti 2024-05-23 13:46:21 +08:00
parent 8a80f4fce6
commit 9c8db3364b
No known key found for this signature in database
GPG Key ID: 92CD6A2E497E1669
7 changed files with 24 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{
"verbose": false,
"verbose": true,
"watch": ["server/src"],
"ext": "ts,js,json",
"ignore": [".git", "node_modules", "server/src/tmp", "server/dist"],

View File

@ -139,7 +139,7 @@
"jest-extended": "2.0.0",
"json": "11.0.0",
"lint-staged": "15.1.0",
"nodemon": "3.0.1",
"nodemon": "3.1.0",
"prettier": "3.1.0",
"resolve-tspaths": "0.8.17",
"semver": "7.5.4",

View File

@ -191,6 +191,21 @@ export default class Brain {
TTS.add(speech, end)
}
/**
* Unify stream feeling for all answers.
* But need to ensure that tokens aren't already sent via the onToken
* callback on the completion. Can check with LLM_PROVIDER to implement
* a mechanism to avoid sending the same tokens twice
*/
/*const generationId = StringHelper.random(6, { onlyLetters: true })
const tokens = textAnswer.split(' ')
tokens.forEach((token) => {
SOCKET_SERVER.socket?.emit('llm-token', {
token,
generationId
})
})*/
SOCKET_SERVER.socket?.emit('answer', textAnswer)
SOCKET_SERVER.socket?.emit('is-typing', false)

View File

@ -155,6 +155,9 @@ export default class LLMProvider {
completionOptions.temperature || DEFAULT_TEMPERATURE
completionOptions.maxTokens =
completionOptions.maxTokens || DEFAULT_MAX_TOKENS
/**
* TODO: support onToken (stream) for Groq provider too
*/
completionOptions.onToken = completionOptions.onToken || ((): void => {})
const isJSONMode = completionOptions.data !== null

View File

@ -188,7 +188,8 @@ import { LogHelper } from '@/helpers/log-helper'
'SIGUSR1',
'SIGUSR2',
'uncaughtException',
'SIGTERM'
'SIGTERM',
'SIGHUP'
].forEach((eventType) => {
process.on(eventType, () => {
kill(global.pythonTCPServerProcess.pid as number)

View File

@ -39,7 +39,7 @@ class ASR:
self.wake_word_callback = wake_word_callback
self.end_of_owner_speech_callback = end_of_owner_speech_callback
self.wake_words = ["ok leon", "okay leon", "hi leon", "hey leon", "hello leon", "heilion", "alion"]
self.wake_words = ["ok leon", "okay leon", "hi leon", "hey leon", "hello leon", "heilion", "alion", "hyleon"]
self.device = device
self.tcp_conn = None

View File

@ -173,6 +173,7 @@ class TCPServer:
def tts_synthesize(self, speech: str) -> Union[dict, None]:
# If TTS is not initialized yet, then wait for 2 seconds before synthesizing
if not self.tts:
self.log('TTS is not initialized yet. Waiting for 2 seconds before synthesizing...')
time.sleep(2)
"""