mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-27 16:10:30 +08:00
fix test & build
This commit is contained in:
@@ -12,25 +12,18 @@ describe("Contract test for Oasst API", function () {
|
||||
} as BackendUserCore;
|
||||
|
||||
it("can fetch a task", async () => {
|
||||
expect(await oasstApiClient.fetchTask("random", testUser)).to.be.not.null;
|
||||
expect(await oasstApiClient.fetchTask("random", testUser, "en")).to.be.not.null;
|
||||
});
|
||||
|
||||
it("can ack a task", async () => {
|
||||
const task = await oasstApiClient.fetchTask("random", testUser);
|
||||
expect(await oasstApiClient.ackTask(task.id, "321")).to.be.null;
|
||||
const task = await oasstApiClient.fetchTask("random", testUser, "en");
|
||||
expect(await oasstApiClient.ackTask(task.id, "321")).to.be.undefined;
|
||||
});
|
||||
|
||||
it("can record a taskInteraction", async () => {
|
||||
const task = await oasstApiClient.fetchTask("random", testUser);
|
||||
const task = await oasstApiClient.fetchTask("random", testUser, "en");
|
||||
expect(
|
||||
await oasstApiClient.interactTask(
|
||||
"text_reply_to_message",
|
||||
task.id,
|
||||
"321",
|
||||
"1",
|
||||
{ text: "Test" },
|
||||
testUser
|
||||
)
|
||||
await oasstApiClient.interactTask("text_reply_to_message", task.id, "321", "1", { text: "Test" }, testUser, "en")
|
||||
).to.be.not.null;
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export const post = (url: string, { arg: data }) => api.post(url, data).then((re
|
||||
api.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => {
|
||||
throw new OasstError(error.message ?? error, error.error_code);
|
||||
throw new OasstError(error.message ?? error, error.error_code, error?.response?.status || -1);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { withRole } from "src/lib/auth";
|
||||
import { FetchUsersParams, oasstApiClient } from "src/lib/oasst_api_client";
|
||||
import { oasstApiClient } from "src/lib/oasst_api_client";
|
||||
import prisma from "src/lib/prismadb";
|
||||
import { FetchUsersParams } from "src/types/Users";
|
||||
|
||||
/**
|
||||
* The number of users to fetch in a single request. Could later be a query parameter.
|
||||
|
||||
Reference in New Issue
Block a user