import axios from "./config";

export const SERVER_URL = "http://10.10.21.21:5176";
//export const SERVER_URL = 'http://123.57.217.13:27005'
// export const SERVER_URL = (import.meta.env.MODE === 'development') ? '/api' : 'https://server.pptist.cn'

export default {
  AIPPT_Outline(image_url: string): Promise<any> {
    const params = new URLSearchParams();
    params.append("image_url", image_url);
    return fetch(`/api/get_ggb`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ image_url }),
    });
  },

  IMG_Outline(image_url: string): Promise<any> {
    return fetch(`/api/get_ggb`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ image_url }),
    });
  },

  TXT_Outline(text: string): Promise<any> {
    return fetch(`/api/translate_to_ggb`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ natural_language_cmd: text }),
    });
  },

  CnEssay_Outline(image_url: string, grade_name: string): Promise<any> {
    return fetch(`/api/zuowen_chinese`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ grade_name, image_url }),
    });
  },

  EnEssay_Outline(image_url: string, grade_name: string): Promise<any> {
    return fetch(`/api/zuowen_english`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ grade_name, image_url }),
    });
  },
};
