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

If a user changed or removed the session file, chat won't work next time. #144

Open
hwiorn opened this issue Jul 11, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@hwiorn
Copy link

hwiorn commented Jul 11, 2024

Debugger entered--Lisp error: (wrong-type-argument ellama-session nil)
  signal(wrong-type-argument (ellama-session nil))
  (or (progn (and (memq (type-of session) cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session)))
  (progn (or (progn (and (memq (type-of session) cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session))) (aref session 1))
  (ellama-get-session-buffer (progn (or (progn (and (memq (type-of session) cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session))) (aref session 1)))
  (let* ((providers (append (list '("default model" . ellama-provider) (if (and ellama-ollama-binary (file-exists-p ellama-ollama-binary)) '("ollama model" ellama-get-ollama-local-model))) ellama-providers)) (variants (mapcar #'car providers)) (donecb (plist-get args :on-done)) (provider (if current-prefix-arg (progn (setq current-prefix-arg nil) (eval (alist-get (completing-read "Select model: " variants) providers nil nil #'string=))) (or (plist-get args :provider) ellama-provider))) (session (if (or create-session current-prefix-arg (and provider (or (plist-get args :provider) (not ...)) ellama--current-session-id (save-current-buffer (set-buffer ...) (not ...))) (and (not ellama--current-session) (not ellama--current-session-id))) (ellama-new-session provider prompt) (or ellama--current-session (save-current-buffer (set-buffer (ellama-get-session-buffer ellama--current-session-id)) ellama--current-session)))) (buffer (ellama-get-session-buffer (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... session))) (aref session 1)))) (file-name (progn (or (progn (and (memq ... cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session))) (aref session 3))) (translation-buffer (if ellama-chat-translation-enabled (progn (if file-name (progn (find-file-noselect ...)) (get-buffer-create (progn ... ...))))))) (if ellama-chat-translation-enabled (ellama--translate-interaction prompt translation-buffer buffer session) (display-buffer buffer) (save-current-buffer (set-buffer buffer) (save-excursion (goto-char (point-max)) (insert (ellama-get-nick-prefix-for-mode) " " ellama-user-nick ":\n" (ellama--format-context session) (ellama--fill-long-lines prompt) "\n\n" (ellama-get-nick-prefix-for-mode) " " ellama-assistant-nick ":\n") (ellama-stream prompt :session session :on-done (if donecb (list 'ellama-chat-done donecb) 'ellama-chat-done) :filter (if (derived-mode-p 'org-mode) (progn #'ellama--translate-markdown-to-org-filter)))))))
  ellama-chat("XXXXXXXXXX")
  funcall-interactively(ellama-chat "XXXXXXXXXX")
  command-execute(ellama-chat record)
  execute-extended-command(nil "ellama-chat" nil)
  funcall-interactively(execute-extended-command nil "ellama-chat" nil)
  command-execute(execute-extended-command)

The workaround is:

(setq ellama--active-sessions (make-hash-table :test #'equal)
      ellama--current-session-id nil)
@s-kostyaev
Copy link
Owner

@hwiorn Thank you. I will think how to fix it automatically in runtime.

@s-kostyaev s-kostyaev added the bug Something isn't working label Jul 11, 2024
@mberrueta
Copy link

In my case I didn't modified or deleted any file. and even if I exec

(setq ellama--active-sessions (make-hash-table :test #'equal)
      ellama--current-session-id nil)

the issue still persist

@s-kostyaev
Copy link
Owner

@mberrueta very strange. Could you please share your full ellama configuration (with replaced keys)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants