-
Notifications
You must be signed in to change notification settings - Fork 625
feat(ollama): support custom providers #1046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
| import { useSettingsStore } from '@/stores/settings' | ||
| import cherryinColorIcon from '@/assets/llm-icons/cherryin-color.png?url' | ||
| import adobeColorIcon from '@/assets/llm-icons/adobe-color.svg?url' | ||
| import zeaburColorIcon from '@/assets/llm-icons/zeabur-color.svg?url' | ||
|
|
@@ -151,6 +152,13 @@ const props = withDefaults(defineProps<Props>(), { | |
| isDark: false | ||
| }) | ||
|
|
||
| const settingsStore = useSettingsStore() | ||
|
|
||
| const provider = computed(() => { | ||
| if (!props.modelId) return undefined | ||
| return settingsStore.providers.find((item) => item.id === props.modelId) | ||
| }) | ||
|
Comment on lines
+157
to
+160
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify the provider lookup logic. The provider lookup matches
Please verify this is the intended behavior. If 🏁 Script executed: #!/bin/bash
# Description: Check how ModelIcon component is used across the codebase to verify if modelId is passed provider IDs
# Search for ModelIcon usage patterns to see what values are passed to modelId prop
rg -nP --type=vue -A3 -B3 '<ModelIcon\s+.*?modelId'
# Also search for modelId prop bindings
rg -nP --type=vue -A2 'modelId\s*='Length of output: 55 🏁 Script executed: #!/bin/bash
# Description: Check how ModelIcon component is used and how modelId prop is set
# Search for ModelIcon usage patterns in .vue files
echo "=== ModelIcon Usage Patterns ==="
rg -n '<ModelIcon' -g '*.vue' -A3 -B1
echo -e "\n=== modelId Prop Bindings ==="
# Search for modelId prop assignments/bindings
rg -n 'modelId\s*=' -g '*.vue' -A2 -B1
echo -e "\n=== File containing ModelIcon.vue definition ==="
# Verify the ModelIcon.vue file location
fd -e vue -x grep -l 'ModelIcon' {}Length of output: 9425 🏁 Script executed: #!/bin/bash
# Description: Verify the structure of model objects passed to ModelIcon to understand if their .id is provider ID or model ID
# Search for selectedImageModel definition/assignment
echo "=== selectedImageModel definition ==="
rg -n 'selectedImageModel' -g '*.vue' -B2 -A2 | head -40
# Search for selectEmbeddingModel definition/assignment
echo -e "\n=== selectEmbeddingModel definition ==="
rg -n 'selectEmbeddingModel' -g '*.vue' -B2 -A2 | head -40
# Check the settingsStore to understand provider structure
echo -e "\n=== settingsStore providers structure ==="
rg -n 'providers' -g '*.ts' -B3 -A3 | grep -A5 -B5 'interface.*Provider\|type.*Provider' | head -50Length of output: 10211 🏁 Script executed: #!/bin/bash
# Description: Find RENDERER_MODEL_META type definition
echo "=== RENDERER_MODEL_META type definition ==="
rg -n 'RENDERER_MODEL_META' -g '*.ts' -B2 -A8 | head -60
echo -e "\n=== MODEL_META type definition ==="
rg -n 'type MODEL_META\|interface MODEL_META' -g '*.ts' -B2 -A10 | head -60Length of output: 4682 Pass provider ID instead of model ID to ModelIcon component. The ModelIcon component searches the providers array by ID, but several components are incorrectly passing model IDs instead of provider IDs. This causes the provider lookup to fail. Affected locations:
All model objects (RENDERER_MODEL_META) have a |
||
|
|
||
| const iconKey = computed(() => { | ||
| const modelIdLower = props.modelId.toLowerCase() | ||
| const iconEntries = Object.keys(icons) | ||
|
|
@@ -159,28 +167,43 @@ const iconKey = computed(() => { | |
| const matchedIcon = iconEntries.find((key) => { | ||
| return modelIdLower.includes(key) | ||
| }) | ||
| return matchedIcon ? matchedIcon : 'default' | ||
| if (matchedIcon) { | ||
| return matchedIcon | ||
| } | ||
|
|
||
| const apiType = provider.value?.apiType?.toLowerCase() | ||
| if (apiType) { | ||
| const apiMatchedIcon = iconEntries.find((key) => apiType.includes(key)) | ||
| if (apiMatchedIcon) { | ||
| return apiMatchedIcon | ||
| } | ||
| } | ||
|
|
||
| return 'default' | ||
| }) | ||
|
|
||
| const invert = computed(() => { | ||
| if (!props.isDark) { | ||
| return false | ||
| } | ||
| if ( | ||
| props.modelId.toLowerCase() === 'openai' || | ||
| props.modelId.toLowerCase().includes('openai-responses') || | ||
| props.modelId.toLowerCase().includes('openrouter') || | ||
| props.modelId.toLowerCase().includes('ollama') || | ||
| props.modelId.toLowerCase().includes('grok') || | ||
| props.modelId.toLowerCase().includes('groq') || | ||
| props.modelId.toLowerCase().includes('github') || | ||
| props.modelId.toLowerCase().includes('moonshot') || | ||
| props.modelId.toLowerCase().includes('lmstudio') || | ||
| props.modelId.toLowerCase().includes('aws-bedrock') | ||
| ) { | ||
| return true | ||
| const checkTargets = [props.modelId.toLowerCase()] | ||
| if (provider.value?.apiType) { | ||
| checkTargets.push(provider.value.apiType.toLowerCase()) | ||
| } | ||
| return false | ||
| const invertKeywords = [ | ||
| 'openai', | ||
| 'openai-responses', | ||
| 'openrouter', | ||
| 'ollama', | ||
| 'grok', | ||
| 'groq', | ||
| 'github', | ||
| 'moonshot', | ||
| 'lmstudio', | ||
| 'aws-bedrock' | ||
| ] | ||
|
|
||
| return checkTargets.some((target) => invertKeywords.some((keyword) => target.includes(keyword))) | ||
| }) | ||
| </script> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize labels
“API URL” and “API Key” labels are hardcoded. Replace with i18n keys.
As per coding guidelines.
Also applies to: 35-35
🤖 Prompt for AI Agents