Skip to content

Commit 4fe966f

Browse files
authored
Update dependencies to API v1 (#1536)
Signed-off-by: Djebran Lezzoum <[email protected]>
1 parent 19cb24c commit 4fe966f

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

ansible_ai_connect_admin_portal/config/webpack.mock.api.keys.modelids.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default webpackMockServer.add((app, helper) => {
1616
const modelIds = new Map<string, { model_id: string; last_update: Date }>();
1717

1818
//API KEY RELATED ENDPOINTS
19-
app.get("/api/v0/wca/apikey/", async (_req, res) => {
19+
app.get("/api/v1/wca/apikey/", async (_req, res) => {
2020
await delay(DELAY_MS);
2121
if (keys.has(ORG_ID)) {
2222
// Key response only contains the Last Updated field
@@ -27,7 +27,7 @@ export default webpackMockServer.add((app, helper) => {
2727
}
2828
});
2929

30-
app.get("/api/v0/wca/apikey/test/", async (_req, res) => {
30+
app.get("/api/v1/wca/apikey/test/", async (_req, res) => {
3131
await delay(DELAY_MS);
3232
if (!keys.has(ORG_ID)) {
3333
res.sendStatus(404);
@@ -49,7 +49,7 @@ export default webpackMockServer.add((app, helper) => {
4949
res.sendStatus(200);
5050
});
5151

52-
app.post("/api/v0/wca/apikey/", async (_req, res) => {
52+
app.post("/api/v1/wca/apikey/", async (_req, res) => {
5353
await delay(DELAY_MS);
5454
const key = _req.body["key"];
5555
if (key === "error") {
@@ -67,7 +67,7 @@ export default webpackMockServer.add((app, helper) => {
6767
res.sendStatus(200);
6868
});
6969

70-
app.delete("/api/v0/wca/apikey/", async (_req, res) => {
70+
app.delete("/api/v1/wca/apikey/", async (_req, res) => {
7171
await delay(DELAY_MS);
7272
if (keys.has(ORG_ID)) {
7373
keys.delete(ORG_ID);
@@ -81,7 +81,7 @@ export default webpackMockServer.add((app, helper) => {
8181
});
8282

8383
//MODEL ID RELATED ENDPOINTS
84-
app.get("/api/v0/wca/modelid/", async (_req, res) => {
84+
app.get("/api/v1/wca/modelid/", async (_req, res) => {
8585
await delay(DELAY_MS);
8686
if (modelIds.has(ORG_ID)) {
8787
res.json(modelIds.get(ORG_ID));
@@ -90,7 +90,7 @@ export default webpackMockServer.add((app, helper) => {
9090
}
9191
});
9292

93-
app.get("/api/v0/wca/modelid/test/", async (_req, res) => {
93+
app.get("/api/v1/wca/modelid/test/", async (_req, res) => {
9494
await delay(DELAY_MS);
9595
if (!modelIds.has(ORG_ID)) {
9696
res.sendStatus(404);
@@ -112,7 +112,7 @@ export default webpackMockServer.add((app, helper) => {
112112
res.sendStatus(200);
113113
});
114114

115-
app.post("/api/v0/wca/modelid/", async (_req, res) => {
115+
app.post("/api/v1/wca/modelid/", async (_req, res) => {
116116
await delay(DELAY_MS);
117117
const modelId = _req.body[MODEL_ID_FIELD];
118118
if (modelId === "error") {

ansible_ai_connect_admin_portal/config/webpack.mock.api.telemetry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ const webpackMockServer = require("webpack-mock-server");
55
export default webpackMockServer.add((app, helper) => {
66
let optOut = false;
77

8-
app.get("/api/v0/telemetry/", async (_req, res) => {
8+
app.get("/api/v1/telemetry/", async (_req, res) => {
99
await delay(DELAY_MS);
1010
res.json({ optOut: optOut });
1111
});
1212

13-
app.post("/api/v0/telemetry/", async (_req, res) => {
13+
app.post("/api/v1/telemetry/", async (_req, res) => {
1414
await delay(DELAY_MS);
1515
const _optOut = _req.body["optOut"];
1616
optOut = _optOut;

ansible_ai_connect_admin_portal/src/api/api.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { TelemetryRequest, WcaKeyRequest, WcaModelIdRequest } from "./types";
22
import axios from "axios";
33

4-
export const API_TELEMETRY_PATH = "/api/v0/telemetry/";
5-
export const API_WCA_KEY_PATH = "/api/v0/wca/apikey/";
6-
export const API_WCA_MODEL_ID_PATH = "/api/v0/wca/modelid/";
7-
export const API_WCA_KEY_TEST_PATH = "/api/v0/wca/apikey/test";
8-
export const API_WCA_MODEL_ID_TEST_PATH = "/api/v0/wca/modelid/test";
4+
export const API_TELEMETRY_PATH = "/api/v1/telemetry/";
5+
export const API_WCA_KEY_PATH = "/api/v1/wca/apikey/";
6+
export const API_WCA_MODEL_ID_PATH = "/api/v1/wca/modelid/";
7+
export const API_WCA_KEY_TEST_PATH = "/api/v1/wca/apikey/test/";
8+
export const API_WCA_MODEL_ID_TEST_PATH = "/api/v1/wca/modelid/test/";
99

1010
export const readCookie = (name: string): string | null => {
1111
const nameEQ = name + "=";

ansible_ai_connect_chatbot/src/types/Message.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type LLMResponse = {
1919
truncated: boolean;
2020
};
2121

22-
// Type for Ansible AI Connct service /api/v0/ai/talk API
22+
// Type for Ansible AI Connct service /api/v1/ai/talk API
2323
// Currently they are defined in the same way as OLS API
2424
export type ChatRequest = LLMRequest;
2525
export type ChatResponse = LLMResponse;

ansible_ai_connect_chatbot/src/useChatbot/useChatbot.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export const useChatbot = () => {
285285
const csrfToken = readCookie("csrftoken");
286286
const resp = await axios.post(
287287
import.meta.env.PROD
288-
? "/api/v0/ai/feedback/"
288+
? "/api/v1/ai/feedback/"
289289
: "http://localhost:8080/v1/feedback/",
290290
{
291291
chatFeedback: feedbackRequest,
@@ -415,7 +415,7 @@ export const useChatbot = () => {
415415
} else {
416416
const resp = await axios.post(
417417
import.meta.env.PROD
418-
? "/api/v0/ai/chat/"
418+
? "/api/v1/ai/chat/"
419419
: "http://localhost:8080/v1/query/",
420420
chatRequest,
421421
{

0 commit comments

Comments
 (0)