nyxora 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gateway/cli.js +11 -0
- package/dist/gateway/server.js +7 -2
- package/package.json +1 -1
- package/src/gateway/cli.ts +11 -0
- package/src/gateway/server.ts +6 -2
package/dist/gateway/cli.js
CHANGED
|
@@ -53,6 +53,7 @@ console.log(`================================`);
|
|
|
53
53
|
// 2. Setup boilerplate files if in global mode and they don't exist
|
|
54
54
|
if (isGlobalMode) {
|
|
55
55
|
const globalEnvPath = path_1.default.join(appDir, '.env');
|
|
56
|
+
const globalConfigPath = path_1.default.join(appDir, 'config.yaml');
|
|
56
57
|
const globalUserMdPath = path_1.default.join(appDir, 'user.md');
|
|
57
58
|
const globalIdentityMdPath = path_1.default.join(appDir, 'IDENTITY.md');
|
|
58
59
|
// Copy .env.example to ~/.nyxora/.env if it doesn't exist
|
|
@@ -66,6 +67,16 @@ if (isGlobalMode) {
|
|
|
66
67
|
fs_1.default.writeFileSync(globalEnvPath, '# Nyxora Environment Variables\nOPENAI_API_KEY=\nGEMINI_API_KEY=\nTELEGRAM_BOT_TOKEN=\n');
|
|
67
68
|
}
|
|
68
69
|
}
|
|
70
|
+
// Copy default config.yaml
|
|
71
|
+
if (!fs_1.default.existsSync(globalConfigPath)) {
|
|
72
|
+
const exampleConfigPath = path_1.default.resolve(__dirname, '../../../config.yaml');
|
|
73
|
+
if (fs_1.default.existsSync(exampleConfigPath)) {
|
|
74
|
+
fs_1.default.copyFileSync(exampleConfigPath, globalConfigPath);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
fs_1.default.writeFileSync(globalConfigPath, 'agent:\n name: Nyxora-Agent\n default_chain: base\nllm:\n provider: openai\n model: gpt-4o-mini\n temperature: 0.2\n api_keys: []\nmemory:\n type: file\n path: memory.json\n');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
69
80
|
if (!fs_1.default.existsSync(globalUserMdPath)) {
|
|
70
81
|
fs_1.default.writeFileSync(globalUserMdPath, 'Tuliskan instruksi kustom, aturan khusus, profil pengguna, atau persona yang Anda inginkan untuk Nyxora AI di file ini.\n');
|
|
71
82
|
}
|
package/dist/gateway/server.js
CHANGED
|
@@ -137,8 +137,13 @@ app.post('/api/chat', async (req, res) => {
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
// Fallback for React Router (Single Page Application)
|
|
140
|
-
app.
|
|
141
|
-
|
|
140
|
+
app.use((req, res, next) => {
|
|
141
|
+
if (req.method === 'GET' && !req.path.startsWith('/api')) {
|
|
142
|
+
res.sendFile(path_1.default.join(__dirname, '../../../dashboard/dist/index.html'));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
next();
|
|
146
|
+
}
|
|
142
147
|
});
|
|
143
148
|
function startServer() {
|
|
144
149
|
const PORT = process.env.PORT || 3000;
|
package/package.json
CHANGED
package/src/gateway/cli.ts
CHANGED
|
@@ -20,6 +20,7 @@ console.log(`================================`);
|
|
|
20
20
|
// 2. Setup boilerplate files if in global mode and they don't exist
|
|
21
21
|
if (isGlobalMode) {
|
|
22
22
|
const globalEnvPath = path.join(appDir, '.env');
|
|
23
|
+
const globalConfigPath = path.join(appDir, 'config.yaml');
|
|
23
24
|
const globalUserMdPath = path.join(appDir, 'user.md');
|
|
24
25
|
const globalIdentityMdPath = path.join(appDir, 'IDENTITY.md');
|
|
25
26
|
|
|
@@ -34,6 +35,16 @@ if (isGlobalMode) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
// Copy default config.yaml
|
|
39
|
+
if (!fs.existsSync(globalConfigPath)) {
|
|
40
|
+
const exampleConfigPath = path.resolve(__dirname, '../../../config.yaml');
|
|
41
|
+
if (fs.existsSync(exampleConfigPath)) {
|
|
42
|
+
fs.copyFileSync(exampleConfigPath, globalConfigPath);
|
|
43
|
+
} else {
|
|
44
|
+
fs.writeFileSync(globalConfigPath, 'agent:\n name: Nyxora-Agent\n default_chain: base\nllm:\n provider: openai\n model: gpt-4o-mini\n temperature: 0.2\n api_keys: []\nmemory:\n type: file\n path: memory.json\n');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
if (!fs.existsSync(globalUserMdPath)) {
|
|
38
49
|
fs.writeFileSync(globalUserMdPath, 'Tuliskan instruksi kustom, aturan khusus, profil pengguna, atau persona yang Anda inginkan untuk Nyxora AI di file ini.\n');
|
|
39
50
|
}
|
package/src/gateway/server.ts
CHANGED
|
@@ -111,8 +111,12 @@ app.post('/api/chat', async (req, res) => {
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
// Fallback for React Router (Single Page Application)
|
|
114
|
-
app.
|
|
115
|
-
|
|
114
|
+
app.use((req, res, next) => {
|
|
115
|
+
if (req.method === 'GET' && !req.path.startsWith('/api')) {
|
|
116
|
+
res.sendFile(path.join(__dirname, '../../../dashboard/dist/index.html'));
|
|
117
|
+
} else {
|
|
118
|
+
next();
|
|
119
|
+
}
|
|
116
120
|
});
|
|
117
121
|
|
|
118
122
|
export function startServer() {
|