Spaces:
Running
Running
map providers name
Browse files
src/lib/components/model/SettingsModel.svelte
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
import { ExternalLink, Frown, Plus, Save, X } from '@lucide/svelte';
|
| 4 |
|
| 5 |
import type { ChatModel } from '$lib/helpers/types';
|
| 6 |
-
import { formatPricingPerToken } from '$lib/index.js';
|
| 7 |
import { Button } from '$lib/components/ui/button';
|
| 8 |
import { Slider } from '$lib/components/ui/slider';
|
| 9 |
import Input from '$lib/components/ui/input/input.svelte';
|
|
@@ -198,14 +198,15 @@
|
|
| 198 |
<Select.Group>
|
| 199 |
<Select.GroupHeading>Specific provider</Select.GroupHeading>
|
| 200 |
{#each model.providers as provider}
|
|
|
|
| 201 |
<Select.Item value={provider.provider}>
|
| 202 |
<div class="flex items-center gap-2 capitalize">
|
| 203 |
<img
|
| 204 |
-
src={`https://huggingface.co/api/avatars/${
|
| 205 |
-
alt={
|
| 206 |
class="size-4 rounded"
|
| 207 |
/>
|
| 208 |
-
{
|
| 209 |
</div>
|
| 210 |
{#if formatPricingPerToken(provider.pricing)}
|
| 211 |
<span class="text-xs text-muted-foreground">
|
|
|
|
| 3 |
import { ExternalLink, Frown, Plus, Save, X } from '@lucide/svelte';
|
| 4 |
|
| 5 |
import type { ChatModel } from '$lib/helpers/types';
|
| 6 |
+
import { formatPricingPerToken, getProviderName } from '$lib/index.js';
|
| 7 |
import { Button } from '$lib/components/ui/button';
|
| 8 |
import { Slider } from '$lib/components/ui/slider';
|
| 9 |
import Input from '$lib/components/ui/input/input.svelte';
|
|
|
|
| 198 |
<Select.Group>
|
| 199 |
<Select.GroupHeading>Specific provider</Select.GroupHeading>
|
| 200 |
{#each model.providers as provider}
|
| 201 |
+
{@const providerName = getProviderName(provider.provider)}
|
| 202 |
<Select.Item value={provider.provider}>
|
| 203 |
<div class="flex items-center gap-2 capitalize">
|
| 204 |
<img
|
| 205 |
+
src={`https://huggingface.co/api/avatars/${providerName}`}
|
| 206 |
+
alt={providerName}
|
| 207 |
class="size-4 rounded"
|
| 208 |
/>
|
| 209 |
+
{providerName}
|
| 210 |
</div>
|
| 211 |
{#if formatPricingPerToken(provider.pricing)}
|
| 212 |
<span class="text-xs text-muted-foreground">
|
src/lib/index.ts
CHANGED
|
@@ -25,3 +25,10 @@ export function formatUsageCost(pricing: ChatModelProvider['pricing'], usage: To
|
|
| 25 |
if (total === 0) return null;
|
| 26 |
return `$${total.toFixed(6)}`;
|
| 27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
if (total === 0) return null;
|
| 26 |
return `$${total.toFixed(6)}`;
|
| 27 |
}
|
| 28 |
+
|
| 29 |
+
export function getProviderName(provider: string) {
|
| 30 |
+
const providersMap = {
|
| 31 |
+
together: 'togethercomputer'
|
| 32 |
+
};
|
| 33 |
+
return providersMap[provider as keyof typeof providersMap] ?? provider;
|
| 34 |
+
}
|