mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Improve comments and error handling in Llama.ts and ImproveComments.ts
This commit is contained in:
@@ -44,7 +44,7 @@ export default class ImproveComments extends CopilotActionBase {
|
||||
|
||||
const oldCode: string = data.input.files[data.input.currentFilePath]
|
||||
?.fileContent as string;
|
||||
|
||||
|
||||
const newCode: string = newContent;
|
||||
|
||||
const validationPrompt: CopilotActionPrompt =
|
||||
|
||||
@@ -8,7 +8,10 @@ import { JSONArray, JSONObject } from "Common/Types/JSON";
|
||||
import BadRequestException from "Common/Types/Exception/BadRequestException";
|
||||
import Sleep from "Common/Types/Sleep";
|
||||
import logger from "CommonServer/Utils/Logger";
|
||||
import { CopilotActionPrompt, Prompt } from "../CopilotActions/CopilotActionsBase";
|
||||
import {
|
||||
CopilotActionPrompt,
|
||||
Prompt,
|
||||
} from "../CopilotActions/CopilotActionsBase";
|
||||
import ErrorGettingResponseFromLLM from "../../Exceptions/ErrorGettingResponseFromLLM";
|
||||
import BadOperationException from "Common/Types/Exception/BadOperationException";
|
||||
|
||||
@@ -46,7 +49,7 @@ export default class Llama extends LlmBase {
|
||||
|
||||
const idOfPrompt: string = result["id"] as string;
|
||||
|
||||
if(result["error"] && typeof result["error"] === "string"){
|
||||
if (result["error"] && typeof result["error"] === "string") {
|
||||
throw new BadOperationException(result["error"]);
|
||||
}
|
||||
|
||||
@@ -69,7 +72,10 @@ export default class Llama extends LlmBase {
|
||||
throw response;
|
||||
}
|
||||
|
||||
if(response.data["error"] && typeof response.data["error"] === "string"){
|
||||
if (
|
||||
response.data["error"] &&
|
||||
typeof response.data["error"] === "string"
|
||||
) {
|
||||
throw new BadOperationException(response.data["error"]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user