Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
@@ -73,14 +73,15 @@ app.post('/api/img2img', async (req, res) => {
|
|
73 |
}
|
74 |
})
|
75 |
|
76 |
-
app.post('/api/
|
77 |
try {
|
78 |
console.log(req.body)
|
79 |
const { prompt, status } = req.body
|
80 |
if (!prompt) return res.json({ succese: false, message: 'Require an Promot text!'})
|
|
|
81 |
|
82 |
if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
|
83 |
-
const response = await
|
84 |
|
85 |
res.json({
|
86 |
status: true,
|
@@ -131,7 +132,7 @@ async function processImage2Img(imgBuffer, prompt) {
|
|
131 |
});
|
132 |
}
|
133 |
|
134 |
-
async function
|
135 |
try {
|
136 |
const client = await Client.connect("KingNish/OpenGPT-4o", { debug: true });
|
137 |
const result = await client.predict("/chat", {
|
|
|
73 |
}
|
74 |
})
|
75 |
|
76 |
+
app.post('/api/openai/gpt4', async (req, res) => {
|
77 |
try {
|
78 |
console.log(req.body)
|
79 |
const { prompt, status } = req.body
|
80 |
if (!prompt) return res.json({ succese: false, message: 'Require an Promot text!'})
|
81 |
+
if (!status) return res.json({ success: false, message: 'Required an status text!' })
|
82 |
|
83 |
if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
|
84 |
+
const response = await askOpenGPT4o(prompt);
|
85 |
|
86 |
res.json({
|
87 |
status: true,
|
|
|
132 |
});
|
133 |
}
|
134 |
|
135 |
+
async function askOpenGPT4o(prompt) {
|
136 |
try {
|
137 |
const client = await Client.connect("KingNish/OpenGPT-4o", { debug: true });
|
138 |
const result = await client.predict("/chat", {
|