feat: Add Ask AI to HTTP Request Node (#8917)

This commit is contained in:
Alex Grozav
2024-05-02 13:52:15 +03:00
committed by GitHub
parent 7ff24f134b
commit cd9bc44bdd
40 changed files with 3945 additions and 371 deletions

View File

@@ -6,6 +6,20 @@ export interface DebugErrorPayload {
error: Error;
}
export interface DebugErrorResponse {
message: string;
}
export interface GenerateCurlPayload {
service: string;
request: string;
}
export interface GenerateCurlResponse {
curl: string;
metadata: object;
}
export async function generateCodeForPrompt(
ctx: IRestApiContext,
{
@@ -36,7 +50,7 @@ export async function generateCodeForPrompt(
export const debugError = async (
context: IRestApiContext,
payload: DebugErrorPayload,
): Promise<{ message: string }> => {
): Promise<DebugErrorResponse> => {
return await makeRestApiRequest(
context,
'POST',
@@ -44,3 +58,15 @@ export const debugError = async (
payload as unknown as IDataObject,
);
};
export const generateCurl = async (
context: IRestApiContext,
payload: GenerateCurlPayload,
): Promise<GenerateCurlResponse> => {
return await makeRestApiRequest(
context,
'POST',
'/ai/generate-curl',
payload as unknown as IDataObject,
);
};