Skip to content

Commit

Permalink
removed commons related types and apis in oss
Browse files Browse the repository at this point in the history
  • Loading branch information
bekossy committed Mar 27, 2024
1 parent 89542ba commit 97760d8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Environment, IPromptRevisions, Parameter, Variant} from "@/lib/Types"
import type {CollapseProps} from "antd"
import {Button, Col, Collapse, Row, Space, Tooltip, message} from "antd"
import React, {useContext, useEffect, useState} from "react"
import React, {useEffect, useState} from "react"
import {createUseStyles} from "react-jss"
import {ModelParameters, ObjectParameters, StringParameters} from "./ParametersCards"
import PublishVariantModal from "./PublishVariantModal"
Expand Down
10 changes: 1 addition & 9 deletions agenta-web/src/components/Playground/Views/TestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ import React, {useContext, useEffect, useRef, useState} from "react"
import {Button, Input, Card, Row, Col, Space, Form, Modal} from "antd"
import {CaretRightOutlined, CloseCircleOutlined, PlusOutlined} from "@ant-design/icons"
import {callVariant, promptRevision} from "@/lib/services/api"
import {
ChatMessage,
ChatRole,
GenericObject,
IPromptVersioning,
Parameter,
Variant,
} from "@/lib/Types"
import {ChatMessage, ChatRole, GenericObject, Parameter, Variant} from "@/lib/Types"
import {batchExecute, randString, removeKeys} from "@/lib/helpers/utils"
import LoadTestsModal from "../LoadTestsModal"
import AddToTestSetDrawer from "../AddToTestSetDrawer/AddToTestSetDrawer"
Expand All @@ -29,7 +22,6 @@ import dayjs from "dayjs"
import relativeTime from "dayjs/plugin/relativeTime"
import duration from "dayjs/plugin/duration"
import {useQueryParam} from "@/hooks/useQuery"
import {dynamicComponent} from "@/lib/helpers/dynamic"

dayjs.extend(relativeTime)
dayjs.extend(duration)
Expand Down
40 changes: 0 additions & 40 deletions agenta-web/src/lib/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,6 @@ export interface Parameter {
maximum?: number
}

export interface DeploymentRevisionConfig {
config_name: string
current_version: number
parameters: Record<string, any>
}

export interface IPromptRevisions {
config: {
config_name: string
Expand All @@ -185,29 +179,6 @@ export interface IPromptRevisions {
revision: number
}

export interface IEnvironmentRevision {
revision: number
modified_by: string
created_at: string
}

export interface IPromptVersioning {
app_id: string
app_name: string
base_id: string
base_name: string
config_name: string
organization_id: string
parameters: Record<string, any>
previous_variant_name: string | null
revision: number
revisions: [IPromptRevisions]
uri: string
user_id: string
variant_id: string
variant_name: string
}

export interface EvaluationResponseType {
id: string
variant_ids: string[]
Expand Down Expand Up @@ -312,17 +283,6 @@ export interface Environment {
revision: string | null
}

export interface DeploymentRevisions extends Environment {
revisions: {
created_at: string
deployed_app_variant_revision: string
deployment: string
id: string
modified_by: string
revision: number
}[]
}

export interface CustomEvaluation {
id: string
app_name: string
Expand Down
5 changes: 2 additions & 3 deletions agenta-web/src/lib/hooks/useVariant.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {useState, useEffect} from "react"
import {promptVersioning, saveNewVariant, updateVariantParams} from "@/lib/services/api"
import {Variant, Parameter, IPromptRevisions} from "@/lib/Types"
import {saveNewVariant, updateVariantParams} from "@/lib/services/api"
import {Variant, Parameter} from "@/lib/Types"
import {getAllVariantParameters, updateInputParams} from "@/lib/helpers/variantHelper"
import {isDemo} from "../helpers/utils"
import {PERMISSION_ERR_MSG} from "../helpers/axiosConfig"

/**
Expand Down
41 changes: 0 additions & 41 deletions agenta-web/src/lib/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
AppTemplate,
GenericObject,
Environment,
DeploymentRevisionConfig,
CreateCustomEvaluation,
ExecuteCustomEvalCode,
AICritiqueCreate,
Expand Down Expand Up @@ -671,46 +670,6 @@ export const fetchEnvironments = async (appId: string): Promise<Environment[]> =
return data
}

export const fetchDeploymentRevisionConfig = async (
deploymentRevisionId: string,
): Promise<DeploymentRevisionConfig> => {
const response = await fetch(
`${getAgentaApiUrl()}/api/configs/deployment/${deploymentRevisionId}/`,
)

if (response.status !== 200) {
throw new Error("Failed to fetch deployment revision configuration")
}

const data = (await response.json()) as DeploymentRevisionConfig
return data
}

export const fetchDeploymentRevisions = async (
appId: string,
environmentName: string,
ignoreAxiosError: boolean = false,
) => {
const {data} = await axios.get(
`${getAgentaApiUrl()}/api/apps/${appId}/revisions/${environmentName}/`,
{
_ignoreError: ignoreAxiosError,
} as any,
)
return data
}

export const revertDeploymentRevision = async (
deploymentRevisionId: string,
ignoreAxiosError: boolean = false,
) => {
const response = await axios.post(
`${getAgentaApiUrl()}/api/configs/deployment/${deploymentRevisionId}/revert/`,
{_ignoreError: ignoreAxiosError} as any,
)
return response
}

export const publishVariant = async (variantId: string, environmentName: string) => {
await axios.post(`${getAgentaApiUrl()}/api/environments/deploy/`, {
environment_name: environmentName,
Expand Down

0 comments on commit 97760d8

Please sign in to comment.