Explorar o código

fix: keep alive value should be string

Timothy J. Baek hai 1 ano
pai
achega
56966c411b
Modificáronse 1 ficheiros con 33 adicións e 14 borrados
  1. 33 14
      src/lib/components/chat/Settings/Advanced.svelte

+ 33 - 14
src/lib/components/chat/Settings/Advanced.svelte

@@ -7,7 +7,8 @@
 
 	// Advanced
 	let requestFormat = '';
-	let keepAlive = '';
+	let keepAlive = null;
+
 	let options = {
 		// Advanced
 		seed: 0,
@@ -59,6 +60,37 @@
 		<AdvancedParams bind:options />
 		<hr class=" dark:border-gray-700" />
 
+		<div class=" py-1 w-full justify-between">
+			<div class="flex w-full justify-between">
+				<div class=" self-center text-xs font-medium">Keep Alive</div>
+
+				<button
+					class="p-1 px-3 text-xs flex rounded transition"
+					type="button"
+					on:click={() => {
+						keepAlive = keepAlive === null ? '5m' : null;
+					}}
+				>
+					{#if keepAlive === null}
+						<span class="ml-2 self-center"> Default </span>
+					{:else}
+						<span class="ml-2 self-center"> Custom </span>
+					{/if}
+				</button>
+			</div>
+
+			{#if keepAlive !== null}
+				<div class="flex mt-1 space-x-2">
+					<input
+						class="w-full rounded py-1.5 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none border border-gray-100 dark:border-gray-600"
+						type="text"
+						placeholder={`e.g.) "30s","10m". Valid time units are "s", "m", "h".`}
+						bind:value={keepAlive}
+					/>
+				</div>
+			{/if}
+		</div>
+
 		<div>
 			<div class=" py-1 flex w-full justify-between">
 				<div class=" self-center text-sm font-medium">Request Mode</div>
@@ -87,19 +119,6 @@
 				</button>
 			</div>
 		</div>
-		<div class=" py-1 flex w-full justify-between">
-			<div class=" w-20 text-xs font-medium self-center">Keep Alive</div>
-			<div class=" flex-1 self-center">
-				<input
-					class="w-full rounded py-1.5 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none border border-gray-100 dark:border-gray-600"
-					type="number"
-					placeholder="Default"
-					bind:value={keepAlive}
-					autocomplete="off"
-					min="-1"
-				/>
-			</div>
-		</div>
 	</div>
 
 	<div class="flex justify-end pt-3 text-sm font-medium">