dustinblackman / oatmeal

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!
https://dustinblackman.com/posts/oatmeal/
MIT License
477 stars 23 forks source link

error decoding response body: missing field `data` #47

Open notno opened 6 months ago

notno commented 6 months ago

Trying to run with openai backend on Windows. I did oatmeal config create, which outputs Created default config file at C:\Users\MyUser\AppData\Local\oatmeal/config.toml

Not sure if the forwardslash wrongness is a big deal... but then after I edit the file at that location and then run oatmeal config default, it doesn't show my changes...

Then when I do oatmeal:


Oh no! Oatmeal has failed with the following app version and error.

Version: 0.12.4
Commit: 7e70405
Error: error decoding response body: missing field `data` at line 8 column 1

   0: backtrace::backtrace::dbghelp::trace
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\backtrace-0.3.69\src\backtrace\dbghelp.rs:98
   1: backtrace::backtrace::trace_unsynchronized
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\backtrace-0.3.69\src\backtrace\mod.rs:66
   2: backtrace::backtrace::trace
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\backtrace-0.3.69\src\backtrace\mod.rs:53
   3: anyhow::backtrace::capture::Backtrace::create
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.75\src\backtrace.rs:216
   4: anyhow::backtrace::capture::Backtrace::capture
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.75\src\backtrace.rs:204
   5: anyhow::error::impl$1::from<reqwest::error::Error>
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.75\src\error.rs:551
   6: core::result::impl$27::from_residual
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962\library\core\src\result.rs:1962
   7: oatmeal::infrastructure::backends::openai::impl$50::list_models::async_block$0
             at D:\a\oatmeal\oatmeal\src\infrastructure\backends\openai.rs:129
   8: oatmeal::domain::services::app_state::impl$0::new::async_fn$0
             at D:\a\oatmeal\oatmeal\src\domain\services\app_state.rs:59
   9: oatmeal::application::ui::start_loop::async_fn$0<ratatui::backend::crossterm::CrosstermBackend<std::io::stdio::StdoutLock> >
             at D:\a\oatmeal\oatmeal\src\application\ui.rs:68
  10: oatmeal::main::async_block$0
             at D:\a\oatmeal\oatmeal\src\main.rs:126
  11: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.33.0\src\runtime\scheduler\multi_thread\mod.rs:86
  12: tokio::runtime::runtime::Runtime::block_on
             at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.33.0\src\runtime\runtime.rs:350
  13: oatmeal::main
             at D:\a\oatmeal\oatmeal\src\main.rs:139
  14: core::ops::function::FnOnce::call_once
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962\library\core\src\ops\function.rs:250
  15: std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962\library\std\src\sys_common\backtrace.rs:154
  16: main
  17: invoke_main
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  18: __scrt_common_main_seh
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  19: <unknown>
  20: RtlUserThreadStart```
dustinblackman commented 5 months ago

Hey there! Sorry for the delay.

The error looks to be from reading the OpenAI streaming response. Looks like some kind of error must be coming back, and Oatmeal isn't handling it well.

The incorrect slash is a display bug, I've patched it in https://github.com/dustinblackman/oatmeal/commit/c7366e946f9cbf66061ebbe2681b61abb78f3ae2.

oatmeal default outputs the default config, not what you currently have set. The output you're seeing there makes sense.

If you attempted to use the command line parameter --open-ai-token to configure the token, does it work on Windows? I don't have a machine myself to test on.