π OpenHands: AI-Driven Development
refactor(frontend): Remove unused API methods from conversation-service.api.ts (#13870)
Tim O'Farrellde53245d1be8
diff --git a/frontend/src/api/conversation-service/conversation-service.api.ts b/frontend/src/api/conversation-service/conversation-service.api.tsindex bf00fd1642..b873b96d79 100644--- a/frontend/src/api/conversation-service/conversation-service.api.ts+++ b/frontend/src/api/conversation-service/conversation-service.api.ts@@ -1,17 +1,12 @@import { AxiosHeaders } from "axios";import {GetVSCodeUrlResponse,- Conversation,- ResultSet,GetTrajectoryResponse,- GetMicroagentsResponse,- GetMicroagentPromptResponse,FileUploadSuccessResponse,- GetFilesResponse,+ Conversation,} from "../open-hands.types";import { openHands } from "../open-hands-axios";import { Provider } from "#/types/settings";-import { SuggestedTask } from "#/utils/types";import { V1AppConversation } from "./v1-conversation-service.types";class ConversationService {@@ -56,18 +51,6 @@ class ConversationService {return headers;}- /**- * Get the web hosts- * @returns Array of web hosts- */- static async getWebHosts(conversationId: string): Promise<string[]> {- const url = `${this.getConversationUrl(conversationId)}/web-hosts`;- const response = await openHands.get(url, {- headers: this.getConversationHeaders(),- });- return Object.keys(response.data.hosts);- }-/*** Get the VSCode URL* @returns VSCode URL@@ -82,67 +65,10 @@ class ConversationService {return data;}- static async getRuntimeId(- conversationId: string,- ): Promise<{ runtime_id: string }> {- const url = `${this.getConversationUrl(conversationId)}/config`;- const { data } = await openHands.get<{ runtime_id: string }>(url, {- headers: this.getConversationHeaders(),- });- return data;- }-- static async searchConversations(- selectedRepository?: string,- conversationTrigger?: string,- limit: number = 100,- ): Promise<Conversation[]> {- const params = new URLSearchParams();- params.append("limit", limit.toString());-- if (selectedRepository) {- params.append("selected_repository", selectedRepository);- }-- if (conversationTrigger) {- params.append("conversation_trigger", conversationTrigger);- }-- const { data } = await openHands.get<ResultSet<Conversation>>(- `/api/conversations?${params.toString()}`,- );- return data.results;- }-static async deleteUserConversation(conversationId: string): Promise<void> {await openHands.delete(`/api/conversations/${conversationId}`);}- static async createConversation(- selectedRepository?: string,- git_provider?: Provider,- initialUserMsg?: string,- suggested_task?: SuggestedTask,- selected_branch?: string,- conversationInstructions?: string,- ): Promise<Conversation> {- const body = {- repository: selectedRepository,- git_provider,- selected_branch,- initial_user_msg: initialUserMsg,- suggested_task,- conversation_instructions: conversationInstructions,- };-- const { data } = await openHands.post<Conversation>(- "/api/conversations",- body,- );-- return data;- }-static async getConversation(conversationId: string,): Promise<Conversation | null> {@@ -185,65 +111,6 @@ class ConversationService {return data;}- /**- * Get the available microagents associated with a conversation- * @param conversationId The ID of the conversation- * @returns The available microagents associated with the conversation- */- static async getMicroagents(- conversationId: string,- ): Promise<GetMicroagentsResponse> {- const url = `${this.getConversationUrl(conversationId)}/microagents`;- const { data } = await openHands.get<GetMicroagentsResponse>(url, {- headers: this.getConversationHeaders(),- });- return data;- }-- static async getMicroagentPrompt(- conversationId: string,- eventId: number,- ): Promise<string> {- const url = `${this.getConversationUrl(conversationId)}/remember-prompt`;- const { data } = await openHands.get<GetMicroagentPromptResponse>(url, {- params: { event_id: eventId },- headers: this.getConversationHeaders(),- });-- return data.prompt;- }-- static async updateConversation(- conversationId: string,- updates: { title: string },- ): Promise<boolean> {- const { data } = await openHands.patch<boolean>(- `/api/conversations/${conversationId}`,- updates,- );-- return data;- }-- /**- * Retrieve the list of files available in the workspace- * @param conversationId ID of the conversation- * @param path Path to list files from. If provided, it lists all the files in the given path- * @returns List of files available in the given path. If path is not provided, it lists all the files in the workspace- */- static async getFiles(- conversationId: string,- path?: string,- ): Promise<GetFilesResponse> {- const url = `${this.getConversationUrl(conversationId)}/list-files`;- const { data } = await openHands.get<GetFilesResponse>(url, {- params: { path },- headers: this.getConversationHeaders(),- });-- return data;- }-/*** Upload multiple files to the workspace* @param conversationId ID of the conversation