1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-11-10 15:19:18 +03:00

Merge branch 'develop' into feat/add-typebox-ajv

This commit is contained in:
louistiti 2022-11-06 23:13:49 +08:00
commit f5404920fa
6 changed files with 26 additions and 12 deletions

View File

@ -125,8 +125,10 @@ table {
} }
:root { :root {
--black-color: #151718; --black-color: #000;
--light-black-color: #222426;
--white-color: #fff; --white-color: #fff;
--grey-color: #323739;
} }
a { a {
@ -193,7 +195,7 @@ input {
color: var(--white-color); color: var(--white-color);
width: 100%; width: 100%;
border: none; border: none;
border-bottom: 2px solid var(--white-color); border-bottom: 2px solid var(--grey-color);
background: none; background: none;
font-weight: 400; font-weight: 400;
font-size: 4em; font-size: 4em;
@ -222,7 +224,7 @@ small {
top: 10%; top: 10%;
height: 50%; height: 50%;
overflow-y: auto; overflow-y: auto;
border: 2px solid var(--white-color); border: 2px solid var(--grey-color);
border-radius: 12px; border-radius: 12px;
} }
#feed::-webkit-scrollbar { #feed::-webkit-scrollbar {
@ -302,8 +304,8 @@ small {
right: 0; right: 0;
} }
#feed .leon .bubble { #feed .leon .bubble {
background-color: #eee; background-color: var(--light-black-color);
color: var(--black-color); color: var(--white-color);
} }
@keyframes fadeIn { @keyframes fadeIn {
100% { 100% {

View File

@ -137,7 +137,7 @@ document.addEventListener('DOMContentLoaded', async () => {
} }
}) })
} catch (e) { } catch (e) {
alert(`Error: ${e.message}; ${JSON.stringify(e.response.data)}`) alert(`Error: ${e.message}; ${JSON.stringify(e.response?.data)}`)
console.error(e) console.error(e)
} }
}) })

View File

@ -1,16 +1,24 @@
import dns from 'node:dns'
import dotenv from 'dotenv' import dotenv from 'dotenv'
import { defineConfig } from 'vite'
dotenv.config() dotenv.config()
dns.setDefaultResultOrder('verbatim')
// Map necessary Leon's env vars as Vite only expose VITE_* // Map necessary Leon's env vars as Vite only expose VITE_*
process.env.VITE_LEON_NODE_ENV = process.env.LEON_NODE_ENV process.env.VITE_LEON_NODE_ENV = process.env.LEON_NODE_ENV
process.env.VITE_LEON_HOST = process.env.LEON_HOST process.env.VITE_LEON_HOST = process.env.LEON_HOST
process.env.VITE_LEON_PORT = process.env.LEON_PORT process.env.VITE_LEON_PORT = process.env.LEON_PORT
export default { export default defineConfig({
root: 'app/src', root: 'app/src',
build: { build: {
outDir: '../dist', outDir: '../dist',
emptyOutDir: true emptyOutDir: true
},
server: {
port: 3000
} }
} })

View File

@ -53,6 +53,7 @@
"build:tcp-server": "ts-node scripts/build-binaries.js tcp-server", "build:tcp-server": "ts-node scripts/build-binaries.js tcp-server",
"start:tcp-server": "cross-env PIPENV_PIPFILE=tcp_server/src/Pipfile pipenv run python tcp_server/src/main.py", "start:tcp-server": "cross-env PIPENV_PIPFILE=tcp_server/src/Pipfile pipenv run python tcp_server/src/main.py",
"start": "cross-env LEON_NODE_ENV=production node ./server/dist/index.js", "start": "cross-env LEON_NODE_ENV=production node ./server/dist/index.js",
"python-bridge": "cross-env PIPENV_PIPFILE=bridges/python/src/Pipfile pipenv run python bridges/python/src/main.py server/src/intent-object.sample.json",
"train": "ts-node scripts/train/run-train.js", "train": "ts-node scripts/train/run-train.js",
"prepare-release": "ts-node scripts/release/prepare-release.js", "prepare-release": "ts-node scripts/release/prepare-release.js",
"pre-release:python-bridge": "ts-node scripts/release/pre-release-binaries.js python-bridge", "pre-release:python-bridge": "ts-node scripts/release/pre-release-binaries.js python-bridge",

View File

@ -1,4 +1,5 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path'
import os from 'node:os' import os from 'node:os'
import { spawn } from 'node:child_process' import { spawn } from 'node:child_process'
@ -199,7 +200,10 @@ dotenv.config()
try { try {
const executionStart = Date.now() const executionStart = Date.now()
const p = await command( const p = await command(
`${PYTHON_BRIDGE_BIN_PATH} scripts/assets/intent-object.json`, `${PYTHON_BRIDGE_BIN_PATH} "${path.join(
process.cwd(),
'scripts/assets/intent-object.json'
)}"`,
{ shell: true } { shell: true }
) )
const executionEnd = Date.now() const executionEnd = Date.now()

View File

@ -199,8 +199,7 @@ class Brain {
* *
* 1. Need to be at the root of the project * 1. Need to be at the root of the project
* 2. Edit: server/src/intent-object.sample.json * 2. Edit: server/src/intent-object.sample.json
* 3. Run: PIPENV_PIPFILE=bridges/python/src/Pipfile pipenv run * 3. Run: npm run python-bridge
* python bridges/python/src/main.py server/src/intent-object.sample.json
*/ */
const slots = {} const slots = {}
if (obj.slots) { if (obj.slots) {
@ -225,7 +224,7 @@ class Brain {
try { try {
fs.writeFileSync(intentObjectPath, JSON.stringify(intentObj)) fs.writeFileSync(intentObjectPath, JSON.stringify(intentObj))
this.process = spawn( this.process = spawn(
`${PYTHON_BRIDGE_BIN_PATH} ${intentObjectPath}`, `${PYTHON_BRIDGE_BIN_PATH} "${intentObjectPath}"`,
{ shell: true } { shell: true }
) )
} catch (e) { } catch (e) {