Kode-cli/src/types/notebook.ts
CrazyBoyM 6cf566fb40 feat: Add comprehensive GPT-5 support with Responses API integration
- 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.
2025-08-13 01:38:15 +08:00

87 lines
1.9 KiB
TypeScript

// Type definitions for Jupyter notebook functionality
// Used by NotebookReadTool and NotebookEditTool
/**
* Valid notebook cell types
*/
export type NotebookCellType = 'code' | 'markdown'
/**
* Notebook output image structure
*/
export interface NotebookOutputImage {
image_data: string
media_type: 'image/png' | 'image/jpeg'
}
/**
* Processed notebook cell output for display
*/
export interface NotebookCellSourceOutput {
output_type: 'stream' | 'execute_result' | 'display_data' | 'error'
text?: string
image?: NotebookOutputImage
}
/**
* Processed notebook cell structure used by tools
*/
export interface NotebookCellSource {
cell: number // Cell index
cellType: NotebookCellType
source: string
language: string
execution_count?: number | null
outputs?: NotebookCellSourceOutput[]
}
/**
* Raw notebook cell output from .ipynb file
*/
export interface NotebookCellOutput {
output_type: 'stream' | 'execute_result' | 'display_data' | 'error'
name?: string
text?: string | string[]
data?: Record<string, unknown>
execution_count?: number | null
metadata?: Record<string, unknown>
// For error outputs
ename?: string
evalue?: string
traceback?: string[]
}
/**
* Raw notebook cell structure from .ipynb file
*/
export interface NotebookCell {
cell_type: NotebookCellType
source: string | string[]
metadata: Record<string, unknown>
execution_count?: number | null
outputs?: NotebookCellOutput[]
id?: string
}
/**
* Complete notebook structure from .ipynb file
*/
export interface NotebookContent {
cells: NotebookCell[]
metadata: {
kernelspec?: {
display_name?: string
language?: string
name?: string
}
language_info?: {
name?: string
version?: string
mimetype?: string
file_extension?: string
}
[key: string]: unknown
}
nbformat: number
nbformat_minor: number
}