<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>singapore math on </title>
    <link>/tags/singapore-math/</link>
    <description>Recent content in singapore math on </description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Fri, 06 Mar 2026 01:00:00 +0800</lastBuildDate><atom:link href="/tags/singapore-math/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Spring AI 2.0.0-M2 的 Ollama think 字段问题：排查过程与 Interceptor 临时方案</title>
      <link>/posts/spring-ai-ollama-think-field-bug/</link>
      <pubDate>Fri, 06 Mar 2026 01:00:00 +0800</pubDate>
      
      <guid>/posts/spring-ai-ollama-think-field-bug/</guid>
      <description>背景 在开发新加坡小学数学 AI 辅导 App 时，我使用 Ollama 本地运行 qwen3.5:2b 模型。qwen3.5 是 thinking-capable 模型，Ollama 0.12+ 默认开启 thinking 模式，会先在 thinking 字段输出推理过程，再在 content 字段输出最终答案。
我当时遇到的问题是：thinking 模式下推理耗时从 ~16s 增加到 ~52s（约 3x），而且对当时那组 PSLE 小学数学题来说，我并不需要这么长的推理链路，所以想先把 thinking 关掉。
现象 使用 Spring AI 2.0.0-M2 提供的 API 关闭 thinking：
ChatClient.prompt() .system(systemPrompt) .user(userMessage) .options(OllamaChatOptions.builder().disableThinking().build()) .call() .content(); Ollama 返回 HTTP 400：
think must be a boolean or string (&amp;#34;high&amp;#34;, &amp;#34;medium&amp;#34;, &amp;#34;low&amp;#34;, true, or false) 根因分析 抓取 Spring AI 发往 Ollama 的请求体，发现 think 字段出现在了两个位置：</description>
    </item>
    
    <item>
      <title>用 Spring AI &#43; pgvector 落地 RAG 知识库：新加坡数学 AI 辅导 Phase 2 记录</title>
      <link>/posts/sg-math-tutor-phase2-rag-pgvector/</link>
      <pubDate>Thu, 05 Mar 2026 09:00:00 +0800</pubDate>
      
      <guid>/posts/sg-math-tutor-phase2-rag-pgvector/</guid>
      <description>回顾 Phase 1 搭建了 Java 25 + Spring AI 的多 Agent 解题管线。但当时 Planner Agent &amp;ldquo;裸跑&amp;rdquo;，没有任何参考题库。Phase 2 要解决的核心问题：让 Agent 带着&amp;quot;知识&amp;quot;回答问题。
具体目标：
导入 40 道 PSLE 真题/模拟题到向量数据库 解题前先做 RAG 检索，找到相似题作为 Prompt 上下文 按年级过滤，P5 请求不会看到 P6 难度的参考题 Redis 缓存相同题目的 AI 响应，避免重复调用 LLM 整体架构变化 graph TD A[SolveRequest] --&gt; B[SolveService - Redis @Cacheable] B --&gt;|Cache Miss| C[MathSolverOrchestrator] C --&gt; D[RagRetrievalService] D --&gt; E[(pgvector - vector_store)] D --&gt;|Top-5 相似题| F[Planner Agent + RAG Context] F --&gt; G{StructuredTaskScope} G --&gt; H[CPA Designer Agent] G --&gt; I[Persona Agent] H --&gt; J[SolveResult] I --&gt; J J --&gt; K[(Redis Cache - 24h TTL)] B --&gt;|Cache Hit| L[直接返回缓存结果] classDef cache fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#e65100 classDef rag fill:#e8f5e9,stroke:#388e3c,stroke-width:2px,color:#2e7d32 classDef agent fill:#ffffff,stroke:#1976d2,stroke-width:3px,color:#0d47a1 classDef db fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#4a148c class B,K,L cache class D,E rag class C,F,H,I agent class J db Phase 1 的数据流是 请求 → Planner → CPA + Persona → 响应。</description>
    </item>
    
    <item>
      <title>用 Java 25 &#43; Spring AI 构建新加坡小学数学 AI 辅导 App — Phase 1 实战记录</title>
      <link>/posts/sg-math-tutor-phase1-java25-spring-ai/</link>
      <pubDate>Thu, 05 Mar 2026 07:00:00 +0800</pubDate>
      
      <guid>/posts/sg-math-tutor-phase1-java25-spring-ai/</guid>
      <description>项目背景 我正在开发一个面向新加坡 2026 PSLE 考纲的小学数学 AI 辅导 App。当前设计里我最看重的是：
使用新加坡教育部推崇的 CPA (Concrete-Pictorial-Abstract) 教学法 多 Agent 协作：Planner → CPA Designer + Persona 并行处理 为家长和孩子分别生成不同语气的解题指导 技术栈选型比较激进：Java 25 + Spring Boot 4.0 + Spring AI 2.0 + Ollama 本地模型。这篇文章记录 Phase 1 的搭建过程和踩过的坑。
架构概览 graph TD A[SolveRequest - question, grade P1-P6] --&gt; B[Planner Agent - 分析题目,提取知识点,生成步骤] B --&gt; C{StructuredTaskScope.fork} C --&gt; D[CPA Designer - 生成 Bar Model - 可视化描述] C --&gt; E[Persona Agent - 家长版 + 儿童版 - 双语气输出] D --&gt; F[SolveResult] E --&gt; F F --&gt; G[parentGuide] F --&gt; H[childScript] F --&gt; I[barModelJson] F --&gt; J[knowledgeTags] classDef request fill:#ffffff,stroke:#1976d2,stroke-width:3px,color:#0d47a1 classDef agent fill:#ffffff,stroke:#f57c00,stroke-width:3px,color:#e65100 classDef result fill:#ffffff,stroke:#388e3c,stroke-width:3px,color:#2e7d32 classDef scope fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#e65100 class A request class B,D,E agent class C scope class F,G,H,I,J result Planner 先跑，分析题目后输出结构化 JSON，然后 CPA Designer 和 Persona 两个 Agent 并发执行。并发使用的是 Java 25 的 Structured Concurrency（StructuredTaskScope）。</description>
    </item>
    
  </channel>
</rss>
