Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File "does not look like a chat file" #104

Closed
lennartack opened this issue Feb 13, 2024 · 10 comments
Closed

File "does not look like a chat file" #104

lennartack opened this issue Feb 13, 2024 · 10 comments

Comments

@lennartack
Copy link

Recently GpChat stopped working.

Steps to reproduce:

  • Run :GpChatNew
  • Write some text
  • Run :GpChatRespond

I see an error message: Gp: file "/path/to/chat.md" does not look like a chat file.

@kingfirewxm
Copy link

kingfirewxm commented Feb 19, 2024

Previously, to facilitate switching between different Neovim configurations, I created symbolic links for the nvim folders located under the .local/share/ and .config/ directories, linking them to different distro. However, this approach led to the this issue.

I resolved my problem by explicitly specifying the real address of the chat folder in the chat_dir option.
————————————————————————
Same

@yanosea
Copy link

yanosea commented Feb 20, 2024

I'm using gp.nvim and it is really useful for me.
Thank you for your developping!!!

I'm also encountering the same problem.
I wanted to change the directory where gp/persited and gp/chats are stored,
so I changed the state_dir and chat_dir in the configuration file and now it happens.
I am using Lazy.nvim to manage plugins for Neovim and the configuration looks like this.

config = function()
  require("gp").setup({
    agents = {
        -- some config for agents
    },
    state_dir = os.getenv("ENV_VAR_INCLUDING_A_CERTAIN_DIR") .. "/gp-nvim/persisted",
    chat_dir = os.getenv("ENV_VAR_INCLUDING_A_CERTAIN_DIR") .. "/gp-nvim/chats",
  })
  vim.api.nvim_set_hl(0, "GpHandlerStandout", { link = "Normal" })
  vim.api.nvim_set_hl(0, "GpExplorerSearch", { link = "Normal" })
end,

As a catch, the md files under gp/chats/ and gp/persited/state.json under the configured directory seem to be stored correctly.

I am not familiar with Lua and may have configured it incorrectly.
If so, please let me know.

Sincerely,

@Robitx
Copy link
Owner

Robitx commented Feb 27, 2024

Hi everyone,
sorry I've been away for few weeks.

Checking whether or not a file is a chat uses several conditions. The latest version, I've just pushed, should provide more verbose message.

