- Add GPT-5 model definitions (gpt-5, gpt-5-mini, gpt-5-nano, gpt-5-chat-latest) - Implement GPT-5 Responses API support with intelligent fallback to Chat Completions - Add GPT-5 specific parameter handling (max_completion_tokens, temperature=1) - Support custom tools and freeform function calling capabilities - Add reasoning effort and verbosity control parameters - Implement GPT-5 connection testing service - Add model capability detection and automatic parameter transformation - Support both official OpenAI and third-party GPT-5 providers - Add todo list and sticker request UI components - Improve notebook support with better type definitions - Enhance debug logging and error handling for GPT-5 - Update model selector with GPT-5 compatibility checks This commit provides full GPT-5 support while maintaining backward compatibility with existing models.
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { safeParseJSON } from './json'
|
|
import { logError } from './log'
|
|
import { queryQuick } from '../services/claude'
|
|
|
|
export function setTerminalTitle(title: string): void {
|
|
if (process.platform === 'win32') {
|
|
process.title = title ? `✳ ${title}` : title
|
|
} else {
|
|
process.stdout.write(`\x1b]0;${title ? `✳ ${title}` : ''}\x07`)
|
|
}
|
|
}
|
|
|
|
export async function updateTerminalTitle(message: string): Promise<void> {
|
|
try {
|
|
const result = await queryQuick({
|
|
systemPrompt: [
|
|
"Analyze if this message indicates a new conversation topic. If it does, extract a 2-3 word title that captures the new topic. Format your response as a JSON object with two fields: 'isNewTopic' (boolean) and 'title' (string, or null if isNewTopic is false). Only include these fields, no other text.",
|
|
],
|
|
userPrompt: message,
|
|
enablePromptCaching: true,
|
|
})
|
|
|
|
const content = result.message.content
|
|
.filter(_ => _.type === 'text')
|
|
.map(_ => _.text)
|
|
.join('')
|
|
|
|
const response = safeParseJSON(content)
|
|
if (
|
|
response &&
|
|
typeof response === 'object' &&
|
|
'isNewTopic' in response &&
|
|
'title' in response
|
|
) {
|
|
if (response.isNewTopic && response.title) {
|
|
setTerminalTitle(response.title as string)
|
|
}
|
|
}
|
|
} catch (error) {
|
|
logError(error)
|
|
}
|
|
}
|
|
|
|
export function clearTerminal(): Promise<void> {
|
|
return new Promise(resolve => {
|
|
process.stdout.write('\x1b[2J\x1b[3J\x1b[H', () => {
|
|
resolve()
|
|
})
|
|
})
|
|
}
|