mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
refactor(ollama): use prettyBytes for model size formatting
This commit is contained in:
parent
8a6b4b58ad
commit
956b677205
19 changed files with 49 additions and 132 deletions
|
|
@ -15,9 +15,9 @@ import { useAppTranslation } from "@src/i18n/TranslationContext"
|
|||
import { useRouterModels } from "@src/components/ui/hooks/useRouterModels"
|
||||
import { vscode } from "@src/utils/vscode"
|
||||
import { Button } from "@src/components/ui/button"
|
||||
import prettyBytes from "pretty-bytes"
|
||||
|
||||
import { inputEventTransform } from "../transforms"
|
||||
import { ModelPicker } from "../ModelPicker"
|
||||
|
||||
type OllamaProps = {
|
||||
apiConfiguration: ProviderSettings
|
||||
|
|
@ -382,47 +382,36 @@ export const Ollama = ({ apiConfiguration, setApiConfigurationField }: OllamaPro
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{sortedModelsWithTools.map((model) => {
|
||||
const formatSize = (bytes?: number): string => {
|
||||
if (!bytes) return "-"
|
||||
const gb = bytes / (1024 * 1024 * 1024)
|
||||
if (gb >= 1) {
|
||||
return `${gb.toFixed(1)} ${t("settings:providers.ollama.table.sizeFormatting.gb")}`
|
||||
}
|
||||
const mb = bytes / (1024 * 1024)
|
||||
return `${mb.toFixed(1)} ${t("settings:providers.ollama.table.sizeFormatting.mb")}`
|
||||
}
|
||||
return (
|
||||
<tr
|
||||
key={model.name}
|
||||
className="border-b border-vscode-foreground/5 hover:bg-vscode-foreground/5">
|
||||
<td className="py-2 px-3">
|
||||
<VSCodeRadio
|
||||
value={model.name}
|
||||
checked={apiConfiguration?.ollamaModelId === model.name}>
|
||||
{model.name}
|
||||
</VSCodeRadio>
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.contextWindow.toLocaleString()}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{formatSize(model.size)}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.quantizationLevel || "-"}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.family || "-"}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.supportsImages
|
||||
? t("settings:providers.ollama.table.yes")
|
||||
: t("settings:providers.ollama.table.no")}
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
{sortedModelsWithTools.map((model) => (
|
||||
<tr
|
||||
key={model.name}
|
||||
className="border-b border-vscode-foreground/5 hover:bg-vscode-foreground/5">
|
||||
<td className="py-2 px-3">
|
||||
<VSCodeRadio
|
||||
value={model.name}
|
||||
checked={apiConfiguration?.ollamaModelId === model.name}>
|
||||
{model.name}
|
||||
</VSCodeRadio>
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.contextWindow.toLocaleString()}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.size ? prettyBytes(model.size) : "-"}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.quantizationLevel || "-"}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.family || "-"}
|
||||
</td>
|
||||
<td className="py-2 px-3 text-vscode-descriptionForeground">
|
||||
{model.supportsImages
|
||||
? t("settings:providers.ollama.table.yes")
|
||||
: t("settings:providers.ollama.table.no")}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/ca/settings.json
generated
6
webview-ui/src/i18n/locales/ca/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Família",
|
||||
"images": "Imatges",
|
||||
"yes": "Sí",
|
||||
"no": "No",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "No"
|
||||
},
|
||||
"streaming": "Transmissió",
|
||||
"streamingHelp": "La transmissió sempre està habilitada per a les sol·licituds de l'API d'Ollama. Les respostes es transmeten en temps real mentre es generen.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/de/settings.json
generated
6
webview-ui/src/i18n/locales/de/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Familie",
|
||||
"images": "Bilder",
|
||||
"yes": "Ja",
|
||||
"no": "Nein",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "Nein"
|
||||
},
|
||||
"streaming": "Streaming",
|
||||
"streamingHelp": "Streaming ist für Ollama API-Anfragen immer aktiviert. Antworten werden in Echtzeit gestreamt, während sie generiert werden.",
|
||||
|
|
|
|||
|
|
@ -511,11 +511,7 @@
|
|||
"family": "Family",
|
||||
"images": "Images",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "No"
|
||||
},
|
||||
"streaming": "Streaming",
|
||||
"streamingHelp": "Streaming is always enabled for Ollama API requests. Responses are streamed in real-time as they are generated.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/es/settings.json
generated
6
webview-ui/src/i18n/locales/es/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Familia",
|
||||
"images": "Imágenes",
|
||||
"yes": "Sí",
|
||||
"no": "No",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "No"
|
||||
},
|
||||
"streaming": "Transmisión",
|
||||
"streamingHelp": "La transmisión siempre está habilitada para las solicitudes de API de Ollama. Las respuestas se transmiten en tiempo real a medida que se generan.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/fr/settings.json
generated
6
webview-ui/src/i18n/locales/fr/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Famille",
|
||||
"images": "Images",
|
||||
"yes": "Oui",
|
||||
"no": "Non",
|
||||
"sizeFormatting": {
|
||||
"gb": "Go",
|
||||
"mb": "Mo"
|
||||
}
|
||||
"no": "Non"
|
||||
},
|
||||
"streaming": "Diffusion en continu",
|
||||
"streamingHelp": "La diffusion en continu est toujours activée pour les requêtes API Ollama. Les réponses sont diffusées en temps réel au fur et à mesure de leur génération.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/hi/settings.json
generated
6
webview-ui/src/i18n/locales/hi/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "परिवार",
|
||||
"images": "छवियां",
|
||||
"yes": "हाँ",
|
||||
"no": "नहीं",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "नहीं"
|
||||
},
|
||||
"streaming": "स्ट्रीमिंग",
|
||||
"streamingHelp": "Ollama API अनुरोधों के लिए स्ट्रीमिंग हमेशा सक्षम होती है। प्रतिक्रियाएं वास्तविक समय में स्ट्रीम की जाती हैं जैसे ही वे उत्पन्न होती हैं।",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/id/settings.json
generated
6
webview-ui/src/i18n/locales/id/settings.json
generated
|
|
@ -506,11 +506,7 @@
|
|||
"family": "Keluarga",
|
||||
"images": "Gambar",
|
||||
"yes": "Ya",
|
||||
"no": "Tidak",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "Tidak"
|
||||
},
|
||||
"streaming": "Streaming",
|
||||
"streamingHelp": "Streaming selalu diaktifkan untuk permintaan API Ollama. Respons di-stream secara real-time saat dibuat.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/it/settings.json
generated
6
webview-ui/src/i18n/locales/it/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Famiglia",
|
||||
"images": "Immagini",
|
||||
"yes": "Sì",
|
||||
"no": "No",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "No"
|
||||
},
|
||||
"streaming": "Streaming",
|
||||
"streamingHelp": "Lo streaming è sempre abilitato per le richieste API Ollama. Le risposte vengono trasmesse in tempo reale mentre vengono generate.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/ja/settings.json
generated
6
webview-ui/src/i18n/locales/ja/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "ファミリー",
|
||||
"images": "画像",
|
||||
"yes": "はい",
|
||||
"no": "いいえ",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "いいえ"
|
||||
},
|
||||
"streaming": "ストリーミング",
|
||||
"streamingHelp": "Ollama APIリクエストではストリーミングが常に有効です。応答は生成されると同時にリアルタイムでストリーミングされます。",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/ko/settings.json
generated
6
webview-ui/src/i18n/locales/ko/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "패밀리",
|
||||
"images": "이미지",
|
||||
"yes": "예",
|
||||
"no": "아니오",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "아니오"
|
||||
},
|
||||
"streaming": "스트리밍",
|
||||
"streamingHelp": "Ollama API 요청에 대해 스트리밍이 항상 활성화되어 있습니다. 응답은 생성되는 대로 실시간으로 스트리밍됩니다.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/nl/settings.json
generated
6
webview-ui/src/i18n/locales/nl/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Familie",
|
||||
"images": "Afbeeldingen",
|
||||
"yes": "Ja",
|
||||
"no": "Nee",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "Nee"
|
||||
},
|
||||
"streaming": "Streaming",
|
||||
"streamingHelp": "Streaming is altijd ingeschakeld voor Ollama API-verzoeken. Reacties worden in real-time gestreamd terwijl ze worden gegenereerd.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/pl/settings.json
generated
6
webview-ui/src/i18n/locales/pl/settings.json
generated
|
|
@ -504,11 +504,7 @@
|
|||
"family": "Rodzina",
|
||||
"images": "Obrazy",
|
||||
"yes": "Tak",
|
||||
"no": "Nie",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "Nie"
|
||||
},
|
||||
"streaming": "Przesyłanie strumieniowe",
|
||||
"streamingHelp": "Przesyłanie strumieniowe jest zawsze włączone dla żądań API Ollama. Odpowiedzi są przesyłane strumieniowo w czasie rzeczywistym podczas generowania.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/pt-BR/settings.json
generated
6
webview-ui/src/i18n/locales/pt-BR/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Família",
|
||||
"images": "Imagens",
|
||||
"yes": "Sim",
|
||||
"no": "Não",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "Não"
|
||||
},
|
||||
"streaming": "Transmissão",
|
||||
"streamingHelp": "A transmissão está sempre habilitada para solicitações da API Ollama. As respostas são transmitidas em tempo real conforme são geradas.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/ru/settings.json
generated
6
webview-ui/src/i18n/locales/ru/settings.json
generated
|
|
@ -504,11 +504,7 @@
|
|||
"family": "Семейство",
|
||||
"images": "Изображения",
|
||||
"yes": "Да",
|
||||
"no": "Нет",
|
||||
"sizeFormatting": {
|
||||
"gb": "ГБ",
|
||||
"mb": "МБ"
|
||||
}
|
||||
"no": "Нет"
|
||||
},
|
||||
"streaming": "Потоковая передача",
|
||||
"streamingHelp": "Потоковая передача всегда включена для запросов API Ollama. Ответы передаются в реальном времени по мере их генерации.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/tr/settings.json
generated
6
webview-ui/src/i18n/locales/tr/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Aile",
|
||||
"images": "Görüntüler",
|
||||
"yes": "Evet",
|
||||
"no": "Hayır",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "Hayır"
|
||||
},
|
||||
"streaming": "Akış",
|
||||
"streamingHelp": "Ollama API istekleri için akış her zaman etkindir. Yanıtlar oluşturuldukça gerçek zamanlı olarak akışa alınır.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/vi/settings.json
generated
6
webview-ui/src/i18n/locales/vi/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "Họ",
|
||||
"images": "Hình ảnh",
|
||||
"yes": "Có",
|
||||
"no": "Không",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "Không"
|
||||
},
|
||||
"streaming": "Phát trực tuyến",
|
||||
"streamingHelp": "Phát trực tuyến luôn được bật cho các yêu cầu API Ollama. Phản hồi được phát trực tuyến theo thời gian thực khi chúng được tạo.",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/zh-CN/settings.json
generated
6
webview-ui/src/i18n/locales/zh-CN/settings.json
generated
|
|
@ -502,11 +502,7 @@
|
|||
"family": "系列",
|
||||
"images": "图像",
|
||||
"yes": "是",
|
||||
"no": "否",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "否"
|
||||
},
|
||||
"streaming": "流式传输",
|
||||
"streamingHelp": "Ollama API 请求始终启用流式传输。响应在生成时实时流式传输。",
|
||||
|
|
|
|||
6
webview-ui/src/i18n/locales/zh-TW/settings.json
generated
6
webview-ui/src/i18n/locales/zh-TW/settings.json
generated
|
|
@ -511,11 +511,7 @@
|
|||
"family": "系列",
|
||||
"images": "影像",
|
||||
"yes": "是",
|
||||
"no": "否",
|
||||
"sizeFormatting": {
|
||||
"gb": "GB",
|
||||
"mb": "MB"
|
||||
}
|
||||
"no": "否"
|
||||
},
|
||||
"streaming": "串流",
|
||||
"streamingHelp": "Ollama API 請求始終啟用串流。回應在生成時即時串流。",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue