refac: export getDefaultParam

This commit is contained in:
2024-10-15 15:01:51 +08:00
parent af2ae82e74
commit 1fbd4ee87b
6 changed files with 8 additions and 12 deletions

View File

@@ -3,7 +3,7 @@ import { useEffect, useState } from "preact/hooks";
import "@/global.css";
import { calculate_token_length } from "@/chatgpt";
import getDefaultParams from "@/utils/getDefaultParam";
import { getDefaultParams } from "@/utils/getDefaultParam";
import ChatBOX from "@/chatbox";
import { DefaultModel } from "@/const";
import { Tr, langCodeContext, LANG_OPTIONS } from "@/translate";

View File

@@ -43,7 +43,7 @@ import {
import Message from "@/message";
import { models } from "@/types/models";
import Settings from "@/settings";
import getDefaultParams from "@/utils/getDefaultParam";
import { getDefaultParams } from "@/utils/getDefaultParam";
import { AddImage } from "@/addImage";
import { ListAPIs } from "@/listAPIs";
import { ListToolsTempaltes } from "@/listToolsTemplates";

View File

@@ -33,7 +33,7 @@ import { tr, Tr, langCodeContext, LANG_OPTIONS } from "@/translate";
import { isVailedJSON } from "@/message";
import { SetAPIsTemplate } from "@/setAPIsTemplate";
import { autoHeight } from "@/textarea";
import getDefaultParams from "@/utils/getDefaultParam";
import { getDefaultParams } from "@/utils/getDefaultParam";
const TTS_VOICES: string[] = [
"alloy",

View File

@@ -1,6 +1,4 @@
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,

View File

@@ -3,7 +3,7 @@ import {
DefaultModel,
CHATGPT_API_WEB_VERSION,
} from "@/const";
import getDefaultParams from "@/utils/getDefaultParam";
import { getDefaultParams } from "@/utils/getDefaultParam";
import { ChatStore } from "@/types/chatstore";
import { models } from "@/types/models";

View File

@@ -1,8 +1,8 @@
function getDefaultParams(param: string, val: string): string;
function getDefaultParams(param: string, val: number): number;
function getDefaultParams(param: string, val: boolean): boolean;
export function getDefaultParams(param: string, val: string): string;
export function getDefaultParams(param: string, val: number): number;
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 get = queryParameters.get(param);
if (typeof val === "string") {
@@ -17,5 +17,3 @@ function getDefaultParams(param: any, val: any) {
return val;
}
}
export default getDefaultParams;