ddworken / hishtory

Your shell history: synced, queryable, and in context
https://hishtory.dev
MIT License
2.43k stars 41 forks source link

OpenAI query crashes without showing an error #220

Open yellowtailfan opened 1 month ago

yellowtailfan commented 1 month ago

I am using Hishtory in offline mode. I tried both without and with OPENAI_API_KEY set. I am using an OpenAI project key as that's what they recommend using.

Here's the steps starting at the bash prompt:

  1. Ctrl-R
  2. Hishtory TUI query interface appears
  3. Type ? list all images
  4. Hishtory stops and returns to the bash prompt

No messages or errors about OpenAI are shown. There's nothing in the hishtory.log either.

yellowtailfan commented 1 month ago

There are a bunch of errors in the hishtory log but they seem unrelated. E.g.

time="2024-06-15T12:00:05+10:00" level=info msg="failed to find presaved entry matching cmd=\"grep AI .hishtory/hishtory.log\" even with retry, skipping delete"
time="2024-06-15T12:00:42+10:00" level=info msg="github.com/ddworken/hishtory/client/hctx/hctx.go:105 database is locked (261)\n[0.015ms] [rows:0] CREATE TABLE `history_entries` (`local_username` text,`hostname` text,`command` text,`current_working_directory` text,`home_directory` text,`exit_code` integer,`start_time` datetime,`end_time` datetime,`device_id` text,`entry_id` text,`custom_columns` blob)" fromSQL=true
time="2024-06-15T12:00:42+10:00" level=info msg="github.com/ddworken/hishtory/client/hctx/hctx.go:106 database is locked (261)\n[0.015ms] [rows:0] PRAGMA journal_mode = WAL" fromSQL=true
time="2024-06-15T12:00:42+10:00" level=info msg="github.com/ddworken/hishtory/client/hctx/hctx.go:107 database is locked (261)\n[0.011ms] [rows:0] CREATE INDEX IF NOT EXISTS start_time_index ON history_entries(start_time)" fromSQL=true
time="2024-06-15T12:00:42+10:00" level=info msg="github.com/ddworken/hishtory/client/hctx/hctx.go:108 database is locked (261)\n[0.011ms] [rows:0] CREATE INDEX IF NOT EXISTS end_time_index ON history_entries(end_time)" fromSQL=true
time="2024-06-15T12:00:42+10:00" level=info msg="github.com/ddworken/hishtory/client/hctx/hctx.go:109 database is locked (261)\n[0.008ms] [rows:0] CREATE INDEX IF NOT EXISTS entry_id_index ON history_entries(entry_id)" fromSQL=true
time="2024-06-15T12:00:42+10:00" level=info msg="Skipping saving a history entry because we did not build a history entry (was the command prefixed with a space and/or empty?)\n"

I installed using:

curl https://hishtory.dev/install.py | HISHTORY_OFFLINE=true python3 -