Repository navigation
feat: auto-combo optimization, playground model dropdown, only-configured toggle #3322
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 1 commit
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 |
|---|---|---|
|
|
@@ -25,9 +25,9 @@ const FORMAT_MODEL_PREFIXES = { | |
| * pickModelForFormat: (format: string) => string | ||
| * }} | ||
| */ | ||
| export function useAvailableModels() { | ||
| export function useAvailableModels(provider?: string) { | ||
| const [model, setModel] = useState(""); | ||
| const [availableModels, setAvailableModels] = useState([]); | ||
| const [allModels, setAllModels] = useState<string[]>([]); | ||
| const [loading, setLoading] = useState(true); | ||
|
|
||
| useEffect(() => { | ||
|
|
@@ -36,16 +36,20 @@ export function useAvailableModels() { | |
| const res = await fetch("/api/v1/models"); | ||
| const data = await res.json(); | ||
| const models = (data.data || []).map((m) => m.id).sort((a, b) => compareTr(a, b)); | ||
| setAvailableModels(models); | ||
| setAllModels(models); | ||
| } catch { | ||
| setAvailableModels([]); | ||
| setAllModels([]); | ||
| } finally { | ||
| setLoading(false); | ||
| } | ||
| }; | ||
| fetchModels(); | ||
| }, []); | ||
|
|
||
| const availableModels = provider | ||
| ? allModels.filter((m) => m.startsWith(`${provider}/`) || m === provider) | ||
| : allModels; | ||
|
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. Unstable Reference for
|
||
|
|
||
| /** | ||
| * Pick the best model for a given format from the available models. | ||
| * Returns the first model matching the format prefixes, or the first available model. | ||
|
|
||
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.
Critical ReferenceError & Missing Target Fields
There are two major issues in this block:
autoConfigSourceis referenced on line 2988 before it is declared on line 3026. This will throw a runtimeReferenceErrorwhenever this block is executed.ResolvedComboTargetStructure: The dynamically added targets pushed toeligibleTargetsare missing critical fields required by theResolvedComboTargettype (such askind,stepId,executionKey,providerId, andlabel). This will cause issues during candidate scoring and deduplication (e.g.,target.executionKeywill beundefined, filtering them out completely inscoreAutoTargets).To fix both issues, resolve the configuration locally using a different variable name (to avoid shadowing/TDZ conflicts) and construct a fully-formed
ResolvedComboTargetobject.