import { o as y, c as w, a as t, d as U, ab as V, r as o, q as s, v as a, x as C, i as F, t as A, F as D, a2 as P, ae as R, _ as M } from "./main-b2186337.mjs";
import { _ as O } from "./loadernew-ac153a51.mjs";
function B(q, c) {
  return y(), w("svg", {
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "0 0 24 24",
    fill: "currentColor",
    "aria-hidden": "true",
    "data-slot": "icon"
  }, [
    t("path", { d: "M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z" })
  ]);
}
const L = { class: "grid grid-cols-5 items-stretch gap-8 px-5" }, Q = { class: "col-span-4" }, Y = { class: "mb-4 mt-6 flex items-center gap-2" }, $ = { class: "flex flex-col items-end gap-2" }, H = { key: 1 }, W = { class: "mb-12" }, X = { class: "line-break shadow-sm min-h-[20vh] w-full border border-gray-300 bg-gray-50 p-4 text-sm text-gray-900 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box" }, z = {
  class: "col-span-1",
  id: "parameters"
}, G = { class: "sticky top-0 grid grid-cols-1 gap-3" }, K = /* @__PURE__ */ U({
  __name: "PromptTesting",
  setup(q) {
    const c = V(), d = o(!1), _ = o(""), h = o(""), b = o(), u = o(localStorage.getItem("prompt") || ""), k = o(""), S = o(""), g = o(localStorage.getItem("max_response") || "300"), m = o(localStorage.getItem("temperature") || "0.2"), f = o(localStorage.getItem("top_p") || "0"), p = o(localStorage.getItem("stop_sequence") || "$$$"), x = o(localStorage.getItem("frequency_penalty") || "0"), v = o(localStorage.getItem("presence_penalty") || "0"), E = async (r) => b.value = r.target.files[0], T = async () => {
      var r;
      try {
        b.value || c.setError("Please upload a file.");
        const e = (r = b.value) == null ? void 0 : r.name, l = new FormData();
        l.append(e, b.value), console.log(l);
        const i = await P("https://corp-fap-eus-dev-tas-imm-06.azurewebsites.net/api/func-guru", l);
        console.log(i), u.value = _.value + i.data[e] + h.value;
      } catch (e) {
        console.log(e);
      }
    }, I = async () => {
      var e, l, i;
      localStorage.setItem("prompt", u.value), localStorage.setItem("max_response", g.value), localStorage.setItem("temperature", m.value), localStorage.setItem("top_p", f.value), localStorage.setItem("stop_sequence", p.value), localStorage.setItem("frequency_penalty", x.value), localStorage.setItem("presence_penalty", v.value);
      const r = {
        question: k.value,
        parameters: {
          PROMPT: u.value,
          MAX_TOKENS: Number(g.value),
          TEMPERATURE: Number(m.value),
          TOP_P: Number(f.value),
          STOP_SEQUENCE: p.value ? p.value : null,
          FREQUENCY_PENALTY: Number(x.value),
          PRESENCE_PENALTY: Number(v.value)
        }
      };
      try {
        d.value = !0;
        const n = await P("/PromptTesting", r);
        console.log(n.data), S.value = (l = (e = n.data) == null ? void 0 : e.body) == null ? void 0 : l.answer, d.value = !1;
      } catch (n) {
        if (console.log(n), d.value = !1, R.isAxiosError(n)) {
          const N = n;
          c.setError(((i = N.response) == null ? void 0 : i.data).message);
        } else
          c.setError("There was an issue, contact to helpmate");
      }
    };
    return (r, e) => (y(), w(D, null, [
      e[22] || (e[22] = t("div", { class: "mb-6 w-full bg-genpact-blue-box px-5" }, null, -1)),
      t("div", L, [
        t("div", Q, [
          t("div", null, [
            e[10] || (e[10] = t("label", {
              for: "upload file",
              class: "ml-1 block text-base font-bold text-gray-900"
            }, " Please upload PDF or DOCX file ", -1)),
            t("input", {
              type: "file",
              id: "file_input",
              onChange: E,
              class: "shadow-sm ml-1 border border-slate-300 bg-white px-3 py-2 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box sm:text-sm",
              accept: ".pdf,.docx"
            }, null, 32)
          ]),
          t("div", Y, [
            t("span", null, [
              s(t("input", {
                type: "text",
                "onUpdate:modelValue": e[0] || (e[0] = (l) => _.value = l),
                id: "Start_identifier",
                class: "shadow-sm w-96 border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box",
                placeholder: "start identifier..."
              }, null, 512), [
                [a, _.value]
              ])
            ]),
            t("span", null, [
              s(t("input", {
                type: "text",
                "onUpdate:modelValue": e[1] || (e[1] = (l) => h.value = l),
                id: "end_identifier",
                class: "shadow-sm w-96 border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box",
                placeholder: "end identifier..."
              }, null, 512), [
                [a, h.value]
              ])
            ]),
            t("span", null, [
              t("button", {
                type: "button",
                id: "button",
                onClick: T,
                class: "cursor-pointer bg-genpact-blue-box p-2 text-center text-sm text-white hover:bg-blue-800"
              }, "extract")
            ])
          ]),
          t("div", null, [
            e[11] || (e[11] = t("label", {
              for: "prompt",
              class: "block text-base font-bold text-gray-900"
            }, "Prompt", -1)),
            s(t("textarea", {
              "onUpdate:modelValue": e[2] || (e[2] = (l) => u.value = l),
              id: "prompt",
              rows: "5",
              class: "shadow-sm mt-1 w-full border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box",
              placeholder: "Write here..."
            }, null, 512), [
              [a, u.value]
            ])
          ]),
          t("div", null, [
            e[13] || (e[13] = t("label", {
              for: "questions",
              class: "mt-6 block text-base font-bold text-gray-900"
            }, "Question", -1)),
            t("div", $, [
              s(t("textarea", {
                "onUpdate:modelValue": e[3] || (e[3] = (l) => k.value = l),
                id: "questions",
                rows: "3",
                class: "shadow-sm w-full border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box",
                placeholder: "Write here..."
              }, null, 512), [
                [a, k.value]
              ]),
              d.value ? (y(), w("div", H, e[12] || (e[12] = [
                t("img", {
                  class: "loadercss mx-auto block h-10 w-10",
                  src: O,
                  alt: "Loader Gif"
                }, null, -1)
              ]))) : (y(), w("button", {
                key: 0,
                id: "button",
                onClick: I,
                class: "cursor-pointer"
              }, [
                C(F(B), { class: "h-7 w-7 fill-genpact-blue-box" })
              ]))
            ])
          ]),
          t("div", W, [
            e[14] || (e[14] = t("label", {
              for: "response",
              class: "mb-1 block text-base font-bold text-gray-900"
            }, "Response", -1)),
            t("div", X, A(S.value), 1)
          ])
        ]),
        t("div", z, [
          t("span", G, [
            t("span", null, [
              e[15] || (e[15] = t("label", {
                for: "Parameters",
                class: "mb-1 block text-base font-bold text-gray-900"
              }, "Parameters", -1)),
              e[16] || (e[16] = t("label", {
                for: "max_response",
                class: "mb-1 block text-xs text-gray-900"
              }, "max response", -1)),
              s(t("input", {
                "onUpdate:modelValue": e[4] || (e[4] = (l) => g.value = l),
                type: "number",
                min: "0",
                max: "4000",
                required: "",
                class: "shadow-sm block w-full border border-slate-300 bg-white p-2 placeholder:italic placeholder:text-slate-400 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box sm:text-sm",
                placeholder: "max response"
              }, null, 512), [
                [a, g.value]
              ])
            ]),
            t("span", null, [
              e[17] || (e[17] = t("label", {
                for: "temperature",
                class: "mb-1 block text-xs text-gray-900"
              }, "temperature", -1)),
              s(t("input", {
                "onUpdate:modelValue": e[5] || (e[5] = (l) => m.value = l),
                type: "number",
                min: "0",
                max: "1",
                step: "0.1",
                required: "",
                class: "shadow-sm block w-full border border-slate-300 bg-white p-2 placeholder:italic placeholder:text-slate-400 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box sm:text-sm",
                placeholder: "Temperature"
              }, null, 512), [
                [a, m.value]
              ])
            ]),
            t("span", null, [
              e[18] || (e[18] = t("label", {
                for: "top_p",
                class: "mb-1 block text-xs text-gray-900"
              }, "top_p", -1)),
              s(t("input", {
                "onUpdate:modelValue": e[6] || (e[6] = (l) => f.value = l),
                type: "number",
                min: "0",
                max: "1",
                step: "0.1",
                required: "",
                class: "shadow-sm block w-full border border-slate-300 bg-white p-2 placeholder:italic placeholder:text-slate-400 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box sm:text-sm",
                placeholder: "Top_P"
              }, null, 512), [
                [a, f.value]
              ])
            ]),
            t("span", null, [
              e[19] || (e[19] = t("label", {
                for: "Stop_sequence",
                class: "mb-1 block text-xs text-gray-900"
              }, "stop sequence", -1)),
              s(t("input", {
                "onUpdate:modelValue": e[7] || (e[7] = (l) => p.value = l),
                type: "text",
                required: "",
                class: "shadow-sm block w-full border border-slate-300 bg-white p-2 placeholder:italic placeholder:text-slate-400 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box sm:text-sm",
                placeholder: "Stop sequence"
              }, null, 512), [
                [a, p.value]
              ])
            ]),
            t("span", null, [
              e[20] || (e[20] = t("label", {
                for: "Frequency_penalty",
                class: "mb-1 block text-xs text-gray-900"
              }, "Frequency penalty", -1)),
              s(t("input", {
                "onUpdate:modelValue": e[8] || (e[8] = (l) => x.value = l),
                type: "number",
                min: "0",
                max: "2",
                step: "0.1",
                required: "",
                class: "shadow-sm block w-full border border-slate-300 bg-white p-2 placeholder:italic placeholder:text-slate-400 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box sm:text-sm",
                placeholder: "Frequency penalty"
              }, null, 512), [
                [a, x.value]
              ])
            ]),
            t("span", null, [
              e[21] || (e[21] = t("label", {
                for: "Presence_penalty",
                class: "mb-1 block text-xs text-gray-900"
              }, "Presence penalty", -1)),
              s(t("input", {
                "onUpdate:modelValue": e[9] || (e[9] = (l) => v.value = l),
                type: "number",
                min: "0",
                max: "2",
                step: "0.1",
                required: "",
                class: "shadow-sm block w-full border border-slate-300 bg-white p-2 placeholder:italic placeholder:text-slate-400 focus:border-genpact-blue-box focus:outline-none focus:ring-1 focus:ring-genpact-blue-box sm:text-sm",
                placeholder: "Presence penalty"
              }, null, 512), [
                [a, v.value]
              ])
            ])
          ])
        ])
      ])
    ], 64));
  }
});
const J = /* @__PURE__ */ M(K, [["__scopeId", "data-v-2ff8f3c0"]]);
export {
  J as default
};
