Skip to content

Solving Markdown Newline Issues in LLM Stream Responses

When developing applications integrated with Large Language Models (LLMs), streaming responses are a key technology for enhancing user experience. However, when LLMs return Markdown-formatted content through EventSource to the frontend, newline characters may be lost, causing Markdown rendering errors. This article analyzes the root cause of this problem and proposes an elegant solution—using custom placeholders to replace newlines, ensuring Markdown formatting is fully preserved during streaming transmission.

Understanding Component Rendering Order in Next.js App Router

In React application development, the top-down rendering pattern of component trees (parent components render before children) is a fundamental paradigm. However, when using Next.js App Router, developers may encounter a noteworthy phenomenon - **child components execute before parent components**. This counter-intuitive behavior can cause issues, particularly in permission validation and internationalization scenarios. This article analyzes this feature, demonstrates its behavior through real-world examples, explores the technical principles behind it, and provides practical solutions.

Simple RAG Implementation with LangChain

This article introduces how to implement a simple RAG system using LangChain, covering key steps including document loading, splitting, vectorization, storage, retrieval, and prompt assembly. Through LangChain's modular design, you can easily build an efficient and reliable RAG system.

Understanding the Essence of RAG

This article delves deep into the essence of RAG (Retrieval Augmented Generation), covering everything from basic concepts to practical implementations, including implementations using different frameworks like LangChain, LlamaIndex, and detailed examples of custom RAG, helping readers comprehensively understand this important AI architectural pattern.

VitePress Sidebar Auto-generation Implementation

When building a blog with VitePress, a common requirement is to automatically generate sidebar navigation based on articles. This article will detail how to implement a multilingual sidebar auto-generation tool with year-month grouping.

Implementing iCloud Sync by Combining SwiftData with CKSyncEngine

Data synchronization is a common requirement in iOS app development. While SwiftData provides native CloudKit sync support, we can choose to combine it with CKSyncEngine for more flexible synchronization when fine-grained control over the sync process is needed. This article will detail how to combine SwiftData with CKSyncEngine.

2024 Annual Summary: Exploring ML, RAG and iOS Development

This is my 2024 annual summary as a backend/algorithm/iOS developer. Throughout this year, I witnessed the practical applications of machine learning, the rise of RAG technology, the evolution of the Swift ecosystem, and gained valuable experience in independent development.

Java Multi-threading and Semaphore Investigation

Investigation into combining Java thread pools with semaphores, analyzing issues in controlling task submission rates. Through practical examples, this article explores ThreadPoolExecutor's thread management mechanism and Semaphore's synchronization characteristics, providing optimization suggestions.

Implementing MapReduce in Java

MapReduce is a distributed computing model for processing large datasets. It breaks down data processing tasks into Map and Reduce phases, improving computational efficiency through parallel processing. This article will demonstrate how to implement a simple MapReduce framework in Java, similar to the functionality described in Google's MapReduce paper.