Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies to API v1 #1536

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default webpackMockServer.add((app, helper) => {
const modelIds = new Map<string, { model_id: string; last_update: Date }>();

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

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

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

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

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

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

app.post("/api/v0/wca/modelid/", async (_req, res) => {
app.post("/api/v1/wca/modelid/", async (_req, res) => {
await delay(DELAY_MS);
const modelId = _req.body[MODEL_ID_FIELD];
if (modelId === "error") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const webpackMockServer = require("webpack-mock-server");
export default webpackMockServer.add((app, helper) => {
let optOut = false;

app.get("/api/v0/telemetry/", async (_req, res) => {
app.get("/api/v1/telemetry/", async (_req, res) => {
await delay(DELAY_MS);
res.json({ optOut: optOut });
});

app.post("/api/v0/telemetry/", async (_req, res) => {
app.post("/api/v1/telemetry/", async (_req, res) => {
await delay(DELAY_MS);
const _optOut = _req.body["optOut"];
optOut = _optOut;
Expand Down
10 changes: 5 additions & 5 deletions ansible_ai_connect_admin_portal/src/api/api.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TelemetryRequest, WcaKeyRequest, WcaModelIdRequest } from "./types";
import axios from "axios";

export const API_TELEMETRY_PATH = "/api/v0/telemetry/";
export const API_WCA_KEY_PATH = "/api/v0/wca/apikey/";
export const API_WCA_MODEL_ID_PATH = "/api/v0/wca/modelid/";
export const API_WCA_KEY_TEST_PATH = "/api/v0/wca/apikey/test";
export const API_WCA_MODEL_ID_TEST_PATH = "/api/v0/wca/modelid/test";
export const API_TELEMETRY_PATH = "/api/v1/telemetry/";
export const API_WCA_KEY_PATH = "/api/v1/wca/apikey/";
export const API_WCA_MODEL_ID_PATH = "/api/v1/wca/modelid/";
export const API_WCA_KEY_TEST_PATH = "/api/v1/wca/apikey/test/";
export const API_WCA_MODEL_ID_TEST_PATH = "/api/v1/wca/modelid/test/";

export const readCookie = (name: string): string | null => {
const nameEQ = name + "=";
Expand Down
2 changes: 1 addition & 1 deletion ansible_ai_connect_chatbot/src/types/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type LLMResponse = {
truncated: boolean;
};

// Type for Ansible AI Connct service /api/v0/ai/talk API
// Type for Ansible AI Connct service /api/v1/ai/talk API
// Currently they are defined in the same way as OLS API
export type ChatRequest = LLMRequest;
export type ChatResponse = LLMResponse;
Expand Down
4 changes: 2 additions & 2 deletions ansible_ai_connect_chatbot/src/useChatbot/useChatbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export const useChatbot = () => {
const csrfToken = readCookie("csrftoken");
const resp = await axios.post(
import.meta.env.PROD
? "/api/v0/ai/feedback/"
? "/api/v1/ai/feedback/"
: "http://localhost:8080/v1/feedback/",
{
chatFeedback: feedbackRequest,
Expand Down Expand Up @@ -415,7 +415,7 @@ export const useChatbot = () => {
} else {
const resp = await axios.post(
import.meta.env.PROD
? "/api/v0/ai/chat/"
? "/api/v1/ai/chat/"
: "http://localhost:8080/v1/query/",
chatRequest,
{
Expand Down
Loading