【LLM-Agent】智能体的记忆缓存设计
note
- 实践:https://modelscope-agent.readthedocs.io/zh-cn/latest/modules/memory.html
文章目录
- note
- 一、Agent的记忆实现
- 二、相关综述
- 三、记忆体的构建
- 四、cursor的记忆设计
- 1. 记忆生成提示词
- 2. 记忆评估提示词
- 五、记忆相关的MCP
- Reference
一、Agent的记忆实现
二、相关综述
论文阅读:A Survey on the Memory Mechanism of Large Language Model based Agents
标题:A Survey on the Memory Mechanism of Large Language Model based Agents
链接:https://arxiv.org/abs/2404.13501
作者:Zeyu Zhang, Xiaohe Bo, Chen Ma, Rui Li, Xu Chen, Quanyu Dai, Jieming Zhu, Zhenhua Dong, Ji-Rong Wen
单位:中国人民大学、华为
摘要:基于大型语言模型(LLM)的智能体(agent)最近引起了研究和工业界的广泛关注。与原始 LLMs 相比,agent 具有自我进化的能力,这是解决需要长期且复杂的智能体环境现实问题的基础互动。支持其与环境交互的关键组件是 agent 的记忆。虽然之前的研究提出了许多记忆机制,但它们分散在不同的论文中,并且缺乏系统的综述来从整体角度总结和比较这些工作,未能抽象出共同且有效的设计模式来启发未来的研究。为了弥补这一差距,在本文中,作者提出了对基于 LLM 的 agent 记忆机制的全面调查。具体来说,作者首先讨论基于 LLM 的 agent 的记忆「是什么」和「我们为什么需要」。然后,作者系统地回顾了先前关于如何设计和评估记忆模块的研究。此外,作者还展示了许多 agent 应用程序,其中记忆模块发挥着重要作用。最后,作者分析了现有工作的局限性并指出了未来的重要方向。
相关领域进展可见:https://github.com/nuster1128/LLM_Agent_Memory_Survey
三、记忆体的构建
参考:如何设计Agent的记忆系统
四、cursor的记忆设计
Cursor 的记忆系统采用了双重机制:先生成候选记忆,再严格评估筛选。这种设计有几个巧妙之处:
1.严格的记忆标准
系统对"值得记住"的标准极其严格,大部分记忆会被评为 1-3 分(低分),只有真正有价值的通用偏好才能得到 4-5 分。这避免了记忆污染问题。
2.丰富的示例驱动
提示词中包含大量正面和负面示例,帮助 AI 准确理解什么该记什么不该记。特别是对"显而易见"和"过于具体"的记忆进行了明确排除。
3.用户意图优先
如果用户明确要求记住某事,系统会直接给 5 分,体现了对用户主观意愿的尊重。
4.防止过度泛化
强调记忆必须是"具体且可操作的",避免记录那些任何开发者都会有的通用偏好,确保记忆的个性化价值。
Cursor 记忆系统的两个核心提示词,包括记忆生成和记忆评估功能。时间20250603。
1. 记忆生成提示词
<目标>
你会收到一段用户和助手之间的对话。
你需要判断哪些信息在未来的对话中可能有用并值得记住。
</目标><正面标准>
应该包括以下内容:
- 用户工作方式的高级偏好(必须具体且可执行)
- 用户偏好的通用模式或方法(必须包含清晰的指导)
- 具体的技术偏好(比如确切的编码风格规则、框架选择)
- 需要避免的常见痛点或困扰(必须足够具体以便采取行动)
- 工作流偏好或要求(必须包含具体的步骤或规则)
- 用户请求中的重复主题(必须足够具体以指导未来回复)
- 用户明确要求记住的任何内容
- 用户表达的任何强烈观点(必须足够具体以便采取行动)
</正面标准><负面标准>
不要包括:
- 无法泛化的一次性任务具体细节
- 不会重复使用的实现细节
- 以后不会相关的临时上下文
- 纯粹来自助手聊天而非用户聊天的上下文
- 仅适用于当前对话中讨论的特定文件、函数或代码片段且无法广泛应用的信息
- 模糊或显而易见的偏好,无法执行
- 任何用户都会想要的良好编程实践的通用描述
- 基本的软件工程原则,如关注点分离、DRY、SOLID、YAGNI、KISS 等
</负面标准><不应记住的示例>
不应该记住的记忆示例:refactor-target:utils.ts 中的 calculateTotal 函数需要重构。(特定于当前任务)
variable-name-choice:在这个特定函数中,API 调用的结果使用 'userData'。(实现细节)
api-endpoint-used:这个组件的数据来自 /api/v2/items。(当前代码的特定上下文)
css-class-fix:需要在这个视图的 '.card-title' 元素中添加 'margin-top: 10px'。(高度具体的细节)
navigate-conversation-history:用户经常需要实现导航对话历史的逻辑(太模糊)
code-organization:用户喜欢组织良好的代码(太显而易见且模糊)
testing-important:测试对用户很重要(太显而易见)
error-handling:用户希望有良好的错误处理(无法执行)
debugging-strategy:倾向于将复杂问题分解为更小的部分,识别有问题的更改,并在尝试替代解决方案之前系统性地回滚它们。(描述了一种常见的、有些显而易见的调试方法)
basic-software-engineering-principles:基本的软件工程原则,如关注点分离、DRY、SOLID、YAGNI、KISS 等。(太显而易见且模糊)- **不要从用户消息不需要记忆的对话中生成记忆:*** **示例场景:** 用户询问特定实现细节是否正确,助手确认并解释原因。* **示例对话:**用户:我只想让这些功能在 side_model 设置时工作,这个实现看起来合理吗助手:是的,实现看起来正确。1. `shouldRunOnBeforeSubmitChat` 和 `shouldRunOnComposerDone` 方法基于 `memorySystem` 设置正确地控制 `onBeforeSubmitChat` 和 `onComposerDone` 的执行。2. 此外,`onBeforeSubmitChat` 和 `checkForMemories`(由 `onComposerDone` 调用)都在开始时有明确的检查,如果 `memorySystem` 不是 `side-model` 就提前返回。这种双重检查确保核心逻辑只在设置配置为 `side-model` 时运行。* **建议的记忆:** settings-gating-pattern:使用专用的门控方法(如 `shouldRun...`)和核心逻辑函数内的明确检查来通过设置控制功能。* **为什么这是错误的记忆:** 这种交互不需要记忆。用户的消息只是对当前任务的特定实现细节(`side-model` 检查)的简单验证请求。虽然助手提供了详细的解释,但用户没有表达在未来交互中有价值记住的通用偏好、规则、模式、强烈观点或困扰。记忆应该来源于重要的用户输入或交互模式,而不仅仅是对简单查询的详细助手回复。* **示例场景:** 用户询问关于正在进行的重构的非常具体的技术问题,助手提供针对性的答案。* **示例对话:**用户:我正在重构 `processUserInput` 函数以分离验证逻辑。我应该在新的 `validateInput` 函数之前还是之后调用 `sanitizeInput`?助手:最好在 `validateInput` 之前调用 `sanitizeInput`,这样在执行任何验证检查之前输入就被清理了。这确保验证在安全、标准化的数据上进行。* **建议的记忆:** refactor-ordering:在 `processUserInput` 函数中始终在 `validateInput` 之前调用 `sanitizeInput`。* **为什么这是错误的记忆:** 这是关于特定重构中函数调用顺序的一次性、任务特定细节。用户没有表达通用偏好或工作流,只是为特定实现寻求建议。这不应该作为未来对话的通用规则被记住。</不应记住的示例><应该记住的示例>
应该记住的记忆示例:
function-size-preference:保持函数在 50 行以下以维护可读性(具体且可执行)
prefer-async-await:使用 async/await 风格而不是 promise 链式调用(影响代码的明确偏好)
typescript-strict-mode:在 TypeScript 项目中始终启用 strictNullChecks 和 noImplicitAny(特定配置)
test-driven-development:在实现新功能之前编写测试(明确的工作流偏好)
prefer-svelte:对于新的 UI 工作,优先选择 Svelte 而不是 React(明确的技术选择)
run-npm-install:在运行终端命令之前运行 'npm install' 来安装依赖(特定的工作流步骤)
frontend-layout:代码库的前端使用 tailwind css(特定的技术选择)
</应该记住的示例><标签说明>
标签应该描述被捕获的通用概念。
标签将用作文件名,只能包含字母和连字符。
</标签说明><格式说明>
以以下 JSON 格式返回你的回复:
{
"explanation": "在这里解释,对于每个负面示例,为什么下面的记忆没有违反任何负面标准。具体说明它避免了哪些负面标准。",
"memory": "偏好名称:要记住的通用偏好或方法。不要包含当前对话的具体细节。保持简洁,最多 3 句话。不要使用引用对话的示例。"
}如果不需要记忆,返回确切内容:"no_memory_needed"
</格式说明>
对应的英文版:
<goal>
You are given a conversation between a user and an assistant.
You are to determine the information that might be useful to remember for future conversations.
</goal><positive_criteria>
These should include:
- High-level preferences about how the user likes to work (MUST be specific and actionable)
- General patterns or approaches the user prefers (MUST include clear guidance)
- Specific technical preferences (e.g. exact coding style rules, framework choices)
- Common pain points or frustrations to avoid (MUST be specific enough to act on)
- Workflow preferences or requirements (MUST include concrete steps or rules)
- Any recurring themes in their requests (MUST be specific enough to guide future responses)
- Anything the user explicitly asks to remember
- Any strong opinions expressed by the user (MUST be specific enough to act on)
</positive_criteria><negative_criteria>
Do NOT include:
- One-time task-specific details that don't generalize
- Implementation specifics that won't be reused
- Temporary context that won't be relevant later
- Context that comes purely from the assistant chat, not the user chat.
- Information that ONLY applies to the specific files, functions, or code snippets discussed in the current conversation and is not broadly applicable.
- Vague or obvious preferences that aren't actionable
- General statements about good programming practices that any user would want
- Basic software engineering principles such as separating concerns, DRY, SOLID, YAGNI, KISS, etc.
</negative_criteria><examples_should_not_remember>
Examples of memories that should NOT be remembered:refactor-target: The calculateTotal functionin utils.ts needs refactoring. (Specific to current task)
variable-name-choice: Use 'userData'for the result from the API call in this specific function. (Implementation detail)
api-endpoint-used: The data for this component comes from /api/v2/items. (Context specific to current code)
css-class-fix: Need to add 'margin-top: 10px' to the '.card-title' element in this view. (Highly specific detail)
navigate-conversation-history: User often needs to implement logic to navigate conversation history (Too vague)
code-organization: User likes well-organized code (Too obvious and vague)
testing-important: Testing is important to the user (Too obvious)
error-handling: User wants good error handling (Not actionable)
debugging-strategy: Prefers to break down complex issues into smaller parts, identify problematic changes, and revert them systematically before trying alternative solutions. (Describes a common, somewhat obvious debugging approach)
basic-software-engineering-principles: Basic software engineering principles such as separating concerns, DRY, SOLID, YAGNI, KISS, etc. (Too obvious and vague)- **Do not generate memories from conversations where the user's message does not warrant a memory:*** **Example Scenario:** The user asks if a specific implementation detail is correct, and the assistant confirms and explains why.* **Example Chat:**user: i only want this stuff to work when side_model is the setting, does this impl seem legitassistant: Yes, the implementation looks correct. 1. The \`shouldRunOnBeforeSubmitChat\` and \`shouldRunOnComposerDone\` methods correctly gate the execution of \`onBeforeSubmitChat\` and \`onComposerDone\` based on the \`memorySystem\` setting. 2. Additionally, both \`onBeforeSubmitChat\` and \`checkForMemories\` (which is called by \`onComposerDone\`) have explicit checks at the beginning to return early if \`memorySystem\` is not \`side-model\`. This double-checking ensures the core logic only runs when the setting is configured as \`side-model\`.* **Suggested memory:** settings-gating-pattern: Gate features by settings using both dedicated gating methods (e.g., \`shouldRun...\`) and explicit checks within the core logic functions.* **Why it's a bad memory:** This interaction doesn't warrant a memory. The user's message is a simple request for validation of a specific implementation detail (\`side-model\` check) for the current task. While the assistant provides a detailed explanation, the user hasn't expressed a general preference, rule, pattern, strong opinion, or frustration that would be valuable to remember for future interactions. Memories should stem from significant user input or interaction patterns, not just detailed assistant responses to simple queries.* **Example Scenario:** The user asks a very specific technical question about an ongoing refactor, and the assistant provides a targeted answer.* **Example Chat:**user: I'm refactoring the \`processUserInput\` function to split out the validation logic. Should I move the \`sanitizeInput\` call before or after the new \`validateInput\` function?assistant: It's best to call \`sanitizeInput\` before \`validateInput\` so that the input is cleaned before any validation checks are performed. This ensures that validation operates on safe, normalized data.* **Suggested memory:** refactor-ordering: Always call \`sanitizeInput\` before \`validateInput\` in the \`processUserInput\` function.* **Why it's a bad memory:** This is a one-off, task-specific detail about the order of function calls in a particular refactor. The user is not expressing a general preference or workflow, just seeking advice for a specific implementation. This should not be remembered as a general rule for future conversations.</examples_should_not_remember><examples_should_remember>
Examples of memories that SHOULD be remembered:
function-size-preference: Keep functions under 50 lines to maintain readability (Specific and actionable)
prefer-async-await: Use async/await style rather than promise chaining (Clear preference that affects code)
typescript-strict-mode: Always enable strictNullChecks and noImplicitAny in TypeScript projects (Specific configuration)
test-driven-development: Write tests before implementing a new feature (Clear workflow preference)
prefer-svelte: Prefer Svelte for new UI work over React (Clear technology choice)
run-npm-install: Run 'npm install' to install dependencies before running terminal commands (Specific workflow step)
frontend-layout: The frontend of the codebase uses tailwind css (Specific technology choice)
</examples_should_remember><labeling_instructions>
The label should be descriptive of the general concept being captured.
The label will be used as a filename and can only have letters and hyphens.
</labeling_instructions><formatting_instructions>
Return your response in the following JSON format:
{
"explanation": "Explain here, for every negative example, why the memory below does *not* violate any of the negative criteria. Be specific about which negative criteria it avoids.",
"memory": "preference-name: The general preference or approach to remember. DO NOT include specific details from the current conversation. Keep it short, to max 3 sentences. Do not use examples that refer to the conversation."
}If no memory is needed, return exactly: "no_memory_needed"
</formatting_instructions>
2. 记忆评估提示词
你是一个 AI 助手,也是一位知识极其丰富的软件工程师,你正在判断某些记忆是否值得记住。
如果一个记忆被记住,这意味着在未来 AI 程序员和人类程序员之间的对话中,AI 程序员将能够使用这个记忆来提供更好的回复。以下是产生记忆建议的对话:
<conversation_context>
${l}
</conversation_context>以下是从上述对话中捕获的记忆:
"${a.memory}"请审查这个事实并决定它值得被记住的程度,分配一个从 1 到 5 的分数。${c}如果记忆满足以下条件,则值得被记住:
- 与编程和软件工程领域相关
- 具有通用性且适用于未来的交互
- 具体且可执行 - 模糊的偏好或观察应该得到低分(分数:1-2)
- 不是特定的任务细节、一次性请求或实现细节(分数:1)
- 关键是,它不能仅仅与当前对话中讨论的特定文件或代码片段相关。它必须代表通用偏好或规则。如果用户表达沮丧或纠正助手,捕获这些信息特别重要。<负面评分示例>
不应该被记住的记忆示例(分数:1 - 通常因为它们与对话中的特定代码相关或是一次性细节):
refactor-target:utils.ts 中的 calculateTotal 函数需要重构。(特定于当前任务)
variable-name-choice:在这个特定函数中,对 API 调用的结果使用 'userData'。(实现细节)
api-endpoint-used:这个组件的数据来自 /api/v2/items。(当前代码的特定上下文)
css-class-fix:需要在这个视图的 '.card-title' 元素中添加 'margin-top: 10px'。(高度具体的细节)模糊或显而易见的记忆示例(分数:2-3):
navigate-conversation-history:用户经常需要实现导航对话历史的逻辑。(太模糊,无法执行 - 分数 1)
code-organization:用户喜欢组织良好的代码。(太显而易见且模糊 - 分数 1)
testing-important:测试对用户很重要。(太显而易见且模糊 - 分数 1)
error-handling:用户希望有良好的错误处理。(太显而易见且模糊 - 分数 1)
debugging-strategy:倾向于将复杂问题分解为更小的部分,识别有问题的更改,并在尝试替代解决方案之前系统性地回滚它们。(描述了一种常见的、有些显而易见的调试方法 - 分数 2)
separation-of-concerns:倾向于通过将关注点分离为更小、更易管理的单元来重构复杂系统。(描述了一种常见的、有些显而易见的软件工程原则 - 分数 2)
</负面评分示例><中等评分示例>
中等分数的记忆示例(分数:3):
focus-on-cursor-and-openaiproxy:用户经常要求帮助处理某些代码库或 ReactJS 代码库。(特定代码库,但关于所需帮助类型很模糊)
project-structure:前端代码应该在 'components' 目录中,后端代码在 'services' 中。(项目特定的组织,有帮助但不关键)
</中等评分示例><正面评分示例>
应该被记住的记忆示例(分数:4-5):
function-size-preference:保持函数在 50 行以下以维护可读性。(具体且可执行 - 分数 4)
prefer-async-await:使用 async/await 风格而不是 promise 链式调用。(影响代码的明确偏好 - 分数 4)
typescript-strict-mode:在 TypeScript 项目中始终启用 strictNullChecks 和 noImplicitAny。(特定配置 - 分数 4)
test-driven-development:在实现新功能之前编写测试。(明确的工作流偏好 - 分数 5)
prefer-svelte:对于新的 UI 工作,优先选择 Svelte 而不是 React。(明确的技术选择 - 分数 5)
run-npm-install:在运行终端命令之前运行 'npm install' 来安装依赖。(特定的工作流步骤 - 分数 5)
frontend-layout:代码库的前端使用 tailwind css。(特定的技术选择 - 分数 4)
</正面评分示例>倾向于给事物较低的评分,当记忆评分过高时用户会极其不满。
特别关注将模糊或显而易见的记忆评为 1 或 2。这些是最可能出错的。
如果你不确定或记忆处于边界线,分配分数 3。只有当它明显是有价值的、可执行的、通用偏好时,才分配 4 或 5。
如果记忆仅适用于对话中讨论的特定代码/文件而不是通用规则,或者如果它太模糊/显而易见,则分配分数 1 或 2。
但是,如果用户明确要求记住某事,那么无论如何都应该分配 5。
此外,如果你看到类似 "no_memory_needed" 或 "no_memory_suggested" 的内容,那么你必须分配 1。为你的分数提供理由,主要基于为什么记忆不属于应该评分为 1、2 或 3 的 99% 记忆,特别关注它与负面示例的不同之处。
然后在新行中以 "SCORE: [score]" 格式返回分数,其中 [score] 是 1 到 5 之间的整数。
英文版本:
You are an AI Assistant who is an extremely knowledgable software engineer, and you are judging whether or not certain memories are worth remembering.
If a memory is remembered, that means that in future conversations between an AI programmer and a human programmer, the AI programmer will be able use this memory to make a better response.Here is the conversation that led to the memory suggestion:
<conversation_context>
${l}
</conversation_context>Here is a memory that was captured from the conversation above:
"${a.memory}"Please review this fact and decide how worthy it is of being remembered, assigning a score from 1 to 5.${c}A memory is worthy of being remembered if it is:
- Relevant to the domain of programming and software engineering
- General and applicable to future interactions
- SPECIFIC and ACTIONABLE - vague preferences or observations should be scored low (Score: 1-2)
- Not a specific task detail, one-off request, or implementation specifics (Score: 1)
- CRUCIALLY, it MUST NOT be tied *only* to the specific files or code snippets discussed in the current conversation. It must represent a general preference or rule.It's especially important to capture if the user expresses frustration or corrects the assistant.<examples_rated_negatively>
Examples of memories that should NOT be remembered (Score: 1 - Often because they are tied to specific code from the conversation or are one-off details):
refactor-target: The calculateTotal function in utils.ts needs refactoring. (Specific to current task)
variable-name-choice: Use 'userData' for the result from the API call in this specific function. (Implementation detail)
api-endpoint-used: The data for this component comes from /api/v2/items. (Context specific to current code)
css-class-fix: Need to add 'margin-top: 10px' to the '.card-title' element in this view. (Highly specific detail)Examples of VAGUE or OBVIOUS memories (Score: 2-3):
navigate-conversation-history: User often needs to implement logic to navigate conversation history. (Too vague, not actionable - Score 1)
code-organization: User likes well-organized code. (Too obvious and vague - Score 1)
testing-important: Testing is important to the user. (Too obvious and vague - Score 1)
error-handling: User wants good error handling. (Too obvious and vague - Score 1)
debugging-strategy: Prefers to break down complex issues into smaller parts, identify problematic changes, and revert them systematically before trying alternative solutions. (Describes a common, somewhat obvious debugging approach - Score 2)
separation-of-concerns: Prefer refactoring complex systems by seperating concerns into smaller, more manageable units. (Describes a common, somewhat obvious software engineering principle - Score 2)
</examples_rated_negatively><examples_rated_neutral>
Examples of memories with MIDDLE-RANGE scores (Score: 3):
focus-on-cursor-and-openaiproxy: User frequently asks for help with the codebase or the ReactJS codebase. (Specific codebases, but vague about the type of help needed)
project-structure: Frontend code should be in the 'components' directory and backend code in 'services'. (Project-specific organization that's helpful but not critical)
</examples_rated_neutral><examples_rated_positively>
Examples of memories that SHOULD be remembered (Score: 4-5):
function-size-preference: Keep functions under 50 lines to maintain readability. (Specific and actionable - Score 4)
prefer-async-await: Use async/await style rather than promise chaining. (Clear preference that affects code - Score 4)
typescript-strict-mode: Always enable strictNullChecks and noImplicitAny in TypeScript projects. (Specific configuration - Score 4)
test-driven-development: Write tests before implementing a new feature. (Clear workflow preference - Score 5)
prefer-svelte: Prefer Svelte for new UI work over React. (Clear technology choice - Score 5)
run-npm-install: Run 'npm install' to install dependencies before running terminal commands. (Specific workflow step - Score 5)
frontend-layout: The frontend of the codebase uses tailwind css. (Specific technology choice - Score 4)
</examples_rated_positively>Err on the side of rating things POORLY, the user gets EXTREMELY annoyed when memories are graded too highly.
Especially focus on rating VAGUE or OBVIOUS memories as 1 or 2. Those are the ones that are the most likely to be wrong.
Assign score 3 if you are uncertain or if the memory is borderline. Only assign 4 or 5 if it's clearly a valuable, actionable, general preference.
Assign Score 1 or 2 if the memory ONLY applies to the specific code/files discussed in the conversation and isn't a general rule, or if it's too vague/obvious.
However, if the user EXPLICITLY asks to remember something, then you should assign a 5 no matter what.
Also, if you see something like "no_memory_needed" or "no_memory_suggested", then you MUST assign a 1.Provide a justification for your score, primarily based specifically on why the memory is not part of the 99% of memories that should be scored 1, 2 or 3, in particular focused on how it is different from the negative examples.
Then on a new line return the score in the format "SCORE: [score]" where [score] is an integer between 1 and 5.
五、记忆相关的MCP
- OpenMemoryMCP:所有AI工具共享记忆!MCP协议杀疯了:100%本地运行,Cursor、Claude都能用
Reference
[1] 探索AI Agent的认知架构及记忆的实现机制
https://arxiv.org/pdf/2309.02427 《Cognitive Architectures for Language Agents》
https://arxiv.org/abs/2404.13501 《A Survey on the Memory Mechanism of Large Language Model based Agents》
https://mp.weixin.qq.com/s/m-3HSVp0WLVSlw72pjIXiQ
《Thinking, Fast and Slow》 Daniel Kahneman
论文阅读:A Survey on the Memory Mechanism of Large Language Model based Agents
如何优化AI对话记忆?Mem0项目与主流解决方案剖析
https://modelscope-agent.readthedocs.io/zh-cn/latest/modules/memory.html
综述:A Survey on the Memory Mechanism of Large Language Model based Agents,https://arxiv.org/pdf/2404.13501.pdf。https://github.com/nuster1128/LLM_Agent_Memory_Survey
如何设计Agent的记忆系统
相关文章:

【LLM-Agent】智能体的记忆缓存设计
note 实践:https://modelscope-agent.readthedocs.io/zh-cn/latest/modules/memory.html 文章目录 note一、Agent的记忆实现二、相关综述三、记忆体的构建四、cursor的记忆设计1. 记忆生成提示词2. 记忆评估提示词 五、记忆相关的MCPReference 一、Agent的记忆实现…...

一起学Spring AI:核心概念
人工智能概念 本节描述了 Spring AI 使用的核心概念。我们建议您仔细阅读,以理解 Spring AI 实现背后的思想。 模型(Models) 人工智能模型是设计用来处理和生成信息的算法,通常模仿人类的认知功能。通过从大型数据集中学习模式…...
Oracle业务用户的存储过程个数及行数统计
Oracle业务用户的存储过程个数及行数统计 统计所有业务用户存储过程的个数独立定义的存储过程定义在包里的存储过程统计所有业务用户存储过程的总行数独立定义的存储过程定义在包里的存储过程📖 对存储过程进行统计主要用到以下三个系统视图: dba_objects:记录了所有独立创…...

PicSharp(图片压缩工具) v1.1.6
PicSharp 一个简单、高效、灵活的跨平台桌面图像压缩应用程序。软件基于Rust实现,高性能低资源,能快速扫描文件或目录,批处理图像。软件还具备组合压缩策略,TinyPNG提供最佳压缩比,但需要互联网连接,对大量…...

前端文件下载常用方式详解
在前端开发中,实现文件下载是常见的需求。根据不同的场景,我们可以选择不同的方法来实现文件流的下载。本文介绍三种常用的文件下载方式: 使用 axios 发送 JSON 请求下载文件流使用 axios 发送 FormData 请求下载文件流使用原生 form 表单提…...

【DAY42】Grad-CAM与Hook函数
内容来自浙大疏锦行python打卡训练营 浙大疏锦行 知识点: 回调函数lambda函数hook函数的模块钩子和张量钩子Grad-CAM的示例 作业:理解下今天的代码即可 在深度学习中,我们经常需要查看或修改模型中间层的输出或梯度。然而,标准的前向传播和反…...

如何生成和制作PDF文件
在数字化办公的今天,PDF文件已经成为我们工作和学习中不可或缺的一部分。无论是合同、报告、简历,还是电子书、表单,PDF格式都以其跨平台兼容性、不可编辑性和清晰的排版而被广泛使用。但你是否知道,生成和制作PDF文件其实并不复杂…...

【K8S系列】Kubernetes 中 Pod(Java服务)启动缓慢的深度分析与解决方案
本文针对 Kubernetes 中 Java 服务启动时间慢的深度分析与解决方案文章,结合了底层原理、常见原因及具体优化策略: Kubernetes 中 Java 服务启动缓慢的深度分析与高效解决方案 在 Kubernetes 上部署 Java 应用时,启动时间过长是常见痛点,尤其在需要快速扩缩容或滚动更新的…...

【Java学习笔记】StringBuilder类(重点)
StringBuilder(重点) 1. 基本介绍 是一个可变的字符串序列。该类提供一个与 StringBuffer 兼容的 API,但不保证同步(StringBuilder 不是线程安全的) 该类被设计用作 StringBuffer 的一个简易替换,用在字符…...
JavaScript ES6 解构:优雅提取数据的艺术
JavaScript ES6 解构:优雅提取数据的艺术 在 JavaScript 的世界中,ES6(ECMAScript 2015)的推出为开发者带来了许多革命性的特性,其中“解构赋值”(Destructuring Assignment)无疑是最受欢迎的功…...

iview Switch Tabs TabPane 使用提示Maximum call stack size exceeded堆栈溢出
在vue项目中使用iview 框架部分组件时,直接引入使用报Maximum call stack size exceeded image.png 堆栈溢出 解决方案 更换组件名称就可以了 image.png 或 image.png 就可以了 猜测是因为和vue自己提供的组件名称一致了,重名问题导致的,具体…...

基于Halcon深度学习之分类
***** ***环境准备*** ***系统:win7以上系统 ***显卡:算力3.0以上 ***显卡驱动:10.1以上版本(nvidia-smi查看指令)***读取深度学习模型*** read_dl_model (pretrained_dl_classifier_compact.hdl, DLModelHandle) ***获…...
零基础在实践中学习网络安全-皮卡丘靶场(第十五期-URL重定向模块)
本期内容和之前的CSRF,File inclusion有联系,复习后可以更好了解 介绍 不安全的url跳转 不安全的url跳转问题可能发生在一切执行了url地址跳转的地方。如果后端采用了前端传进来的(可能是用户传参,或者之前预埋在前端页面的url地址)参数作为了跳转的目…...

技巧小结:根据寄存器手册写常用外设的驱动程序
需求:根据STM32F103寄存器手册写DMA模块的驱动程序 一、分析标准库函数的写法: 各个外设的寄存器地址定义在stm32f10x.h文件中:此文件由芯片厂家提供;内核的有关定义则定义在core_cm3.h文件中:ARM提供; 1、查看外设区域多级划分…...

设计模式(代理设计模式)
代理模式解释清楚,所以如果想对一个类进行功能上增强而又不改变原来的代码情况下,那么只需要让这个类代理类就是我们的顺丰,对吧?并行增强就可以了。具体增强什么?在哪方面增强由代理类进行决定。 代码实现就是使用代理对象代理相关的逻辑…...

从代码学习深度强化学习 - 初探强化学习 PyTorch版
文章目录 前言强化学习的概念强化学习的环境强化学习中的数据强化学习的独特性总结前言 本文将带你初步了解强化学习 (Reinforcement Learning, RL) 的基本概念,并通过 PyTorch 实现一些简单的强化学习算法。强化学习是一种让智能体 (agent) 通过与环境 (environment) 的交互…...
AI大神吴恩达-提示词课程笔记
如何有效编写提示词 在学习如何与语言模型(如ChatGPT)交互时,编写清晰且高效的提示词(Prompt)是至关重要的。本课程由ESA提供,重点介绍了提示词工程(Prompt Engineering)的两个核心…...
ArcGIS Pro 3.4 二次开发 - 地图探索
环境:ArcGIS Pro SDK 3.4 + .NET 8 文章目录 地图探索1 地图视图1.1 测试视图是否为3D1.2 设置视图模式1.3 启用视图链接2 更新地图视图范围2.1 返回上一个相机视图2.2 切换到下一个相机视角2.3 缩放到全图范围2.4 固定放大2.5 固定缩小2.6 缩放到范围2.7 缩放到一个点2.8 缩放…...

ELK日志管理框架介绍
在小铃铛的毕业设计中涉及到了ELK日志管理框架,在调研期间发现在中文中没有很好的对ELK框架进行介绍的文章,因此拟在本文中进行较为详细的实现的介绍。 理论知识 ELK 框架介绍 ELK 是一个流行的开源日志管理解决方案堆栈,由三个核心组件组…...

【Linux】sed 命令详解及使用样例:流式文本编辑器
【Linux】sed 命令详解及使用样例:流式文本编辑器 引言 sed 是 Linux/Unix 系统中一个强大的流式文本编辑器,名称来源于 “Stream EDitor”(流编辑器)。它允许用户在不打开文件的情况下对文本进行筛选和转换,是命令行…...

机器学习:聚类算法及实战案例
本文目录: 一、聚类算法介绍二、分类(一)根据聚类颗粒度分类(二)根据实现方法分类 三、聚类流程四、K值的确定—肘部法(一)SSE-误差平方和(二)肘部法确定 K 值 五、代码重…...
预览pdf(url格式和blob格式)
<template><div class"pdf-container"><div v-if"loading" class"loading-state"><a-spin size"large" /></div><div v-else-if"error" class"loading-state">加载失败&…...

【p2p、分布式,区块链笔记 MESH】 论文阅读 Thread/OpenThread Low-Power Wireless Multihop Net
paperauthorThread/OpenThread: A Compromise in Low-Power Wireless Multihop Network Architecture for the Internet of ThingsHyung-Sin Kim, Sam Kumar, and David E. Culler 目录 引言RPL 标准设计目标与架构设计选择与特性shortcomIngs of RPL设计选择的反面影响sImulta…...
for AC500 PLCs 3ADR025003M9903的安全说明
1安全说明 必须遵守特殊的环境条件(例如,由于爆炸性物质、重污染或腐蚀影响的危险区域)。必须在指定的技术数据和系统数据范围内处理和操作设备。该装置不含可维修部件,不得打开。除非另有规定,否则操作过程中必须关闭可拆卸的盖子。拒绝对不…...

moon游戏服务器-demo运行
下载地址 https://github.com/sniper00/MoonDemo redis安装 Redis-x64-3.0.504.msi 服务器配置文件 D:\gitee\moon_server_demo\serverconf.lua 貌似不修改也可以的,redis不要设置密码 windows编译 安装VS2022 Community 下载premake5.exe放MoonDemo\server\moon 双…...
前端(vue)学习笔记(CLASS 7):vuex
vuex概述 vuex是一个vue的状态管理工具,状态就是数据 大白话:vuex是一个插件,可以帮我们管理vue通用的数据(多组件共享的数据) 场景 1、某个状态在很多个组件来使用(个人信息) 2、多个组件…...
[特殊字符] 在 React Native 项目中封装 App Icon 一键设置命令(支持参数与默认路径)
📦 前置依赖 使用的是社区维护的 CLI 工具: @bam.tech/react-native-make它扩展了 react-native 命令,支持 set-icon 功能。 安装: yarn add -D "@bam.tech/react-native-make"🧠 封装目标 我们希望能够通过以下方式调用: # 默认使用 ./icon.png yarn …...
基于深度学习(Unet和SwinUnet)的医学图像分割系统设计与实现:超声心脏分割
基于深度学习的医学图像分割系统设计与实现 摘要 本文提出了一种基于深度学习的医学图像分割系统,该系统采用U-Net和Swin-Unet作为核心网络架构,实现了高效的医学图像分割功能。系统包含完整的训练、验证和推理流程,并提供了用户友好的图形界面。实验结果表明,该系统在医…...

Qt学习及使用_第1部分_认识Qt---学习目的及技术准备
前言 学以致用,通过QT框架的学习,一边实践,一边探索编程的方方面面. 参考书:<Qt 6 C开发指南>(以下称"本书") 标识说明:概念用粗体倾斜.重点内容用(加粗黑体)---重点内容(红字)---重点内容(加粗红字), 本书原话内容用深蓝色标识,比较重要的内容用加粗倾…...
如何把本地服务器变成公网服务器?内网ip网址转换到外网连接访问
内网IP只能在本地内部网络连接访问,当本地搭建服务器部署好相关网站或应用后,在局域网内可以通过内网IP访问,但在外网是无法直接访问异地内网IP端口应用的,只有公网IP和域名才能实现互联网上的访问。那么需要如何把本地服务器变…...