refac: export getDefaultParam
This commit is contained in:
@@ -3,7 +3,7 @@ import { useEffect, useState } from "preact/hooks";
|
|||||||
import "@/global.css";
|
import "@/global.css";
|
||||||
|
|
||||||
import { calculate_token_length } from "@/chatgpt";
|
import { calculate_token_length } from "@/chatgpt";
|
||||||
import getDefaultParams from "@/utils/getDefaultParam";
|
import { getDefaultParams } from "@/utils/getDefaultParam";
|
||||||
import ChatBOX from "@/chatbox";
|
import ChatBOX from "@/chatbox";
|
||||||
import { DefaultModel } from "@/const";
|
import { DefaultModel } from "@/const";
|
||||||
import { Tr, langCodeContext, LANG_OPTIONS } from "@/translate";
|
import { Tr, langCodeContext, LANG_OPTIONS } from "@/translate";
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import {
|
|||||||
import Message from "@/message";
|
import Message from "@/message";
|
||||||
import { models } from "@/types/models";
|
import { models } from "@/types/models";
|
||||||
import Settings from "@/settings";
|
import Settings from "@/settings";
|
||||||
import getDefaultParams from "@/utils/getDefaultParam";
|
import { getDefaultParams } from "@/utils/getDefaultParam";
|
||||||
import { AddImage } from "@/addImage";
|
import { AddImage } from "@/addImage";
|
||||||
import { ListAPIs } from "@/listAPIs";
|
import { ListAPIs } from "@/listAPIs";
|
||||||
import { ListToolsTempaltes } from "@/listToolsTemplates";
|
import { ListToolsTempaltes } from "@/listToolsTemplates";
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import { tr, Tr, langCodeContext, LANG_OPTIONS } from "@/translate";
|
|||||||
import { isVailedJSON } from "@/message";
|
import { isVailedJSON } from "@/message";
|
||||||
import { SetAPIsTemplate } from "@/setAPIsTemplate";
|
import { SetAPIsTemplate } from "@/setAPIsTemplate";
|
||||||
import { autoHeight } from "@/textarea";
|
import { autoHeight } from "@/textarea";
|
||||||
import getDefaultParams from "@/utils/getDefaultParam";
|
import { getDefaultParams } from "@/utils/getDefaultParam";
|
||||||
|
|
||||||
const TTS_VOICES: string[] = [
|
const TTS_VOICES: string[] = [
|
||||||
"alloy",
|
"alloy",
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import { Logprobs, Message } from "@/chatgpt";
|
import { Logprobs, Message } from "@/chatgpt";
|
||||||
import { DefaultModel, CHATGPT_API_WEB_VERSION } from "@/const";
|
|
||||||
import getDefaultParams from "@/utils/getDefaultParam";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChatStore is the main object of the chatgpt-api-web,
|
* ChatStore is the main object of the chatgpt-api-web,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
DefaultModel,
|
DefaultModel,
|
||||||
CHATGPT_API_WEB_VERSION,
|
CHATGPT_API_WEB_VERSION,
|
||||||
} from "@/const";
|
} from "@/const";
|
||||||
import getDefaultParams from "@/utils/getDefaultParam";
|
import { getDefaultParams } from "@/utils/getDefaultParam";
|
||||||
import { ChatStore } from "@/types/chatstore";
|
import { ChatStore } from "@/types/chatstore";
|
||||||
import { models } from "@/types/models";
|
import { models } from "@/types/models";
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
function getDefaultParams(param: string, val: string): string;
|
export function getDefaultParams(param: string, val: string): string;
|
||||||
function getDefaultParams(param: string, val: number): number;
|
export function getDefaultParams(param: string, val: number): number;
|
||||||
function getDefaultParams(param: string, val: boolean): boolean;
|
export function getDefaultParams(param: string, val: boolean): boolean;
|
||||||
|
|
||||||
function getDefaultParams(param: any, val: any) {
|
export function getDefaultParams(param: any, val: any) {
|
||||||
const queryParameters = new URLSearchParams(window.location.search);
|
const queryParameters = new URLSearchParams(window.location.search);
|
||||||
const get = queryParameters.get(param);
|
const get = queryParameters.get(param);
|
||||||
if (typeof val === "string") {
|
if (typeof val === "string") {
|
||||||
@@ -17,5 +17,3 @@ function getDefaultParams(param: any, val: any) {
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getDefaultParams;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user