Update index.js
Browse files
index.js
CHANGED
@@ -30,9 +30,9 @@ app.all('/', (req, res) => {
|
|
30 |
})
|
31 |
})
|
32 |
|
33 |
-
app.
|
34 |
try {
|
35 |
-
let { characterId, text, sessionId } = req.
|
36 |
if (!characterId) return res.json({ success: false, message: 'Input parameter characterId' })
|
37 |
if (!text) return res.json({ success: false, message: 'Input parameter text' })
|
38 |
|
@@ -63,9 +63,9 @@ app.get('/api', async (req, res) => {
|
|
63 |
}
|
64 |
})
|
65 |
|
66 |
-
app.
|
67 |
try {
|
68 |
-
const { characterId } = req.
|
69 |
if (!characterId) return res.json({ success: false, message: 'Input parameter characterId' })
|
70 |
|
71 |
const result = await characterAI.fetchCharacterInfo(characterId)
|
@@ -78,9 +78,9 @@ app.get('/api/chara/info', async (req, res) => {
|
|
78 |
}
|
79 |
})
|
80 |
|
81 |
-
app.
|
82 |
try {
|
83 |
-
const { name } = req.
|
84 |
if (!name) return res.json({ success: false, message: 'Input parameter name' })
|
85 |
|
86 |
const { characters } = await characterAI.searchCharacters(name)
|
|
|
30 |
})
|
31 |
})
|
32 |
|
33 |
+
app.post('/api', async (req, res) => {
|
34 |
try {
|
35 |
+
let { characterId, text, sessionId } = req.body
|
36 |
if (!characterId) return res.json({ success: false, message: 'Input parameter characterId' })
|
37 |
if (!text) return res.json({ success: false, message: 'Input parameter text' })
|
38 |
|
|
|
63 |
}
|
64 |
})
|
65 |
|
66 |
+
app.post('/api/chara/info', async (req, res) => {
|
67 |
try {
|
68 |
+
const { characterId } = req.body
|
69 |
if (!characterId) return res.json({ success: false, message: 'Input parameter characterId' })
|
70 |
|
71 |
const result = await characterAI.fetchCharacterInfo(characterId)
|
|
|
78 |
}
|
79 |
})
|
80 |
|
81 |
+
app.post('/api/chara/search', async (req, res) => {
|
82 |
try {
|
83 |
+
const { name } = req.body
|
84 |
if (!name) return res.json({ success: false, message: 'Input parameter name' })
|
85 |
|
86 |
const { characters } = await characterAI.searchCharacters(name)
|