Files
plane/apps/web/core/services/ai.service.ts
Prateek Shourya 9cfde896b3 [WEB-5134] refactor: update web ESLint configuration and refactor imports to use type imports (#7957)
* [WEB-5134] refactor: update `web` ESLint configuration and refactor imports to use type imports

- Enhanced ESLint configuration by adding new rules for import consistency and type imports.
- Refactored multiple files to replace regular imports with type imports for better clarity and performance.
- Ensured consistent use of type imports across the application to align with TypeScript best practices.

* refactor: standardize type imports across components

- Updated multiple files to replace regular imports with type imports for improved clarity and consistency.
- Ensured adherence to TypeScript best practices in the rich filters and issue layouts components.
2025-10-14 16:45:07 +05:30

45 lines
1.1 KiB
TypeScript

// helpers
import { API_BASE_URL } from "@plane/constants";
// plane web constants
import type { AI_EDITOR_TASKS } from "@/plane-web/constants/ai";
// services
import { APIService } from "@/services/api.service";
// types
// FIXME:
// import { IGptResponse } from "@plane/types";
// helpers
export type TTaskPayload = {
casual_score?: number;
formal_score?: number;
task: AI_EDITOR_TASKS;
text_input: string;
};
export class AIService extends APIService {
constructor() {
super(API_BASE_URL);
}
async createGptTask(workspaceSlug: string, data: { prompt: string; task: string }): Promise<any> {
return this.post(`/api/workspaces/${workspaceSlug}/ai-assistant/`, data)
.then((response) => response?.data)
.catch((error) => {
throw error?.response;
});
}
async performEditorTask(
workspaceSlug: string,
data: TTaskPayload
): Promise<{
response: string;
}> {
return this.post(`/api/workspaces/${workspaceSlug}/rephrase-grammar/`, data)
.then((res) => res?.data)
.catch((error) => {
throw error?.response?.data;
});
}
}