摘要: Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code. Factory method: Provides an interface for 阅读全文
posted @ 2024-01-23 15:11 Zhentiw 阅读(52) 评论(0) 推荐(0)
摘要: Just for fun... Given a number (always positive) as a type. Your type should return the number decreased by one. For example: type Zero = MinusOne<1> 阅读全文
posted @ 2022-10-07 22:57 Zhentiw 阅读(85) 评论(0) 推荐(0)
摘要: Blog: https://www.geeksforgeeks.org/es6-trampoline-function/ Stackoverflow problem for recursion: const sumBelow = (number, sum = 0) => ( number 0 ? s 阅读全文
posted @ 2022-08-18 14:32 Zhentiw 阅读(75) 评论(0) 推荐(0)
摘要: Serverless framework with AWS Link to each sections Table of Content: Part 0: Serverless Project structure Part 1: DynamoDB & ApiGateway Part 2: Event 阅读全文
posted @ 2021-05-17 15:15 Zhentiw 阅读(174) 评论(0) 推荐(0)
摘要: Storage Services: S3 Glacier CloudFront Elastic Block Store (EBS) Storage Gateway Snow family Database Overview Block storage: Used on local networks 阅读全文
posted @ 2021-03-15 03:06 Zhentiw 阅读(184) 评论(0) 推荐(0)
摘要: S3 Features Prefiees and delimiters For example: the file name in S3 can be: `marking/plans/kpi_2021_1.pdf`. The point is make it looks like a folder 阅读全文
posted @ 2021-03-12 17:34 Zhentiw 阅读(178) 评论(0) 推荐(0)
摘要: In our previous code, we have seen this partten for operators: // #region operators const concat = curry((broadcaster, listener) => { let string = ''; 阅读全文
posted @ 2020-10-25 21:54 Zhentiw 阅读(175) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2020-05-07 18:22 Zhentiw 阅读(0) 评论(0) 推荐(0)
摘要: Generators can yield promises which can work with the "for await of" loop syntax. This lesson shows how all the pieces fit together and explains why t 阅读全文
posted @ 2020-03-22 02:59 Zhentiw 阅读(180) 评论(0) 推荐(0)
摘要: In this post, we are going to see how to use Ramda Lens. For example, we have data: R.lens: R.lens takes a getter and a setter: R.lensProp: There is a 阅读全文
posted @ 2019-02-24 20:12 Zhentiw 阅读(734) 评论(0) 推荐(0)
摘要: Just like the State ADT an Array is also an Applicative Functor. That means we can do the same tricks with liftA2 with Array that we have been doing w 阅读全文
posted @ 2019-01-16 16:30 Zhentiw 阅读(732) 评论(0) 推荐(0)
摘要: Use custom Cypress command for reusable assertions We’re duplicating quite a few commands between the registration and login of our user for assertion 阅读全文
posted @ 2018-12-06 21:13 Zhentiw 阅读(448) 评论(0) 推荐(0)
摘要: Use Cypress to test user registration Let’s write a test to fill out our registration form. Because we’ll be running this against a live backend, we n 阅读全文
posted @ 2018-12-05 15:54 Zhentiw 阅读(371) 评论(0) 推荐(0)
摘要: Despite the fact that Cypress is an application that runs natively on your machine, you can install it and add it as a dependency just like all other 阅读全文
posted @ 2018-12-05 02:38 Zhentiw 阅读(594) 评论(0) 推荐(0)
摘要: Ensure Functions are Called Correctly with JavaScript Mocks Often when writing JavaScript tests and mocking dependencies, you’ll want to verify that t 阅读全文
posted @ 2018-11-06 04:25 Zhentiw 阅读(444) 评论(0) 推荐(0)
摘要: 1. Color Picker (Chrome) You might know how to use color picker in Chrome, recently there is a feature inside color picker which is "Contrast Ratio", 阅读全文
posted @ 2018-07-15 18:41 Zhentiw 阅读(263) 评论(0) 推荐(0)
摘要: We'll examine how to unnest function calls, capture assignment, and create a linear data flow with a type we call Box. This is our introduction to wor 阅读全文
posted @ 2016-12-11 21:47 Zhentiw 阅读(354) 评论(0) 推荐(0)
摘要: Well, this stuff will be a little bit strange if you deal with it first time. Container Object: Just a wrapper / contianer for values No Method No Nou 阅读全文
posted @ 2016-09-06 04:23 Zhentiw 阅读(359) 评论(0) 推荐(0)
摘要: First, what is 'High Order function', basic just a function, inside the function return another fuction. For example: Decorators is a subset of high o 阅读全文
posted @ 2016-06-14 03:10 Zhentiw 阅读(395) 评论(0) 推荐(0)
摘要: Somehow it looks like reflect in Java. For example: We define an mothod on the Object, it called defineMethod(). It accepts two arguements, one is met 阅读全文
posted @ 2016-05-02 03:06 Zhentiw 阅读(412) 评论(0) 推荐(0)
摘要: /** * 带重试的 LLM 调用执行器 * * 默认行为:重试时自动将错误信息反馈给 LLM,让它能够根据错误修正输出 * * @param model 可调用的模型(需要有 invoke 方法) * @param messages 初始消息数组 * @param options 重试配置 * @ 阅读全文
posted @ 2026-05-03 16:08 Zhentiw 阅读(6) 评论(0) 推荐(0)
摘要: /** * 通用提示词片段 * 用于在各个节点的 System Prompt 中复用 */ /** * JSON 安全输出提示词 * 强调 LLM 必须生成严格合法的 JSON */ export const JSON_SAFETY_PROMPT = ` 【JSON 输出安全规则 - 必须严格遵守】 阅读全文
posted @ 2026-05-03 16:03 Zhentiw 阅读(7) 评论(0) 推荐(0)
摘要: 实时场景的旧处理方案 考虑网页中的以下场景: 股票K线图 聊天 警报、重要通知 余座 抢购页面的库存 ...... 上述场景有一个共同特点——实时性 这种对实时性有要求的页面,会带来一些问题 比如下面的聊天场景 由于HTTP协议是请求-响应模式,请求必须在前,响应必须在后,这就导致了服务器无法「主动 阅读全文
posted @ 2026-04-01 13:46 Zhentiw 阅读(6) 评论(0) 推荐(0)
摘要: 核心模块 使用 langsmith 部署 langgraph 应用的时候,需要提供以下信息: langgraph.json:这是一个配置文件,用于指定应用所需的依赖、graph 和环境变量。相当于告诉系统: 这个应用需要哪些依赖 有哪些graph graph对应的映射关系 环境变量 实现应用逻辑的一 阅读全文
posted @ 2026-03-26 14:51 Zhentiw 阅读(48) 评论(0) 推荐(0)
摘要: 在写普通函数的时候,测试其实是一件很自然的事情:给输入,看输出,对不对,一跑就知道。 但在 langgraph 里,情况会复杂一些。因为这里测试的对象,已经不只是一个函数了,而是: 多个节点组成的流程 带状态流转 可能中断、可能恢复 还可能依赖 checkpoint 也就是说,在 langgraph 阅读全文
posted @ 2026-03-25 15:12 Zhentiw 阅读(18) 评论(0) 推荐(0)
摘要: 在 langgraph 中,其实有两套写流程的方式: Graph API Functional API Functional API 把工作流从画流程图变成写业务函数,但依然保留可恢复、可中断、可追踪的能力。 传统 Graph API 的思路:先设计一张图,再往图里塞节点 Function API 阅读全文
posted @ 2026-03-24 14:53 Zhentiw 阅读(37) 评论(0) 推荐(0)
摘要: 1. 不要用try/catch包裹interrupt调用 我们在写带 interrupt 的节点函数时,有一个很隐蔽但非常关键的陷阱: interrupt的暂停机制,其实是通过“抛出一个专门的异常”来实现的,也就是说,langgraph在内部让代码“假装抛错”,从而中止执行,把控制权交还给运行时的图 阅读全文
posted @ 2026-03-23 14:50 Zhentiw 阅读(65) 评论(0) 推荐(0)
摘要: 外界获取中断的值 用户编辑图状态 工具内的中断 验证用户输入 外界获取中断的值 result.__interrupt__ 就是中断时,langgraph 暴露给外界的数据。外界(UI / CLI / 后端系统)就是靠它拿到 interrupt 里传出的内容的。 interrupt({ // 配置要传 阅读全文
posted @ 2026-03-19 14:26 Zhentiw 阅读(21) 评论(0) 推荐(0)
摘要: 基本介绍 一句话定义:静态断点,是在编译图时就确定好的中断点,用于保证某个节点在执行前或执行后一定会暂停。 静态断点的两种形式 LangGraph 提供了两种静态断点配置方式: interrupt_before:在指定节点 开始执行之前 暂停。 interruptBefore: ["node_nam 阅读全文
posted @ 2026-03-17 14:18 Zhentiw 阅读(13) 评论(0) 推荐(0)
摘要: 基本介绍 langgraph中的中断分为两种: 静态断点 动态中断 1. 静态断点 在编译图时配置。适用于“在某个节点执行前或后必须暂停”的场景。 interrupt_before=["node_name"]: 在指定节点开始执行前暂停。 interrupt_after=["node_name"]: 阅读全文
posted @ 2026-03-16 14:42 Zhentiw 阅读(49) 评论(0) 推荐(0)