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
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function convertInternalAssistantMessage(

const result: ChatCompletionAssistantMessageParam = {
role: 'assistant',
content: textParts.length > 0 ? textParts.join('\n') : null,
content: textParts.length > 0 ? textParts.join('\n') : "",
...(toolCalls.length > 0 && { tool_calls: toolCalls }),
...(reasoningParts.length > 0 && { reasoning_content: reasoningParts.join('\n') }),
}
Expand Down
10 changes: 5 additions & 5 deletions src/services/api/openai/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import OpenAI from 'openai'
import type OpenAI from 'openai
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Check if the file exists and read the first few lines
if [ -f "src/services/api/openai/client.ts" ]; then
  echo "=== File exists, reading first 30 lines ===" 
  head -n 30 "src/services/api/openai/client.ts"
else
  echo "File not found at src/services/api/openai/client.ts"
  # Let's search for it
  echo "=== Searching for client.ts in openai directories ==="
  fd "client\.ts" | grep -i openai
fi

Repository: claude-code-best/claude-code

Length of output: 1071


Fix the unterminated openai import on line 1.

The string literal is missing a closing quote, which prevents TypeScript from parsing the file and causes bun run typecheck to fail.

🐛 Proposed fix
-import type OpenAI from 'openai
+import type OpenAI from 'openai'

Please rerun bun run typecheck after applying the fix. As per coding guidelines, "TypeScript strict mode - bun run typecheck must pass with zero errors".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type OpenAI from 'openai
import type OpenAI from 'openai'
🧰 Tools
🪛 Biome (2.4.11)

[error] 1-1: unterminated string literal

(parse)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/api/openai/client.ts` at line 1, The import statement for the
OpenAI type is missing a closing quote which breaks TypeScript parsing; fix the
unterminated string in the import for "openai" (the line importing type OpenAI)
by adding the missing closing quote (and optional semicolon) so the statement
becomes a valid import, then rerun bun run typecheck to ensure no errors remain.

import { getProxyFetchOptions } from 'src/utils/proxy.js'
import { isEnvTruthy } from 'src/utils/envUtils.js'

/**
* Environment variables:
Expand All @@ -13,13 +12,14 @@ import { isEnvTruthy } from 'src/utils/envUtils.js'

let cachedClient: OpenAI | null = null

export function getOpenAIClient(options?: {
export async function getOpenAIClient(options?: {
maxRetries?: number
fetchOverride?: typeof fetch
source?: string
}): OpenAI {
}): Promise<OpenAI> {
if (cachedClient) return cachedClient


const { default: OpenAI } = await import('openai')
const apiKey = process.env.OPENAI_API_KEY || ''
const baseURL = process.env.OPENAI_BASE_URL

Expand Down
2 changes: 1 addition & 1 deletion src/services/api/openai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export async function* queryModelOpenAI(
const maxTokens = resolveOpenAIMaxTokens(upperLimit, options.maxOutputTokensOverride)

// 11. Get client
const client = getOpenAIClient({
const client = await getOpenAIClient({
maxRetries: 0,
fetchOverride: options.fetchOverride as unknown as typeof fetch,
source: options.querySource,
Expand Down
Loading