The default language is Chinese. Explain the following text. import { Action,…
- User
The default language is Chinese.
Explain the following text.
import { Action, ActionPanel, confirmAlert, Detail, Form, getSelectedText, getPreferenceValues, Icon, Keyboard, launchCommand, LaunchType, popToRoot, showToast, Toast, } from "@raycast/api"; import { useEffect, useState } from "react";
import * as providers from "./providers";
import { help_action } from "../helpers/helpPage"; import { autoCheckForUpdates } from "../helpers/update";
import { Message, pairs_to_messages } from "../classes/message";
import { truncate_chat } from "../helpers/helper";
let generationStatus = { stop: false, loading: false }; let get_status = () => generationStatus.stop;
export default ( props, { context = undefined, allowPaste = false, useSelected = false, requireQuery = false, showFormText = "", forceShowForm = false, otherReactComponents = [], processPrompt = null, allowUploadFiles = false, defaultFiles = [], useDefaultLanguage = true, } = {} ) => { // The parameters are documented here: // 1. props: We mostly use this parameter for the query value, which is obtained using props.arguments.query. // For example, the
Ask AIcommand shows a "Query" box when the user types the command. // 2. context: A string to be added before the query value. This is usually a default prompt specific to each command. // For example, theSummarycommand has a context of "Summarize the given text." // 3. allowPaste: A boolean to allow pasting the response to the clipboard. // 4. useSelected: A boolean to use the selected text as the query. If we fail to get selected text, // either of the three following scenarios will happen depending on the query value and showFormText parameter: // a. If query is provided, we will get response based on the query value. // b. If showFormText string is provided, a Form will be shown with the showFormText parameter as the field title. // c. If showFormText is not provided, an error will be shown and the command quits. // 5. requireQuery: A boolean to require a query, separate from selected text. Explanation: // By default, the selected text is taken to be the query. For example, theContinue,Fix Code... commands. // But other commands, likeAsk About Selected Text, may want to use a query in addition to the selected text. // 6. showFormText: A string to be shown as the field title in the Form. If true, either of the three following // scenarios will happen depending on the query value and useSelected parameter: // a. If useSelected is true, see useSelected documentation above. // b. If useSelected is false, and query is provided, we will get response based on the query value. // c. If useSelected is false, and query is not provided, a Form will be shown with the showFormText parameter as the field title.// 7. forceShowForm: Even if selected text is available, still show the form. In this case the default value // for the first field in the form will be the selected text. For example, command has this set to true // because the user needs to select the target language in the form. // 8. otherReactComponents: An array of additional React components to be shown in the Form. // For example, command has a dropdown to select the target language. // 9. processPrompt: A function to be called to get the final prompt. The usage is // processPrompt({context: context, query: query, selected: selected, values: otherReactComponents.values - if any}). // Both async and non-async functions are supported - in particular, we just always the function. // 10. allowUploadFiles: A boolean to allow uploading files in the Form. If true, a file upload field will be shown. // 11. defaultFiles: Files to always include in the prompt. This is an array of file paths. // 12. useDefaultLanguage: A boolean to use the default language. If true, the default language will be used in the response.
- Assistant