fix: 修复 ESLint 错误 - 解决未定义变量问题

- claudeConsoleRelayService.js: 将 account 变量声明提到更高作用域
- claudeRelayService.js: 移除 _makeClaudeStreamRequest 函数中的未定义变量引用
This commit is contained in:
Edric Li
2025-09-09 11:10:27 +08:00
parent 52820a7e49
commit f375f9f841
2 changed files with 10 additions and 12 deletions

View File

@@ -19,10 +19,11 @@ class ClaudeConsoleRelayService {
options = {}
) {
let abortController = null
let account = null
try {
// 获取账户信息
const account = await claudeConsoleAccountService.getAccount(accountId)
account = await claudeConsoleAccountService.getAccount(accountId)
if (!account) {
throw new Error('Claude Console Claude account not found')
}
@@ -244,9 +245,10 @@ class ClaudeConsoleRelayService {
streamTransformer = null,
options = {}
) {
let account = null
try {
// 获取账户信息
const account = await claudeConsoleAccountService.getAccount(accountId)
account = await claudeConsoleAccountService.getAccount(accountId)
if (!account) {
throw new Error('Claude Console Claude account not found')
}

View File

@@ -1502,15 +1502,11 @@ class ClaudeRelayService {
})
req.on('error', async (error) => {
logger.error(
`❌ Claude stream request error (Account: ${account?.name || accountId}):`,
error.message,
{
code: error.code,
errno: error.errno,
syscall: error.syscall
}
)
logger.error(`❌ Claude stream request error:`, error.message, {
code: error.code,
errno: error.errno,
syscall: error.syscall
})
// 根据错误类型提供更具体的错误信息
let errorMessage = 'Upstream request failed'
@@ -1554,7 +1550,7 @@ class ClaudeRelayService {
req.on('timeout', async () => {
req.destroy()
logger.error(`❌ Claude stream request timeout | Account: ${account?.name || accountId}`)
logger.error(`❌ Claude stream request timeout`)
if (!responseStream.headersSent) {
responseStream.writeHead(504, {