feat: add account notes field

This commit is contained in:
LLLLLLiulei
2026-01-05 14:07:33 +08:00
parent 7cc7e15174
commit 94750fb61f
25 changed files with 436 additions and 39 deletions

View File

@@ -56,6 +56,16 @@
data-tour="account-form-name"
/>
</div>
<div>
<label class="input-label">{{ t('admin.accounts.notes') }}</label>
<textarea
v-model="form.notes"
rows="3"
class="input"
:placeholder="t('admin.accounts.notesPlaceholder')"
></textarea>
<p class="input-hint">{{ t('admin.accounts.notesHint') }}</p>
</div>
<!-- Platform Selection - Segmented Control Style -->
<div>
@@ -1917,6 +1927,7 @@ const tempUnschedPresets = computed(() => [
const form = reactive({
name: '',
notes: '',
platform: 'anthropic' as AccountPlatform,
type: 'oauth' as AccountType, // Will be 'oauth', 'setup-token', or 'apikey'
credentials: {} as Record<string, unknown>,
@@ -2175,6 +2186,7 @@ const splitTempUnschedKeywords = (value: string) => {
const resetForm = () => {
step.value = 1
form.name = ''
form.notes = ''
form.platform = 'anthropic'
form.type = 'oauth'
form.credentials = {}
@@ -2321,6 +2333,7 @@ const createAccountAndFinish = async (
}
await adminAPI.accounts.create({
name: form.name,
notes: form.notes,
platform,
type,
credentials,

View File

@@ -15,6 +15,16 @@
<label class="input-label">{{ t('common.name') }}</label>
<input v-model="form.name" type="text" required class="input" data-tour="edit-account-form-name" />
</div>
<div>
<label class="input-label">{{ t('admin.accounts.notes') }}</label>
<textarea
v-model="form.notes"
rows="3"
class="input"
:placeholder="t('admin.accounts.notesPlaceholder')"
></textarea>
<p class="input-hint">{{ t('admin.accounts.notesHint') }}</p>
</div>
<!-- API Key fields (only for apikey type) -->
<div v-if="account.type === 'apikey'" class="space-y-4">
@@ -795,6 +805,7 @@ const defaultBaseUrl = computed(() => {
const form = reactive({
name: '',
notes: '',
proxy_id: null as number | null,
concurrency: 1,
priority: 1,
@@ -813,6 +824,7 @@ watch(
(newAccount) => {
if (newAccount) {
form.name = newAccount.name
form.notes = newAccount.notes || ''
form.proxy_id = newAccount.proxy_id
form.concurrency = newAccount.concurrency
form.priority = newAccount.priority

View File

@@ -936,6 +936,9 @@ export default {
editAccount: 'Edit Account',
deleteAccount: 'Delete Account',
searchAccounts: 'Search accounts...',
notes: 'Notes',
notesPlaceholder: 'Enter notes',
notesHint: 'Notes are optional',
allPlatforms: 'All Platforms',
allTypes: 'All Types',
allStatus: 'All Status',
@@ -975,6 +978,23 @@ export default {
overloadedUntil: 'Overloaded until {time}',
viewTempUnschedDetails: 'View temp unschedulable details'
},
columns: {
name: 'Name',
platformType: 'Platform/Type',
platform: 'Platform',
type: 'Type',
concurrencyStatus: 'Concurrency',
notes: 'Notes',
priority: 'Priority',
weight: 'Weight',
status: 'Status',
schedulable: 'Schedulable',
todayStats: 'Today Stats',
groups: 'Groups',
usageWindows: 'Usage Windows',
lastUsed: 'Last Used',
actions: 'Actions'
},
tempUnschedulable: {
title: 'Temp Unschedulable',
statusTitle: 'Temp Unschedulable Status',
@@ -1018,21 +1038,6 @@ export default {
unavailableDesc: 'Unavailable - pause 30 minutes'
}
},
columns: {
name: 'Name',
platformType: 'Platform/Type',
platform: 'Platform',
type: 'Type',
concurrencyStatus: 'Concurrency',
status: 'Status',
schedulable: 'Schedule',
todayStats: "Today's Stats",
groups: 'Groups',
usageWindows: 'Usage Windows',
priority: 'Priority',
lastUsed: 'Last Used',
actions: 'Actions'
},
clearRateLimit: 'Clear Rate Limit',
testConnection: 'Test Connection',
reAuthorize: 'Re-Authorize',

View File

@@ -1014,6 +1014,9 @@ export default {
refreshCookie: '刷新 Cookie',
testAccount: '测试账号',
searchAccounts: '搜索账号...',
notes: '备注',
notesPlaceholder: '请输入备注',
notesHint: '备注可选',
// Filter options
allPlatforms: '全部平台',
allTypes: '全部类型',
@@ -1031,6 +1034,7 @@ export default {
platform: '平台',
type: '类型',
concurrencyStatus: '并发',
notes: '备注',
priority: '优先级',
weight: '权重',
status: '状态',

View File

@@ -385,6 +385,7 @@ export interface TempUnschedulableStatus {
export interface Account {
id: number
name: string
notes?: string | null
platform: AccountPlatform
type: AccountType
credentials?: Record<string, unknown>
@@ -477,6 +478,7 @@ export interface CodexUsageSnapshot {
export interface CreateAccountRequest {
name: string
notes?: string | null
platform: AccountPlatform
type: AccountType
credentials: Record<string, unknown>
@@ -490,6 +492,7 @@ export interface CreateAccountRequest {
export interface UpdateAccountRequest {
name?: string
notes?: string | null
type?: AccountType
credentials?: Record<string, unknown>
extra?: Record<string, unknown>

View File

@@ -30,6 +30,10 @@
<template #cell-name="{ value }">
<span class="font-medium text-gray-900 dark:text-white">{{ value }}</span>
</template>
<template #cell-notes="{ value }">
<span v-if="value" :title="value" class="block max-w-xs truncate text-sm text-gray-600 dark:text-gray-300">{{ value }}</span>
<span v-else class="text-sm text-gray-400 dark:text-dark-500">-</span>
</template>
<template #cell-platform_type="{ row }">
<PlatformTypeBadge :platform="row.platform" :type="row.type" />
</template>
@@ -177,6 +181,7 @@ const cols = computed(() => {
{ key: 'usage', label: t('admin.accounts.columns.usageWindows'), sortable: false },
{ key: 'priority', label: t('admin.accounts.columns.priority'), sortable: true },
{ key: 'last_used_at', label: t('admin.accounts.columns.lastUsed'), sortable: true },
{ key: 'notes', label: t('admin.accounts.columns.notes'), sortable: false },
{ key: 'actions', label: t('admin.accounts.columns.actions'), sortable: false }
)
return c

View File

@@ -32,11 +32,11 @@ export default defineConfig({
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8080',
target: process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:8080',
changeOrigin: true
},
'/setup': {
target: 'http://localhost:8080',
target: process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:8080',
changeOrigin: true
}
}