aider icon indicating copy to clipboard operation
aider copied to clipboard

nothing response in chat with "TypeError: 'NoneType' object is not subscriptable"

Open zhjygit opened this issue 1 year ago • 6 comments

➜ ~ git:(master) ✗ aider a.html -vvv Aider v0.28.0 Command Line Args: a.html -vvv Environment Variables: OPENAI_API_KEY: *** OPENAI_API_BASE: https://api.nextapi.fun/v1 Defaults: --model: gpt-4-1106-preview --skip-model-availability-check:False --voice-language: en --map-tokens: 1024 --input-history-file:/home/zhjy/.aider.input.history --chat-history-file:/home/zhjy/.aider.chat.history.md --user-input-color:#00cc00 --tool-error-color:#FF2222 --assistant-output-color:#0088ff --code-theme: default --aiderignore: /home/zhjy/.aiderignore --encoding: utf-8

Option settings:

  • aiderignore: /home/zhjy/.aiderignore
  • apply: None
  • assistant_output_color: #0088ff
  • auto_commits: True
  • chat_history_file: /home/zhjy/.aider.chat.history.md
  • check_update: False
  • code_theme: default
  • commit: False
  • config: None
  • dark_mode: False
  • dirty_commits: True
  • dry_run: False
  • edit_format: None
  • encoding: utf-8
  • files: ['a.html']
  • git: True
  • gitignore: True
  • input_history_file: /home/zhjy/.aider.input.history
  • light_mode: False
  • map_tokens: 1024
  • message: None
  • message_file: None
  • model: gpt-4-1106-preview
  • openai_api_base: https://api.nextapi.fun/v1
  • openai_api_deployment_id: None
  • openai_api_key: ***
  • openai_api_type: None
  • openai_api_version: None
  • openai_organization_id: None
  • pretty: True
  • show_diffs: False
  • show_repo_map: False
  • skip_check_update: False
  • skip_model_availability_check: False
  • stream: True
  • tool_error_color: #FF2222
  • tool_output_color: None
  • user_input_color: #00cc00
  • verbose: True
  • voice_language: en
  • yes: None API key supports: gpt-3.5-turbo, gpt-3.5-turbo-0301, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613, gpt-4, gpt-4-0314, gpt-4-0613 API key does not support gpt-4-1106-preview, falling back to gpt-3.5-turbo-0125 Model: gpt-3.5-turbo-0125 using whole edit format Git repo: .git with 0 files Repo-map: using 1024 tokens Added a.html to the chat. Use /help to see in-chat commands, run with --help to see cmd line args ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── a.html> print a circle

SYSTEM Act as an expert software developer. SYSTEM Take requests for changes to the supplied code. SYSTEM If the request is ambiguous, ask questions. SYSTEM SYSTEM Once you understand the request you MUST: SYSTEM 1. Determine if any code changes are needed. SYSTEM 2. Explain any needed changes. SYSTEM 3. If changes are needed, output a copy of each file that needs changes. SYSTEM SYSTEM To suggest changes to a file you MUST return the entire content of the updated file. SYSTEM You MUST use this file listing format: SYSTEM SYSTEM path/to/filename.js SYSTEM SYSTEM // entire file content ... SYSTEM // ... goes in between SYSTEM SYSTEM SYSTEM Every file listing MUST use this format: SYSTEM - First line: the filename with any originally provided path SYSTEM - Second line: opening SYSTEM - ... entire content of the file ... SYSTEM - Final line: closing SYSTEM SYSTEM To suggest changes to a file you MUST return a file listing that contains the entire content of the file. SYSTEM NEVER skip, omit or elide content from a file listing using "..." or by adding comments like "... rest of code..."! SYSTEM Create a new file you MUST return a file listing which includes an appropriate filename, including any appropriate path. USER Here is the current content of the files: USER USER a.html USER USER ASSISTANT Ok. USER print a circle SYSTEM To suggest changes to a file you MUST return the entire content of the updated file. SYSTEM You MUST use this file listing format: SYSTEM SYSTEM path/to/filename.js SYSTEM SYSTEM // entire file content ... SYSTEM // ... goes in between SYSTEM SYSTEM SYSTEM Every file listing MUST use this format: SYSTEM - First line: the filename with any originally provided path SYSTEM - Second line: opening SYSTEM - ... entire content of the file ... SYSTEM - Final line: closing SYSTEM SYSTEM To suggest changes to a file you MUST return a file listing that contains the entire content of the file. SYSTEM NEVER skip, omit or elide content from a file listing using "..." or by adding comments like "... rest of code..."! SYSTEM Create a new file you MUST return a file listing which includes an appropriate filename, including any appropriate path.

