add options to enable/disable presence/frequency penalty
This commit is contained in:
@@ -406,6 +406,30 @@ const Number = (props: {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{props.field === "presence_penalty" && (
|
||||||
|
<Checkbox
|
||||||
|
checked={chatStore.presence_penalty_enabled}
|
||||||
|
onCheckedChange={() => {
|
||||||
|
const newChatStore = { ...chatStore };
|
||||||
|
newChatStore.presence_penalty_enabled =
|
||||||
|
!newChatStore.presence_penalty_enabled;
|
||||||
|
setChatStore({ ...newChatStore });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{props.field === "frequency_penalty" && (
|
||||||
|
<Checkbox
|
||||||
|
checked={chatStore.frequency_penalty_enabled}
|
||||||
|
onCheckedChange={() => {
|
||||||
|
const newChatStore = { ...chatStore };
|
||||||
|
newChatStore.frequency_penalty_enabled =
|
||||||
|
!newChatStore.frequency_penalty_enabled;
|
||||||
|
setChatStore({ ...newChatStore });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Label>
|
</Label>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
|
|||||||
@@ -87,12 +87,15 @@ const Navbar: React.FC = () => {
|
|||||||
<MenubarItem>
|
<MenubarItem>
|
||||||
<ReceiptIcon className="w-4 h-4 mr-2" />
|
<ReceiptIcon className="w-4 h-4 mr-2" />
|
||||||
Price:{" "}
|
Price:{" "}
|
||||||
{models[chatStore.model]?.price?.prompt * 1000 * 1000}$
|
{models[chatStore.model]?.price?.prompt *
|
||||||
/ 1M input tokens
|
1000 *
|
||||||
|
1000}$ / 1M input tokens
|
||||||
</MenubarItem>
|
</MenubarItem>
|
||||||
<MenubarItem>
|
<MenubarItem>
|
||||||
<WalletIcon className="w-4 h-4 mr-2" />
|
<WalletIcon className="w-4 h-4 mr-2" />
|
||||||
Total: {getTotalCost().toFixed(2)}$
|
Total: {getTotalCost().toFixed(
|
||||||
|
2
|
||||||
|
)}$
|
||||||
</MenubarItem>
|
</MenubarItem>
|
||||||
<MenubarItem>
|
<MenubarItem>
|
||||||
<ArrowUpDownIcon className="w-4 h-4 mr-2" />
|
<ArrowUpDownIcon className="w-4 h-4 mr-2" />
|
||||||
@@ -112,7 +115,9 @@ const Navbar: React.FC = () => {
|
|||||||
</MenubarItem>
|
</MenubarItem>
|
||||||
<MenubarItem>
|
<MenubarItem>
|
||||||
<ScissorsIcon className="w-4 h-4 mr-2" />
|
<ScissorsIcon className="w-4 h-4 mr-2" />
|
||||||
{chatStore.postBeginIndex} / {chatStore.history.length}
|
{
|
||||||
|
chatStore.postBeginIndex
|
||||||
|
} / {chatStore.history.length}
|
||||||
</MenubarItem>
|
</MenubarItem>
|
||||||
<MenubarSeparator />
|
<MenubarSeparator />
|
||||||
<MenubarItem disabled>
|
<MenubarItem disabled>
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ export interface ChatStore {
|
|||||||
top_p: number;
|
top_p: number;
|
||||||
top_p_enabled: boolean;
|
top_p_enabled: boolean;
|
||||||
presence_penalty: number;
|
presence_penalty: number;
|
||||||
|
presence_penalty_enabled: boolean;
|
||||||
frequency_penalty: number;
|
frequency_penalty: number;
|
||||||
|
frequency_penalty_enabled: boolean;
|
||||||
develop_mode: boolean;
|
develop_mode: boolean;
|
||||||
whisper_api: string;
|
whisper_api: string;
|
||||||
whisper_key: string;
|
whisper_key: string;
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ interface NewChatStoreOptions {
|
|||||||
top_p?: number;
|
top_p?: number;
|
||||||
top_p_enabled?: boolean;
|
top_p_enabled?: boolean;
|
||||||
presence_penalty?: number;
|
presence_penalty?: number;
|
||||||
|
presence_penalty_enabled?: boolean;
|
||||||
frequency_penalty?: number;
|
frequency_penalty?: number;
|
||||||
|
frequency_penalty_enabled?: boolean;
|
||||||
dev?: boolean;
|
dev?: boolean;
|
||||||
whisper_api?: string;
|
whisper_api?: string;
|
||||||
whisper_key?: string;
|
whisper_key?: string;
|
||||||
@@ -67,7 +69,9 @@ export const newChatStore = (options: NewChatStoreOptions): ChatStore => {
|
|||||||
top_p: options.top_p ?? 1,
|
top_p: options.top_p ?? 1,
|
||||||
top_p_enabled: options.top_p_enabled ?? false,
|
top_p_enabled: options.top_p_enabled ?? false,
|
||||||
presence_penalty: options.presence_penalty ?? 0,
|
presence_penalty: options.presence_penalty ?? 0,
|
||||||
|
presence_penalty_enabled: options.presence_penalty_enabled ?? false,
|
||||||
frequency_penalty: options.frequency_penalty ?? 0,
|
frequency_penalty: options.frequency_penalty ?? 0,
|
||||||
|
frequency_penalty_enabled: options.frequency_penalty_enabled ?? false,
|
||||||
develop_mode: getDefaultParams("dev", options.dev ?? false),
|
develop_mode: getDefaultParams("dev", options.dev ?? false),
|
||||||
whisper_api: getDefaultParams(
|
whisper_api: getDefaultParams(
|
||||||
"whisper-api",
|
"whisper-api",
|
||||||
|
|||||||
Reference in New Issue
Block a user