-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into vertex_ai_support_model_version
- Loading branch information
Showing
44 changed files
with
696 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang="ts"> | ||
import { invalidateAll } from "$app/navigation"; | ||
import { page } from "$app/stores"; | ||
import { base } from "$app/paths"; | ||
import type { Model } from "$lib/types/Model"; | ||
export let models: Model[]; | ||
export let currentModel: Model; | ||
let selectedModelId = models.map((m) => m.id).includes(currentModel.id) | ||
? currentModel.id | ||
: models[0].id; | ||
async function handleModelChange() { | ||
if (!$page.params.id) return; | ||
try { | ||
const response = await fetch(`${base}/conversation/${$page.params.id}`, { | ||
method: "PATCH", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ model: selectedModelId }), | ||
}); | ||
if (!response.ok) { | ||
throw new Error("Failed to update model"); | ||
} | ||
await invalidateAll(); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
</script> | ||
|
||
<div | ||
class="mx-auto mt-0 flex w-fit flex-col items-center justify-center gap-2 rounded-lg border border-gray-200 bg-gray-500/20 p-4 dark:border-gray-800" | ||
> | ||
<span> | ||
This model is no longer available. Switch to a new one to continue this conversation: | ||
</span> | ||
<div class="flex items-center space-x-2"> | ||
<select | ||
bind:value={selectedModelId} | ||
class="rounded-md bg-gray-100 px-2 py-1 dark:bg-gray-900 max-sm:max-w-32" | ||
> | ||
{#each models as model} | ||
<option value={model.id}>{model.name}</option> | ||
{/each} | ||
</select> | ||
<button | ||
on:click={handleModelChange} | ||
disabled={selectedModelId === currentModel.id} | ||
class="rounded-md bg-gray-100 px-2 py-1 dark:bg-gray-900" | ||
> | ||
Accept | ||
</button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.