-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e231617
commit 9ea1320
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import mongoose from "mongoose"; | ||
const { Schema } = mongoose; | ||
|
||
if (!mongoose.models.Log) { | ||
const logsSchema = new Schema( | ||
{ | ||
bot: String, | ||
history: [String], | ||
question: String, | ||
toolsSelect: [String], | ||
}, | ||
{ | ||
timestamps: { | ||
createdAt: "created_at", | ||
updatedAt: "updated_at", | ||
}, | ||
} | ||
); | ||
|
||
mongoose.model("Log", logsSchema); | ||
} | ||
|
||
export default mongoose.models.Log; | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use server" | ||
import {connect} from "../../config/database"; | ||
import Log from "../../models/Log" | ||
|
||
export default async function handler(req, res) { | ||
|
||
if (req.method !== 'POST') { | ||
res.status(405).json({ message: 'Method Not Allowed' }); | ||
return; | ||
} | ||
|
||
connect(); | ||
|
||
const obj = req.body; | ||
|
||
console.info("req.body", req.body) | ||
|
||
const log = await Log.create(obj) | ||
|
||
res.status(200).json({message: "ok"}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9ea1320
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mylangchain – ./
mylangchain.vercel.app
mylangchain-git-main-ernesttan.vercel.app
mylangchain-ernesttan.vercel.app