Skip to content

Conversation

@00make
Copy link

@00make 00make commented Nov 20, 2025

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @00make, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求为 TradingAgents 框架引入了对 DeepSeek API 的支持,并提供了全面的部署和使用文档。它通过在检测到 DeepSeek 或 OpenRouter API 配置时智能地禁用嵌入功能来解决这些 LLM 提供商不提供嵌入服务的问题,从而确保核心代理逻辑能够正常运行。

Highlights

  • 部署文档: 新增了详细的中文部署工作流文档,涵盖了 TradingAgents 项目的安装、配置和运行。
  • DeepSeek API 集成: 实现了对 DeepSeek API 的支持,允许用户将 DeepSeek 模型作为大型语言模型提供商。
  • 嵌入功能兼容性处理: 针对 DeepSeek 和 OpenRouter API 不支持嵌入功能的情况,修改了内存模块,使其在检测到这些后端时自动禁用嵌入,并返回虚拟嵌入以避免错误。
  • 配置与快速启动指南: 提供了 DeepSeek API 的详细配置指南和快速启动文档,方便用户快速上手和优化成本。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次代码变更主要是为了兼容 OpenRouter 和 DeepSeek 等不提供 embedding 接口的 LLM 服务。核心改动是在 memory.py 中增加了逻辑,当检测到使用这类服务时,禁用 embedding 功能并返回一个虚拟的 embedding 向量,从而避免了程序崩溃。

此外,本次变更还新增了大量的中文文档,包括:

  • deploy.md: 详细的部署工作流。
  • DEEPSEEK_CONFIG.md: DeepSeek API 的专项配置指南。
  • DEPLOYMENT_SUCCESS.md: 一份部署成功报告模板或示例。
  • QUICK_START.md: 帮助用户快速上手的指南。
  • test_simple.py: 一个用于快速验证核心功能的简化测试脚本。

整体来看,这些变更为项目增加了灵活性,并极大地改善了新用户的上手体验。代码修改方向正确,文档也非常详尽。我提出了一些关于文档清晰度和代码可维护性的小建议,以供参考。


### 2. 创建 Conda 虚拟环境

// turbo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个 // turbo 注释似乎是开发过程中遗留的标记,建议在最终的文档中移除以保持整洁。

Comment on lines +41 to +50
复制示例环境文件:
python -m cli.main
```
这将启动一个交互式界面,你可以选择:
- 股票代码(ticker)
- 日期
- LLM 模型
- 研究深度等参数

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这部分文档的结构和内容似乎有些混乱。配置 API 密钥部分缺少了复制和编辑.env文件的具体命令,而运行应用的python -m cli.main命令又被错误地放在了这里。建议重新组织这部分内容,使其更清晰、更符合逻辑。

复制示例环境文件并填入你的密钥:

```bash
cp .env.example .env
# 然后用你喜欢的编辑器打开 .env 文件并填入密钥

5. 运行应用

方式 1: 使用 CLI

运行以下命令启动交互式界面:

python -m cli.main

这将启动一个交互式界面,你可以选择:

  • 股票代码(ticker)
  • 日期
  • LLM 模型
  • 研究深度等参数


运行以下命令验证环境配置正确:

// turbo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个 // turbo 注释似乎是开发过程中遗留的标记,建议在最终的文档中移除以保持整洁。

Comment on lines +121 to +122
config["deep_think_llm"] = "o1-mini"
config["quick_think_llm"] = "gpt-4o-mini"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在“切换回 OpenAI”的示例中,deep_think_llm 设置为 o1-mini,而 quick_think_llm 设置为 gpt-4o-mini。通常,deep_think 模型会选用能力更强的模型(如 gpt-4o),而 quick_think 模型选用更经济快速的模型。建议检查这里的配置是否符合预期,或者考虑将 deep_think_llm 设置为 gpt-4o 以获得更好的分析能力,从而与 quick_think_llm 形成更合理的搭配。

Comment on lines +10 to +12
if "deepseek" in config["backend_url"].lower() or "openrouter" in config["backend_url"].lower():
self.use_embeddings = False
print(f"⚠️ API (DeepSeek/OpenRouter) 不支持 embeddings,{name} 记忆功能已禁用")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

当前通过检查 backend_url 字符串来判断是否禁用 embeddings 功能。这种方式耦合性较强,如果未来需要支持更多不提供 embedding 功能的 API 提供商,就需要不断修改这里的代码。建议在配置文件中引入一个明确的布尔型标志(例如 "supports_embeddings": false),使代码逻辑更清晰且易于扩展。

"""Get OpenAI embedding for a text"""
if not self.use_embeddings:
# Return a dummy embedding if embeddings are disabled
return [0.0] * 1536 # Standard embedding size

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

当 embeddings 功能被禁用时,返回的虚拟 embedding 向量维度被硬编码为 1536。这个值与 text-embedding-3-small 模型相匹配。如果未来使用的 embedding 模型维度发生变化(例如,nomic-embed-text 的维度是 768),这个硬编码的值可能会导致不匹配的问题。为了提高代码的健壮性和可维护性,建议将此值定义为类常量或从配置中获取,使其与所选择的 embedding 模型解耦。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant