Skip to content

[问题/Issue] 章节15:.env内容无法正常识别,无法正常启动项目(解决方案) #417

@Fourinches

Description

@Fourinches

1. 遇到问题的章节 / Affected Chapter

15

2. 问题类型 / Issue Type

文档不清晰 / Unclear Documentation

3. 具体问题描述 / Problem Description

.env文件内填写好LLM_BASE_URL,LLM_MODEL_ID,LLM_API_KEY后,仍然无法启动服务,终端提示无法检测到可用APIKEY。

4. 问题重现材料 / Reproduction Materials

错误信息

⚠️ 警告: 未设置LLM_API_KEY环境变量
请在.env文件中配置LLM_API_KEY
示例: LLM_API_KEY="your-api-key"
🤖 正在初始化NPC Agent系统...
❌ LLM初始化失败: API密钥和服务地址必须被提供或在.env文件中定义。
⚠️ 将使用模拟模式运行

5. 补充信息 / Additional Information

解决方案:按照标准填写好所需内容,填写QDRANT和EMBED内容,在https://cloud.qdrant.io/中注册,得到URL和APIKEY,注意URL带端口号。
填写EMBED_MODEL,内容为:
EMBED_MODEL_TYPE=“dashscope”
EMBED_MODEL_NAME="text-embedding-v4"
EMBED_API_KEY="填写阿里云APIKEY"
EMBED_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
在agents.py,config.py,main.py中添加from dotenv import load_dotenv,以及load_dotenv(),启动服务后
按照终端要求安装对应的包。
补充:godot导入的是helloagent-ai-twon目录下的project.godot文件,进入后再左下角选择scene中的main.tscn,点击F5进入场景,输入问题到生成时间较长,大约半分钟左右

确认事项 / Verification

  • 我已阅读过相关章节的文档 / I have read the relevant chapter documentation
  • 我已搜索过现有的Issues,确认此问题未被报告 / I have searched existing Issues and confirmed this hasn't been reported
  • 我已尝试过基本的故障排除(如重启、重新安装依赖等) / I have tried basic troubleshooting (restart, reinstall dependencies, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions