|
@@ -1,27 +1,23 @@
|
|
|
const { r2rClient } = require("r2r-js");
|
|
|
|
|
|
-const client = new r2rClient("http://localhost:8000");
|
|
|
+const client = new r2rClient("https://r2rserver.cocorobo.cn/ ");
|
|
|
|
|
|
module.exports = async function handler(req, res) {
|
|
|
console.log("Received a request at /api/login");
|
|
|
if (req.method === "POST") {
|
|
|
- const { query } = req.body;
|
|
|
+ // const { query } = req.body;
|
|
|
|
|
|
try {
|
|
|
// Login with each request. In a production app, you'd want to manage sessions.
|
|
|
- await client.login("admin@example.com", "change_me_immediately");
|
|
|
-
|
|
|
- const response = await client.rag({
|
|
|
- query: query,
|
|
|
- rag_generation_config: {
|
|
|
- model: "gpt-4o",
|
|
|
- temperature: 0.0,
|
|
|
- stream: false,
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
+ // const response = await client.users.login("xujiawei@cocorobo.cc", "usestudio-1");
|
|
|
+ const response = await client.users.login(
|
|
|
+ email="xujiawei@cocorobo.cc",
|
|
|
+ password="usestudio-1"
|
|
|
+ )
|
|
|
+ console.log(response);
|
|
|
+
|
|
|
res.status(200).json({
|
|
|
- result: response.results.completion.choices[0].message.content,
|
|
|
+ result: response.results,
|
|
|
});
|
|
|
} catch (error) {
|
|
|
res.status(500).json({
|