If anyone would be willing to try it and share the error (ideally in it's entirety - for example real file path on which it failed), it would greatly help to hone on the problem.

Tomorrow I'll try to replicate and debug the issue with symlinks mentioned by @kingfirewxm.

@Robitx
Copy link
Owner

Robitx commented Feb 28, 2024

Note for myself: https://vi.stackexchange.com/questions/44028/weird-interaction-between-gp-nvim-and-syntastic (I guess I have to install Windows 😢 )

@yanosea
Copy link

yanosea commented Feb 28, 2024

@Robitx
Hi👋
Thank you for your maintaining!

I updated gp.nvim to v2.4.7 and did the same things.
I got the message below.
I don't mask values to clear the problem.

Gp: File "/mnt/c/Users/yanosea/GoogleDrive/gp-nvim/chats/date.md" does not look like a chat file: "not in chat directory (/home/yanosea/GoogleDrive/gp-nvim/chats)"

I'm sorry I forgot to say that I'm using gp.nvim on WSL2🙏
The config I use is below.

state_dir = os.getenv("GOOGLE_DRIVE") .. "/gp-nvim/persisted",
chat_dir = os.getenv("GOOGLE_DRIVE") .. "/gp-nvim/chats",

I change state_dir and chat_dir because I want to sync chats around the devices I use via GoogleDrive.

I created symbolic link on WSL2 home.

ln -s /mnt/c/Users/yanosea/GoogleDrive ~/GoogleDrive

then, I set the env in .zshenv below.

export GOOGLE_DRIVE=$HOME/GoogleDrive

I tried two settings.

state_dir = "/home/yanosea/GoogleDrive/gp-nvim/persisted",
chat_dir = "/home/yanosea/GoogleDrive/gp-nvim/chats",

This config set dirs not using envs, but this sent the same message.

state_dir = "/mnt/c/Users/yanosea/GoogleDrive/gp-nvim/persited",
chat_dir = "/mnt/c/Users/yanosea/GoogleDrive/gp-nvim/chats",

This config set dirs not using the symbolic links. This goes well.

From this and kingfirewxm's comments, I think the symbolic link is causing the problem🤔

@yanosea
Copy link

yanosea commented Feb 28, 2024

Additionaly I tried below.

  1. mkdir on WSL2 Home
mkdir ~/test
  1. create a symbolic link
ln -s ~/test ~/test_symlink
  1. edit gp.nvim config
state_dir = "/home/yanosea/test_symlink/gp-nvim/persisted",
chat_dir = "/home/yanosea/test_symlink/gp-nvim/chats",
  1. use gp.nvim
  • Run :GpChatNew
  • Write some text
  • Run :GpChatRespond

Then, I got the same message.

Gp: File "/home/yanosea/test/gp-nvim/chats/date.md" does not look like a chat file: "not in chat directory (/home/yanosea/test_symlink/gp-nvim/chats)"

@lennartack
Copy link
Author

I can confirm that the problem is also caused by a symlink for me. Specifying chat_dir explicitly as suggested by @kingfirewxm fixed the problem. However, I would prefer to not specify chat_dir as it would make it easier to use my config accross different systems.

@Robitx
Copy link
Owner

Robitx commented Feb 28, 2024

@lennartack @yanosea @kingfirewxm The latest version 2.4.9 should be able to handle symlinks properly, please give it go.

@kingfirewxm
Copy link

@lennartack @yanosea @kingfirewxm The latest version 2.4.9 should be able to handle symlinks properly, please give it go.

It works, thank you!

@yanosea
Copy link

yanosea commented Feb 29, 2024

@Robitx
It worked!!!
Thank you very much🙏

@Robitx Robitx closed this as completed Feb 29, 2024
Robitx added a commit that referenced this issue Jul 9, 2024
* chore: wip backup

* chore: wip backup

* chore: formating

* feat: working copilot agents

* chore: wip backup

* chore: wip backup + lmstudio test

* chore: fmt

* chore: wip

* fix: toggle GpChatNew popup (resolve #112)

* chore: auto-generate vimdoc

* chore: strip whitespace in buf target resolve

* fix: handle symlinks in chat checks (issue: #104)

* feat: ollama with openAI endpoint + gemini

* chore: fix typo

* feat: show current agent in chat

* chore: copilot bearer refreshing

* feat: dynamic model for googleai

* feat: support for perplexity and anthropic

* docs: vim-plug setup snippet (issue: #123)

* chore: auto-generate vimdoc

* feat: update defaults to use latest model versions: gpt-4o and gpt-3.5-turbo

* chore: auto-generate vimdoc

* feat: filter out empty lines in picker

* fix: set the popup window to markdown filetype

* chore: wip backup

* chore: wip backup

* chore: formating

* feat: working copilot agents

* chore: wip backup

* chore: wip backup + lmstudio test

* chore: fmt

* chore: wip

* feat: ollama with openAI endpoint + gemini

* chore: fix typo

* feat: show current agent in chat

* chore: copilot bearer refreshing

* feat: dynamic model for googleai

* feat: support for perplexity and anthropic

* chore: handle old user chat prefix

* chore: newer copilot headers

* chore: GPT4 => GPT4o rename

* chore: default sys prompt vars

* chore: disable all but openAI before merging to main

* chore: better migration message

* docs: readme section about multi provider support

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shalom Yiblet <[email protected]>
Co-authored-by: Tan Long <[email protected]>
Co-authored-by: XXiaoA <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants