feat(editor): Remove AI Error Debugging (#9337)
This commit is contained in:
committed by
GitHub
parent
f64a41d617
commit
cda062bde6
@@ -1,40 +1,11 @@
|
||||
import { Post, RestController } from '@/decorators';
|
||||
import { AIRequest } from '@/requests';
|
||||
import { AIService } from '@/services/ai.service';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { FailedDependencyError } from '@/errors/response-errors/failed-dependency.error';
|
||||
|
||||
@RestController('/ai')
|
||||
export class AIController {
|
||||
constructor(
|
||||
private readonly aiService: AIService,
|
||||
private readonly nodeTypes: NodeTypes,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Suggest a solution for a given error using the AI provider.
|
||||
*/
|
||||
@Post('/debug-error')
|
||||
async debugError(req: AIRequest.DebugError): Promise<{ message: string }> {
|
||||
const { error } = req.body;
|
||||
|
||||
let nodeType;
|
||||
if (error.node?.type) {
|
||||
nodeType = this.nodeTypes.getByNameAndVersion(error.node.type, error.node.typeVersion);
|
||||
}
|
||||
|
||||
try {
|
||||
const message = await this.aiService.debugError(error, nodeType);
|
||||
return {
|
||||
message,
|
||||
};
|
||||
} catch (aiServiceError) {
|
||||
throw new FailedDependencyError(
|
||||
(aiServiceError as Error).message ||
|
||||
'Failed to debug error due to an issue with an external dependency. Please try again later.',
|
||||
);
|
||||
}
|
||||
}
|
||||
constructor(private readonly aiService: AIService) {}
|
||||
|
||||
/**
|
||||
* Generate CURL request and additional HTTP Node metadata for given service and request
|
||||
|
||||
Reference in New Issue
Block a user