zhjygit avatar Apr 16 '24 05:04 zhjygit

My ai api is not support for gpt4, so it is in chat with default gpt-3.5-turbo. however,in the -vvv content, the "model " remains gpt-4-1106-preview

zhjygit avatar Apr 16 '24 05:04 zhjygit

➜ ~ git:(master) ✗ aider --model gpt-3.5-turbo Aider v0.28.0 Model: gpt-3.5-turbo using whole edit format Git repo: .git with 0 files Repo-map: using 1024 tokens Use /help to see in-chat commands, run with --help to see cmd line args ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────

print a circle and blink every 1 second

I will provide you with the code to achieve the desired functionality. Let's create an HTML file that displays a circle and makes it blink every 1 second.

index.html

Blinking Circle

This HTML file creates a red circle that blinks every 1 second. The animation is achieved using CSS keyframes.
You can open this file in a web browser to see the blinking circle.

Allow creation of new file index.html? y Applied edit to index.html Traceback (most recent call last): File "/home/zhjy/.local/bin/aider", line 8, in sys.exit(main()) ^^^^^^ File "/home/zhjy/.local/lib/python3.11/site-packages/aider/main.py", line 667, in main coder.run() File "/home/zhjy/.local/lib/python3.11/site-packages/aider/coders/base_coder.py", line 400, in run new_user_message = self.run_loop() ^^^^^^^^^^^^^^^ File "/home/zhjy/.local/lib/python3.11/site-packages/aider/coders/base_coder.py", line 484, in run_loop return self.send_new_user_message(inp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zhjy/.local/lib/python3.11/site-packages/aider/coders/base_coder.py", line 585, in send_new_user_message saved_message = self.auto_commit(edited) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zhjy/.local/lib/python3.11/site-packages/aider/coders/base_coder.py", line 1029, in auto_commit res = self.repo.commit(fnames=edited, context=context, prefix="aider: ") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zhjy/.local/lib/python3.11/site-packages/aider/repo.py", line 73, in commit commit_message = self.get_commit_message(diffs, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zhjy/.local/lib/python3.11/site-packages/aider/repo.py", line 124, in get_commit_message commit_message = simple_send_with_retries(self.client, model.name, messages) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zhjy/.local/lib/python3.11/site-packages/aider/sendchat.py", line 78, in simple_send_with_retries return response.choices[0].message.content ~~~~~~~~~~~~~~~~^^^ TypeError: 'NoneType' object is not subscriptable

As shown above, when i in chat with aider, finally it is error "TypeError: 'NoneType' object is not subscriptable ".Of course, the index.html is normal and blink as ecpected.

zhjygit avatar Apr 16 '24 05:04 zhjygit

Thanks for trying aider and filing this issue.

Are you actually using OpenAI's apis? It looks like you are trying to point to some other API endpoint:

openai_api_base: https://api.nextapi.fun/v1

paul-gauthier avatar Apr 17 '24 17:04 paul-gauthier

Thanks for trying aider and filing this issue.

Are you actually using OpenAI's apis? It looks like you are trying to point to some other API endpoint:

openai_api_base: https://api.nextapi.fun/v1

yes, as you see,my api base is https://api.nextapi.fun/v1, and i cannot get a openai's apis with some reasons like firewall. If it is about api's soure, can you improte the code to run with third party apis?

zhjygit avatar Apr 18 '24 04:04 zhjygit

It appears that the API you are using is returning responses which aren't fully compliant with the OpenAI API. I'm not sure I will be able to help you debug a non-standard API/proxy configuration.

paul-gauthier avatar Apr 21 '24 22:04 paul-gauthier

It appears that the API you are using is returning responses which aren't fully compliant with the OpenAI API. I'm not sure I will be able to help you debug a non-standard API/proxy configuration.

Thanks sir.

zhjygit avatar Apr 22 '24 00:04 zhjygit

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

paul-gauthier avatar Apr 22 '24 16:04 paul-gauthier