feat(models): add models configuration page with provider management and token usage

- Replace "Task Center" with "Models" in sidebar and routing
- Add new models configuration page with AI provider account management
- Implement token usage history with filtering, grouping, and visualization
- Create provider store with Pinia for state management
- Add internationalization support for models feature
- Include development analysis documentation for feature implementation
This commit is contained in:
duanshuwen
2026-04-09 21:49:52 +08:00
parent 6d2991e595
commit 5f542715cb
18 changed files with 2040 additions and 25 deletions

View File

@@ -19,5 +19,6 @@ export const NAMESPACES = [
'rate',
'knowledge',
'component',
'models',
] as const;
export type Namespace = (typeof NAMESPACES)[number];

View File

@@ -0,0 +1,58 @@
{
"title": "Models Configuration",
"subtitle": "Configure your AI providers and view token usage.",
"aiProviders": {
"title": "AI Providers",
"subtitle": "Manage your AI models and API keys.",
"addProvider": "Add Provider",
"default": "Default",
"configured": "Configured",
"notConfigured": "Not Configured",
"setDefault": "Set Default",
"edit": "Edit",
"delete": "Delete",
"deleteConfirm": "Are you sure you want to delete this provider?",
"empty": "No providers configured yet. Click \"Add Provider\" to start.",
"editProvider": "Edit Provider",
"apiKey": "API Key",
"apiKeyPlaceholder": "Enter API Key",
"validate": "Validate",
"baseUrl": "Base URL (Optional)",
"defaultModel": "Default Model (Optional)",
"setDefaultSuccess": "Default provider set successfully",
"deleteSuccess": "Provider deleted successfully",
"apiKeyRequired": "Please enter an API Key first",
"validateSuccess": "API Key is valid!",
"validateFail": "Invalid API Key",
"saveSuccess": "Provider saved successfully"
},
"recentTokenHistory": {
"title": "Token Usage History",
"loading": "Loading usage history...",
"empty": "No usage history available.",
"emptyForWindow": "No usage history in the selected time window.",
"groupByModel": "By Model",
"groupByTime": "By Time",
"last7Days": "Last 7 Days",
"last30Days": "Last 30 Days",
"allTime": "All Time",
"showingLast": "Showing {count} records",
"totalTokens": "Total",
"inputShort": "Input",
"outputShort": "Output",
"cacheShort": "Cache",
"unknownModel": "Unknown Model",
"noUsage": "No usage info",
"usageParseError": "Error parsing usage",
"input": "Input: {value}",
"output": "Output: {value}",
"cacheRead": "Cache Read: {value}",
"cacheWrite": "Cache Write: {value}",
"cost": "${amount}",
"viewContent": "View Content",
"page": "Page {current} of {total}",
"prev": "Prev",
"next": "Next",
"contentDialogTitle": "Request Content"
}
}

View File

@@ -0,0 +1,58 @@
{
"title": "モデル構成",
"subtitle": "AIプロバイダーを設定し、トークンの使用状況を表示します。",
"aiProviders": {
"title": "AIプロバイダー",
"subtitle": "AIモデルとAPIキーを管理します。",
"addProvider": "プロバイダーを追加",
"default": "デフォルト",
"configured": "設定済み",
"notConfigured": "未設定",
"setDefault": "デフォルトに設定",
"edit": "編集",
"delete": "削除",
"deleteConfirm": "このプロバイダーを削除してもよろしいですか?",
"empty": "プロバイダーがまだ設定されていません。「プロバイダーを追加」をクリックして開始してください。",
"editProvider": "プロバイダーを編集",
"apiKey": "APIキー",
"apiKeyPlaceholder": "APIキーを入力",
"validate": "検証",
"baseUrl": "ベースURL (オプション)",
"defaultModel": "デフォルトモデル (オプション)",
"setDefaultSuccess": "デフォルトのプロバイダーが正常に設定されました",
"deleteSuccess": "プロバイダーが正常に削除されました",
"apiKeyRequired": "最初にAPIキーを入力してください",
"validateSuccess": "APIキーは有効です",
"validateFail": "無効なAPIキー",
"saveSuccess": "プロバイダーが正常に保存されました"
},
"recentTokenHistory": {
"title": "トークン使用履歴",
"loading": "使用履歴を読み込み中...",
"empty": "使用履歴はありません。",
"emptyForWindow": "選択した期間内に使用履歴はありません。",
"groupByModel": "モデル別",
"groupByTime": "時間別",
"last7Days": "過去7日間",
"last30Days": "過去30日間",
"allTime": "すべての期間",
"showingLast": "{count}件の記録を表示中",
"totalTokens": "合計",
"inputShort": "入力",
"outputShort": "出力",
"cacheShort": "キャッシュ",
"unknownModel": "不明なモデル",
"noUsage": "使用情報なし",
"usageParseError": "使用状況の解析エラー",
"input": "入力: {value}",
"output": "出力: {value}",
"cacheRead": "キャッシュ読み取り: {value}",
"cacheWrite": "キャッシュ書き込み: {value}",
"cost": "${amount}",
"viewContent": "コンテンツを表示",
"page": "ページ {current} / {total}",
"prev": "前へ",
"next": "次へ",
"contentDialogTitle": "リクエストコンテンツ"
}
}

View File

@@ -0,0 +1,58 @@
{
"title": "模型配置",
"subtitle": "管理你的 AI 提供商并查看 Token 用量。",
"aiProviders": {
"title": "AI 提供商",
"subtitle": "管理你的 AI 模型和 API 密钥。",
"addProvider": "添加提供商",
"default": "默认",
"configured": "已配置",
"notConfigured": "未配置",
"setDefault": "设为默认",
"edit": "编辑",
"delete": "删除",
"deleteConfirm": "确定要删除此提供商吗?",
"empty": "暂无配置的提供商。点击“添加提供商”开始配置。",
"editProvider": "编辑提供商",
"apiKey": "API Key",
"apiKeyPlaceholder": "输入 API Key",
"validate": "验证",
"baseUrl": "Base URL (可选)",
"defaultModel": "默认模型 (可选)",
"setDefaultSuccess": "已成功设为默认提供商",
"deleteSuccess": "提供商删除成功",
"apiKeyRequired": "请先输入 API Key",
"validateSuccess": "API Key 验证成功!",
"validateFail": "无效的 API Key",
"saveSuccess": "提供商保存成功"
},
"recentTokenHistory": {
"title": "Token 用量历史",
"loading": "加载中...",
"empty": "暂无用量记录。",
"emptyForWindow": "所选时间范围内暂无用量记录。",
"groupByModel": "按模型",
"groupByTime": "按时间",
"last7Days": "最近 7 天",
"last30Days": "最近 30 天",
"allTime": "全部时间",
"showingLast": "显示最后 {count} 条记录",
"totalTokens": "总计",
"inputShort": "输入",
"outputShort": "输出",
"cacheShort": "缓存",
"unknownModel": "未知模型",
"noUsage": "无用量信息",
"usageParseError": "用量解析错误",
"input": "输入: {value}",
"output": "输出: {value}",
"cacheRead": "缓存读取: {value}",
"cacheWrite": "缓存写入: {value}",
"cost": "${amount}",
"viewContent": "查看内容",
"page": "第 {current} 页 / 共 {total} 页",
"prev": "上一页",
"next": "下一页",
"contentDialogTitle": "请求内容"
}
}