Public
Back
Version 2
6/4/2024
import { GptApi } from "jsr:@xkonti/gpt-api-framework@0.0.1";
import { z } from "npm:zod";
const api = new GptApi({
url: "https://theapi.web.val.run",
title: "The API",
description: "The API for a GPT to use",
version: "1.0.0",
policyGetter: async () => {
return "This is a privacy policy";
},
});
const RequestSchema = z.object({
message: z.string().describe("A message to pass"),
}).describe("Data required by the action");
const ResponseSchema = z.object({
message: z.string().describe("A response to the request message"),
}).describe("A result of the action");
api.jsonToJson({
verb: "post",
path: "/sendmessage",
operationId: "sendmessage",
desc: "Endpoint for submitting messages",
requestSchema: RequestSchema,
responseSchema: ResponseSchema,
}, async (ctx, input) => {
const { message } = input;
return {
message: `You sent: ${message}`,
};
});
export default api.serve();
domingo1987-problempython.web.val.run
Updated: June 4, 2024