Skip to content

[Code Issue]: 配置完ds的api,但报错,默认设置很不符合习惯 #237

Description

@zhiwu215

问题描述

如下图,我配置了deepseek的api key
Image

问题:

  • 测试配置 用的是 「LLM Model settings」标签页里选中的配置(我选了 DeepSeek V4 Flash,填了 Key,所以测试成功)。
  • Step1 生成架构 用的是 「Config choose」标签页里 生成架构所用大模型 的下拉框。
  • 默认的 config.json 里 choose_configs.architecture_llm 是 "Gemini 3.5 Flash",而这个配置没有 API Key,所以 create_llm_adapter 拿到了 interface_format="Gemini",走到
    GeminiAdapter,再因为 Key 为空报 No API key was provided。

这个操作也太奇怪了吧,作为刚刚使用的新用户,下意识的觉得配置完这个api key就可以了

日志信息(如适用)

2026-07-26 13:12:19 - root - ERROR - 生成小说架构时出错
Traceback (most recent call last):
File "D:\Code\open-source\AI_NovelGenerator\ui\generation_handlers.py", line 55, in task
Novel_architecture_generate(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
interface_format=interface_format,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<11 lines>...
user_guidance=user_guidance # 添加内容指导参数
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "D:\Code\open-source\AI_NovelGenerator\novel_generator\architecture.py", line 80, in Novel_architecture_generate
llm_adapter = create_llm_adapter(
interface_format=interface_format,
...<5 lines>...
timeout=timeout
)
File "D:\Code\open-source\AI_NovelGenerator\llm_adapters.py", line 418, in create_llm_adapter
return GeminiAdapter(api_key, base_url, model_name, max_tokens, temperature, timeout)
File "D:\Code\open-source\AI_NovelGenerator\llm_adapters.py", line 110, in init
self._client = genai.Client(api_key=self.api_key)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "D:\Code\open-source\AI_NovelGenerator.venv\Lib\site-packages\google\genai\client.py", line 432, in init
self._api_client = self._get_api_client(
~~~~~~~~~~~~~~~~~~~~^
vertexai=vertexai,
^^^^^^^^^^^^^^^^^^
...<5 lines>...
http_options=http_options,
^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "D:\Code\open-source\AI_NovelGenerator.venv\Lib\site-packages\google\genai\client.py", line 480, in _get_api_client
return BaseApiClient(
vertexai=vertexai,
...<4 lines>...
http_options=http_options,
)
File "D:\Code\open-source\AI_NovelGenerator.venv\Lib\site-packages\google\genai_api_client.py", line 732, in init
raise ValueError(
...<3 lines>...
)
ValueError: No API key was provided. Please pass a valid API key. Learn how to create an API key at https://ai.google.dev/gemini-api/docs/api-key.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions