MyGit

2.0rc0

Chainlit/chainlit

版本发布时间: 2024-11-08 21:28:36

Chainlit/chainlit最新发布版本:2.0.3(2025-01-14 22:48:39)

⚠️ Security Advisory

IMPORTANT: The element feature currently contains a known security vulnerability that could allow unauthorized file access. We strongly recommend against using elements in production environments until a comprehensive fix is implemented in an upcoming release.

Key Improvements

Breaking Changes

OpenAI Realtime API Integration

Other Changes

New Features

Technical Improvements

Migration Guide

OpenAI Realtime API Migration

If you're using audio features, you'll need to update your code to use the new realtime audio system:

  1. Update imports and types:
- from chainlit.types import AudioChunk
+ from chainlit.types import InputAudioChunk, OutputAudioChunk
  1. Update your audio callbacks:
@cl.on_audio_start
async def on_audio_start():
    # New callback to initialize audio session
    # Return True to enable audio connection
    return True

@cl.on_audio_chunk
async def on_audio_chunk(chunk: cl.InputAudioChunk):
    # Process incoming audio chunks
    # chunk.data contains the raw audio data
    pass

@cl.on_audio_end
async def on_audio_end():
    # Clean up audio session
    pass
  1. For streaming audio back to the client:
await cl.context.emitter.send_audio_chunk(
    cl.OutputAudioChunk(
        mimeType="pcm16",
        data=audio_data,
        track=track_id
    )
)

See our documentation for a complete implementation example.

New Contributors

Full Changelog: https://github.com/Chainlit/chainlit/compare/1.3.1...2.0rc0

相关地址:原始地址 下载(tar) 下载(zip)

查看:2024-11-08发行的版本