Update index.js
Browse files
index.js
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
const express = require('express');
|
2 |
const bodyParser = require('body-parser');
|
3 |
-
const fetch = require('node-fetch');
|
4 |
const { exec } = require('child_process');
|
5 |
|
|
|
|
|
|
|
6 |
const app = express();
|
7 |
const port = 7860;
|
8 |
|
@@ -144,6 +146,11 @@ app.post("/chat/completions", async (req, res) => {
|
|
144 |
});
|
145 |
});
|
146 |
|
|
|
|
|
|
|
|
|
|
|
147 |
app.listen(port, () => {
|
148 |
console.log(`Sunny server running on port ${port}`);
|
149 |
});
|
|
|
1 |
const express = require('express');
|
2 |
const bodyParser = require('body-parser');
|
|
|
3 |
const { exec } = require('child_process');
|
4 |
|
5 |
+
// Ensure fetch is available in Node.js
|
6 |
+
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
|
7 |
+
|
8 |
const app = express();
|
9 |
const port = 7860;
|
10 |
|
|
|
146 |
});
|
147 |
});
|
148 |
|
149 |
+
// End of service when the user is tired or pauses
|
150 |
+
app.post("/end-of-service", (req, res) => {
|
151 |
+
res.send("End of service. Rest well!");
|
152 |
+
});
|
153 |
+
|
154 |
app.listen(port, () => {
|
155 |
console.log(`Sunny server running on port ${port}`);
|
156 |
});
|