feat: add editing and MCP command handling, enhance SSE streaming with usage tracking
- Implemented `Edit` and `McpAdd` commands in the command parser and handler. - Added a new `stream` module to the runtime for handling streaming events. - Enhanced `SseParser` to parse usage information from SSE events. - Introduced `ToolCallAccumulator` for tracking tool calls independently. - Updated `AppStateRest` to include `app_config` and `MiscState` to track `effort_level` and `selected_index`. - Modified `LlmClient` to support streaming responses with usage tracking. - Improved error handling and retry logic in the streaming API calls. - Added tests for new features and improved markdown rendering in the chat view.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use ratatui::style::{Color, Modifier, Style};
|
||||
use ratatui::text::Span;
|
||||
|
||||
pub fn render_markdown<'a>(text: &'a str, width: u16) -> Vec<Span<'a>> {
|
||||
pub fn render_markdown(text: &str, width: u16) -> Vec<Span<'static>> {
|
||||
let mut spans = Vec::new();
|
||||
let parser = pulldown_cmark::Parser::new(text);
|
||||
let mut in_code_block = false;
|
||||
@@ -122,6 +122,7 @@ pub fn render_markdown<'a>(text: &'a str, width: u16) -> Vec<Span<'a>> {
|
||||
let mut spans_out = Vec::new();
|
||||
let mut line_len = 0;
|
||||
for span in &spans {
|
||||
let style = span.style;
|
||||
let s = span.content.clone();
|
||||
let text = s.as_ref();
|
||||
let remaining = text.len();
|
||||
@@ -129,7 +130,7 @@ pub fn render_markdown<'a>(text: &'a str, width: u16) -> Vec<Span<'a>> {
|
||||
spans_out.push(Span::raw("\n"));
|
||||
line_len = 0;
|
||||
}
|
||||
spans_out.push(Span::raw(text.to_string()));
|
||||
spans_out.push(Span::styled(text.to_string(), style));
|
||||
if !text.contains('\n') {
|
||||
line_len += remaining;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user