Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ CLAUDE.md

# Build cache
.cache/ # Includes conda_unpack_wheels/ for Windows packaging workaround
/assets/
/console/
src/copaw/console/
src/copaw/assets/
21 changes: 21 additions & 0 deletions console/src/api/modules/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type {
TestProviderRequest,
TestModelRequest,
DiscoverModelsResponse,
SeriesResponse,
DiscoverExtendedResponse,
FilterModelsRequest,
FilterModelsResponse,
} from "../types";

export const providerApi = {
Expand Down Expand Up @@ -87,4 +91,21 @@ export const providerApi = {
body: body ? JSON.stringify(body) : undefined,
},
),

/* ---- OpenRouter specific endpoints ---- */

getOpenRouterSeries: () =>
request<SeriesResponse>("/models/openrouter/series"),

discoverOpenRouterExtended: (body?: TestProviderRequest) =>
request<DiscoverExtendedResponse>("/models/openrouter/discover-extended", {
method: "POST",
body: body ? JSON.stringify(body) : undefined,
}),

filterOpenRouterModels: (body: FilterModelsRequest) =>
request<FilterModelsResponse>("/models/openrouter/models/filter", {
method: "POST",
body: JSON.stringify(body),
}),
};
36 changes: 36 additions & 0 deletions console/src/api/types/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export interface TestProviderRequest {
base_url?: string;
chat_model?: string;
generate_kwargs?: Record<string, unknown>;
include_extended?: boolean;
}

export interface TestModelRequest {
Expand All @@ -138,3 +139,38 @@ export interface DiscoverModelsResponse {
models: ModelInfo[];
added_count: number;
}

/* ---- OpenRouter extended model types ---- */

export interface ExtendedModelInfo {
id: string;
name: string;
provider: string;
input_modalities: string[];
output_modalities: string[];
pricing: Record<string, string>;
}

export interface FilterModelsRequest {
providers?: string[];
input_modalities?: string[];
output_modalities?: string[];
max_prompt_price?: number;
}

export interface SeriesResponse {
series: string[];
}

export interface DiscoverExtendedResponse {
success: boolean;
models: ExtendedModelInfo[];
providers: string[];
total_count: number;
}

export interface FilterModelsResponse {
success: boolean;
models: ExtendedModelInfo[];
total_count: number;
}
13 changes: 13 additions & 0 deletions console/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,19 @@
"testConnectionError": "An error occurred while testing connection",
"discoverModels": "Discover Models",
"discoverModelsFailed": "Failed to discover models",
"filterModels": "Filter Models",
"filterByProvider": "Provider:",
"filterByModality": "Input Modality:",
"getModels": "Get Models",
"discovered": "Available Models:",
"add": "Add",
"filteredModelsLoaded": "Filtered models loaded: {count}",
"filterFailed": "Failed to filter models",
"clearAll": "Clear All",
"clearAllModels": "Clear All Models",
"clearAllModelsConfirm": "Are you sure you want to remove all {count} added models? This action cannot be undone.",
"allModelsCleared": "Removed {count} models",
"modelList": "Models",
"modelTestFailed": "Model validation failed, please check if the model ID is correct",
"modelTestFailedConfirm": "Model connection test failed: {{message}}. Do you still want to add this model?",
"autoDiscoveredAndAdded": "Auto-discovered {{count}} models and added {{added}} new model(s)",
Expand Down
13 changes: 13 additions & 0 deletions console/src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,19 @@
"testConnectionError": "接続テスト中にエラーが発生しました",
"discoverModels": "モデルを検出",
"discoverModelsFailed": "モデルの検出に失敗しました",
"filterModels": "モデルフィルター",
"filterByProvider": "プロバイダー:",
"filterByModality": "入力モダリティ:",
"getModels": "モデルを取得",
"discovered": "利用可能なモデル:",
"add": "追加",
"filteredModelsLoaded": "フィルタリングされたモデル: {count}",
"filterFailed": "モデルのフィルタリングに失敗しました",
"clearAll": "すべてクリア",
"clearAllModels": "すべてのモデルを消去",
"clearAllModelsConfirm": "追加された{count}個のモデルをすべて削除してもよろしいですか?この操作は取り消せません。",
"allModelsCleared": "{count}個のモデルを削除しました",
"modelList": "モデル",
"modelTestFailed": "モデルの検証に失敗しました。モデルIDが正しいか確認してください",
"modelTestFailedConfirm": "モデルの接続テストに失敗しました: {{message}}。このモデルを追加しますか?",
"autoDiscoveredAndAdded": "{{count}} 件のモデルを自動検出し、{{added}} 件の新規モデルを追加しました",
Expand Down
13 changes: 13 additions & 0 deletions console/src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,19 @@
"testConnectionError": "Произошла ошибка при проверке подключения",
"discoverModels": "Обнаружить модели",
"discoverModelsFailed": "Не удалось обнаружить модели",
"filterModels": "Фильтр моделей",
"filterByProvider": "Провайдер:",
"filterByModality": "Тип ввода:",
"getModels": "Получить модели",
"discovered": "Доступные модели:",
"add": "Добавить",
"filteredModelsLoaded": "Загружено моделей: {count}",
"filterFailed": "Ошибка фильтрации моделей",
"clearAll": "Очистить все",
"clearAllModels": "Очистить все модели",
"clearAllModelsConfirm": "Вы уверены, что хотите удалить все добавленные модели ({count})? Это действие нельзя отменить.",
"allModelsCleared": "Удалено моделей: {count}",
"modelList": "Модели",
"modelTestFailed": "Проверка модели не пройдена, проверьте корректность ID модели",
"modelTestFailedConfirm": "Тест подключения модели не пройден: {{message}}. Всё равно добавить эту модель?",
"autoDiscoveredAndAdded": "Автоматически обнаружено {{count}} моделей и добавлено {{added}} новых",
Expand Down
13 changes: 13 additions & 0 deletions console/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,19 @@
"testConnectionError": "测试连接时发生错误",
"discoverModels": "自动获取模型",
"discoverModelsFailed": "自动获取模型失败",
"filterModels": "模型过滤器",
"filterByProvider": "提供商:",
"filterByModality": "输入模式:",
"getModels": "获取模型",
"discovered": "可用模型:",
"add": "添加",
"filteredModelsLoaded": "已加载模型: {count}",
"filterFailed": "模型过滤失败",
"clearAll": "清空全部",
"clearAllModels": "清空所有模型",
"clearAllModelsConfirm": "确定要删除所有 {count} 个已添加的模型吗?此操作无法撤销。",
"allModelsCleared": "已删除 {count} 个模型",
"modelList": "模型列表",
"modelTestFailed": "模型验证失败,请检查模型ID是否正确",
"modelTestFailedConfirm": "模型连接测试失败:{{message}}。是否仍要添加此模型?",
"autoDiscoveredAndAdded": "已自动获取 {{count}} 个模型,并新增 {{added}} 个到可选列表",
Expand Down
Loading
Loading