Uname: Linux premium294.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 104.21.96.1
Your Ip: 216.73.216.223
User: mjbynoyq (1574) | Group: mjbynoyq (1570)
Safe Mode: OFF
Disable Function:
NONE

name : utils.ts
import { Action, Conversation, LanguageCodes, Role } from "../types/AiText";

interface Params {
  action?: Action;
  language: string;
  prompt: string;
}

export const createConversation = ({
  action,
  language,
  prompt
}: Params): Conversation => {
  const languageCode = LanguageCodes[language];
  const outputLanguage = languageCode
    ? `Write the result in "${LanguageCodes[language]}".`
    : "";

  switch (action) {
    case Action.Extend:
      return {
        temperature: 0.5,
        messages: [
          {
            role: Role.System,
            content: `Please expand the text wrapped in parentheses. Increase the length by adding additional aspects or expanding the existing information. Provide more details or supplementary information to enhance the content. ${outputLanguage}`
          },
          {
            role: Role.User,
            content: `[${prompt}]`
          }
        ]
      };
    case Action.Shorten:
      return {
        temperature: 0.2,
        messages: [
          {
            role: Role.System,
            content: `Please shorten the text wrapped in parentheses. Condense the content by removing unnecessary details or aspects. Focus on the essential information while maintaining clarity. ${outputLanguage}`
          },
          {
            role: Role.User,
            content: `[${prompt}]`
          }
        ]
      };
    case Action.Simplify:
      return {
        temperature: 0.8,
        messages: [
          {
            role: Role.System,
            content: `Please make the text wrapped in parentheses simpler. Streamline the content by using simpler language and clearer expressions. Make the information more easily understandable. ${outputLanguage}`
          },
          {
            role: Role.User,
            content: `[${prompt}]`
          }
        ]
      };
    case Action.Professional:
    case Action.Casual:
    case Action.Confident:
    case Action.Friendly:
      return {
        temperature: 0.7,
        messages: [
          {
            role: Role.System,
            content: `Paraphrase text wrapped in parentheses in "${action}" tone. ${outputLanguage}`
          },
          {
            role: Role.User,
            content: `[${prompt}]`
          }
        ]
      };
    default:
      return {
        temperature: 0,
        messages: [
          {
            role: Role.Assistant,
            content: prompt
          }
        ]
      };
  }
};
© 2025 XylotrechusZ