feat: use managed model capabilities for reasoning and image input
This commit is contained in:
@@ -81,10 +81,11 @@ export async function setCodingConversationModel(
|
||||
export async function setCodingConversationThinking(
|
||||
conversationId: string,
|
||||
thinkingLevel: ConversationThinkingLevel,
|
||||
reasoningChoice?: import('../../shared/managed-model-capabilities').ManagedReasoningChoice,
|
||||
): Promise<ConversationModelState> {
|
||||
const response = await hostApiFetch<{ model: ConversationModelState }>(
|
||||
`/api/coding/conversations/${encodeURIComponent(conversationId)}/thinking`,
|
||||
{ method: 'POST', body: JSON.stringify({ thinkingLevel }) },
|
||||
{ method: 'POST', body: JSON.stringify({ thinkingLevel, reasoningChoice }) },
|
||||
);
|
||||
return response.model;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ProviderAccount, ProviderVendorInfo } from '@/lib/providers';
|
||||
import type { ConversationThinkingLevel, ProductModelRef } from '@/types/coding-conversation';
|
||||
import { getImportedModelProfile } from '../../shared/imported-model-profile';
|
||||
import { unknownManagedModelCapability, type ManagedModelCapability } from '../../shared/managed-model-capabilities';
|
||||
|
||||
export interface CodingModelOption {
|
||||
key: string;
|
||||
@@ -8,6 +9,7 @@ export interface CodingModelOption {
|
||||
modelId: string;
|
||||
label: string;
|
||||
availableThinkingLevels: ConversationThinkingLevel[] | null;
|
||||
managedCapability?: ManagedModelCapability;
|
||||
}
|
||||
|
||||
const STANDARD_THINKING_LEVELS: readonly ConversationThinkingLevel[] = [
|
||||
@@ -23,6 +25,7 @@ function availableThinkingLevels(
|
||||
account: ProviderAccount,
|
||||
modelId: string,
|
||||
): ConversationThinkingLevel[] | null {
|
||||
if (account.id === 'niancode-user-models') return [];
|
||||
const serverCapability = account.metadata?.worksSquareModelCapabilities?.[modelId];
|
||||
if (serverCapability) {
|
||||
return [
|
||||
@@ -85,6 +88,8 @@ export function buildCodingModelOptions(
|
||||
modelId,
|
||||
label: `${account.label}${vendor && vendor !== account.label ? ` · ${vendor}` : ''} / ${modelId}`,
|
||||
availableThinkingLevels: availableThinkingLevels(account, modelId),
|
||||
...(account.id === 'niancode-user-models' ? { managedCapability:
|
||||
account.metadata?.worksSquareModelCapabilitiesV2?.models[modelId] ?? unknownManagedModelCapability() } : {}),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ export interface ProviderAccount {
|
||||
resourceUrl?: string;
|
||||
customModels?: string[];
|
||||
worksSquareModelCapabilities?: ImportedModelCapabilities;
|
||||
worksSquareModelCapabilitiesV2?: import('../../shared/managed-model-capabilities').ManagedModelCatalog;
|
||||
worksSquareCredentialMode?: string;
|
||||
worksSquareCredentialExpiresAt?: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user