Closed hatbary closed 1 week ago
Can you enable debug on error and give me a backtrace ?
You have a 401 error, Unauthorized.
I’m trying emacs on window… and tell you if I have the same problem.
It worked fine for me.
I installed doom emacs and curl, added
(package! copilot-chat
:recipe (:host github :repo "chep/copilot-chat.el" :files ("*.el")))
in packages.el, started doom sync
, restarted emacs, M-x copilot-chat-display
, typed "Hello", C-c RET
.
It then told me that the code for github was in clipboard, I pressed RET, my browser automatically opened github, C-c
to paste the code, clicked on auth button, back to emacs, press RET and copilot answered me.
[23:57:46] Hello! How can I assist you with your coding today? If you have any code you'd like to discuss or any questions about programming, feel free to share!
Dear Chep.
Thank you very much for your immediate and kind response.
I've tried instructions which you proposed but it still failed.
Please find the backtrace of 1st error as follows:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-replace("\0" "\\0" nil)
w32--set-selection(CLIPBOARD nil)
#f(compiled-function (type value) #<bytecode -0x17ee55a977e88e18>)(CLIPBOARD nil)
apply(#f(compiled-function (type value) #<bytecode -0x17ee55a977e88e18>) (CLIPBOARD nil))
gui-backend-set-selection(CLIPBOARD nil)
gui-set-selection(CLIPBOARD nil)
(let ((device-code (alist-get 'device_code data)) (user-code (alist-get 'user_code data)) (verification-uri (alist-get 'verification_uri data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(("content-type" . "application/json") ("accept" . "application/json") ("accept-encoding" . "gzip,deflate,br") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0") ("user-agent" . "CopilotChat.nvim/2.0.0")) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car ...)) (data (car ...))) (progn (if (= ... 200) nil (error "http error")) (let (... ...) (progn ... ...) (if ... ...) (let ... ...)))))))
(progn (if (= (progn (or (progn (and (memq ... cl-struct-request-response-tags) t)) (signal 'wrong-type-argument (list 'request-response response))) (aref response 1)) 200) nil (error "http error")) (let ((device-code (alist-get 'device_code data)) (user-code (alist-get 'user_code data)) (verification-uri (alist-get 'verification_uri data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(("content-type" . "application/json") ("accept" . "application/json") ("accept-encoding" . "gzip,deflate,br") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0") ("user-agent" . "CopilotChat.nvim/2.0.0")) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response ...) (data ...)) (progn (if ... nil ...) (let ... ... ... ...)))))))
(let* ((response (car (cdr (plist-member --cl-rest-- ':response)))) (data (car (cdr (plist-member --cl-rest-- ':data))))) (progn (if (= (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... response))) (aref response 1)) 200) nil (error "http error")) (let ((device-code (alist-get 'device_code data)) (user-code (alist-get 'user_code data)) (verification-uri (alist-get 'verification_uri data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(("content-type" . "application/json") ("accept" . "application/json") ("accept-encoding" . "gzip,deflate,br") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0") ("user-agent" . "CopilotChat.nvim/2.0.0")) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* (... ...) (progn ... ...)))))))
(closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ...)))) (data (car (cdr (plist-member --cl-rest-- ...))))) (progn (if (= (progn (or ... ...) (aref response 1)) 200) nil (error "http error")) (let ((device-code (alist-get ... data)) (user-code (alist-get ... data)) (verification-uri (alist-get ... data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(... ... ... ... ... ...) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda ... "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" ...))))))(:data nil :symbol-status parse-error :error-thrown (json-readtable-error 31) :response #s(request-response :status-code 200 :history nil :data nil :error-thrown (json-readtable-error 31) :symbol-status parse-error :url https://github.com/login/device/code :done-p nil :settings (:type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car ...)) (data (car ...))) (progn (if (= ... 200) nil (error "http error")) (let (... ... ...) (gui-set-selection ... user-code) (read-from-minibuffer ...) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers ... :data ... :parser ... :sync t :complete ...))))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #8 :encoding utf-8) :-buffer #<killed buffer> :-raw-header "HTTP/1.1 200 OK\nServer: GitHub.com\nDate: Wed, 28 A..." :-timer nil :-backend curl))
apply((closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ...)))) (data (car (cdr (plist-member --cl-rest-- ...))))) (progn (if (= (progn (or ... ...) (aref response 1)) 200) nil (error "http error")) (let ((device-code (alist-get ... data)) (user-code (alist-get ... data)) (verification-uri (alist-get ... data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(... ... ... ... ... ...) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda ... "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" ...)))))) (:data nil :symbol-status parse-error :error-thrown (json-readtable-error 31) :response #s(request-response :status-code 200 :history nil :data nil :error-thrown (json-readtable-error 31) :symbol-status parse-error :url https://github.com/login/device/code :done-p nil :settings (:type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response ...) (data ...)) (progn (if ... nil ...) (let ... ... ... ... ... ...)))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #10 :encoding utf-8) :-buffer #<killed buffer> :-raw-header "HTTP/1.1 200 OK\nServer: GitHub.com\nDate: Wed, 28 A..." :-timer nil :-backend curl)))
request--callback(#<killed buffer> :type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ...)))) (data (car (cdr (plist-member --cl-rest-- ...))))) (progn (if (= (progn (or ... ...) (aref response 1)) 200) nil (error "http error")) (let ((device-code (alist-get ... data)) (user-code (alist-get ... data)) (verification-uri (alist-get ... data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(... ... ... ... ... ...) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda ... "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" ...)))))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #s(request-response :status-code 200 :history nil :data nil :error-thrown (json-readtable-error 31) :symbol-status parse-error :url https://github.com/login/device/code :done-p nil :settings (:type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car ...)) (data (car ...))) (progn (if (= ... 200) nil (error "http error")) (let (... ... ...) (gui-set-selection ... user-code) (read-from-minibuffer ...) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers ... :data ... :parser ... :sync t :complete ...))))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #19 :encoding utf-8) :-buffer #<killed buffer> :-raw-header "HTTP/1.1 200 OK\nServer: GitHub.com\nDate: Wed, 28 A..." :-timer nil :-backend curl) :encoding utf-8)
apply(request--callback #<killed buffer> (:type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr ...))) (data (car (cdr ...)))) (progn (if (= (progn ... ...) 200) nil (error "http error")) (let ((device-code ...) (user-code ...) (verification-uri ...)) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '... :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'...))))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #s(request-response :status-code 200 :history nil :data nil :error-thrown (json-readtable-error 31) :symbol-status parse-error :url https://github.com/login/device/code :done-p nil :settings #3 :-buffer #<killed buffer> :-raw-header "HTTP/1.1 200 OK\nServer: GitHub.com\nDate: Wed, 28 A..." :-timer nil :-backend curl) :encoding utf-8))
request--curl-callback("https://github.com/login/device/code" #<process request curl> "finished\n")
apply(request--curl-callback ("https://github.com/login/device/code" #<process request curl> "finished\n"))
#f(compiled-function (&rest args2) #<bytecode 0xb738668a88bfac5>)(#<process request curl> "finished\n")
apply(#f(compiled-function (&rest args2) #<bytecode 0xb738668a88bfac5>) (#<process request curl> "finished\n"))
#f(compiled-function (&rest args) #<bytecode 0x12809ea194ab458d>)(#<process request curl> "finished\n")
accept-process-output(nil 0.05)
request--curl-sync("https://github.com/login/device/code" :type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ...)))) (data (car (cdr (plist-member --cl-rest-- ...))))) (progn (if (= (progn (or ... ...) (aref response 1)) 200) nil (error "http error")) (let ((device-code (alist-get ... data)) (user-code (alist-get ... data)) (verification-uri (alist-get ... data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(... ... ... ... ... ...) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda ... "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" ...)))))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #s(request-response :status-code 200 :history nil :data nil :error-thrown (json-readtable-error 31) :symbol-status parse-error :url https://github.com/login/device/code :done-p nil :settings (:type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car ...)) (data (car ...))) (progn (if (= ... 200) nil (error "http error")) (let (... ... ...) (gui-set-selection ... user-code) (read-from-minibuffer ...) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers ... :data ... :parser ... :sync t :complete ...))))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #19 :encoding utf-8) :-buffer #<killed buffer> :-raw-header "HTTP/1.1 200 OK\nServer: GitHub.com\nDate: Wed, 28 A..." :-timer nil :-backend curl) :encoding utf-8)
apply(request--curl-sync "https://github.com/login/device/code" (:type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr ...))) (data (car (cdr ...)))) (progn (if (= (progn ... ...) 200) nil (error "http error")) (let ((device-code ...) (user-code ...) (verification-uri ...)) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '... :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'...))))) :error #f(compiled-function (&rest rest) #<bytecode 0x96084206feb7702>) :url "https://github.com/login/device/code" :response #s(request-response :status-code 200 :history nil :data nil :error-thrown (json-readtable-error 31) :symbol-status parse-error :url https://github.com/login/device/code :done-p nil :settings #3 :-buffer #<killed buffer> :-raw-header "HTTP/1.1 200 OK\nServer: GitHub.com\nDate: Wed, 28 A..." :-timer nil :-backend curl) :encoding utf-8))
request("https://github.com/login/device/code" :type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:..." :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("accept-encoding" . "gzip,deflate,br") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (closure (cl-struct-copilot-chat-tags t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ...)))) (data (car (cdr (plist-member --cl-rest-- ...))))) (progn (if (= (progn (or ... ...) (aref response 1)) 200) nil (error "http error")) (let ((device-code (alist-get ... data)) (user-code (alist-get ... data)) (verification-uri (alist-get ... data))) (gui-set-selection 'CLIPBOARD user-code) (read-from-minibuffer (format "Your one-time code %s is copied. Press ENTER to op..." user-code verification-uri)) (browse-url verification-uri) (read-from-minibuffer "Press ENTER after authorizing.") (request "https://github.com/login/oauth/access_token" :type "POST" :headers '(... ... ... ... ... ...) :data (format "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"device_code\":..." device-code) :parser 'json-read :sync t :complete #'(lambda ... "\n\n(fn &key RESPONSE &key DATA &allow-other-keys)" ...)))))))
copilot-chat--login()
(progn (copilot-chat--login))
(if (null (progn (or (progn (and (memq (type-of copilot-chat--instance) cl-struct-copilot-chat-tags) t)) (signal 'wrong-type-argument (list 'copilot-chat copilot-chat--instance))) (aref copilot-chat--instance 2))) (progn (copilot-chat--login)))
copilot-chat--auth(copilot-chat--curl-ask-cb ("Hello" copilot-chat-prompt-cb))
(if copilot-chat-use-curl (copilot-chat--auth 'copilot-chat--curl-ask-cb (list prompt callback)) (copilot-chat--auth 'copilot-chat--ask-cb (list prompt callback)))
(let* ((history (progn (or (progn (and (memq ... cl-struct-copilot-chat-tags) t)) (signal 'wrong-type-argument (list 'copilot-chat copilot-chat--instance))) (aref copilot-chat--instance 7))) (new-history (cons (list prompt "user") history))) (if copilot-chat-use-curl (copilot-chat--auth 'copilot-chat--curl-ask-cb (list prompt callback)) (copilot-chat--auth 'copilot-chat--ask-cb (list prompt callback))) (progn (or (progn (and (memq (type-of copilot-chat--instance) cl-struct-copilot-chat-tags) t)) (signal 'wrong-type-argument (list 'copilot-chat copilot-chat--instance))) (let* ((v copilot-chat--instance)) (aset v 7 new-history))))
copilot-chat--ask("Hello" copilot-chat-prompt-cb)
(let ((prompt (buffer-substring-no-properties (point-min) (point-max)))) (erase-buffer) (copilot-chat--write-buffer (copilot-chat--format-data prompt 'prompt)) (setq copilot-chat--prompt-history (cons prompt copilot-chat--prompt-history)) (setq copilot-chat--prompt-history-position nil) (copilot-chat--ask prompt 'copilot-chat-prompt-cb))
(save-current-buffer (set-buffer copilot-chat-prompt-buffer) (let ((prompt (buffer-substring-no-properties (point-min) (point-max)))) (erase-buffer) (copilot-chat--write-buffer (copilot-chat--format-data prompt 'prompt)) (setq copilot-chat--prompt-history (cons prompt copilot-chat--prompt-history)) (setq copilot-chat--prompt-history-position nil) (copilot-chat--ask prompt 'copilot-chat-prompt-cb)))
copilot-chat-prompt-send()
funcall-interactively(copilot-chat-prompt-send)
command-execute(copilot-chat-prompt-send)
PS, I cannot get the idea how to get the backtrace of 2nd error( for example, [error] request--callback: peculiar error: 401
)
Do you need a proxy to access the web?
Do you need a proxy to access the web?
No, I don't. I can access the web without any proxy even though I'm working under company network environment.
FYI, the authentication is successful when using https://github.com/copilot-emacs/copilot.el. Therefore, I didn't address the network problem.
Please let me know any further information you need.
Thank you again for your immediate and kind help.
Please give me the result of this command:
curl -X POST -d "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:user\"}" -H "content-type: application/json" -H "accept: application/json" -H "editor-plugin-version: CopilotChat.nvim/2.0.0" -H "user-agent: CopilotChat.nvim/2.0.0" -H "editor-version: Neovim/0.10.0" https://github.com/login/device/code
And the result of this emacs lisp code :
(request "https://github.com/login/device/code"
:type "POST"
:data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:user\"}"
:sync t
:headers `(("content-type" . "application/json")
("accept" . "application/json")
("editor-plugin-version" . "CopilotChat.nvim/2.0.0")
("user-agent" . "CopilotChat.nvim/2.0.0")
("editor-version" . "Neovim/0.10.0"))
:parser 'json-read
:complete (cl-function (lambda (&key response &key data &allow-other-keys)
(print data t))))
You can find the result in *Messages*
buffer.
If you wait for 15 minutes before posting the results, given code should be expired.
@chep
Thanks for your feedback.
Please find test results as follows:
$ curl -X POST -d "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:user\"}" -H "content-type: application/json" -H "accept: application/json" -H "editor-plugin-version: CopilotChat.nvim/2.0.0" -H "user-agent: CopilotChat.nvim/2.0.0" -H "editor-version: Neovim/0.10.0" https://github.com/login/device/code
{"device_code":"22201839379ef5a534e6d13047aff54ce25dd6a0","user_code":"71B2-9E53","verification_uri":"https://github.com/login/device","expires_in":899,"interval":5}
((device_code . "7a41ae523493e2bc3e4946fe8d6d970e3fa6c6f6") (user_code . "AEF2-A746") (verification_uri . "https://github.com/login/device") (expires_in . 899) (interval . 5))
#s(request-response 200 nil ((device_code . "7a41ae523493e2bc3e4946fe8d6d970e3fa6c6f6") (user_code . "AEF2-A746") (verification_uri . "https://github.com/login/device") (expires_in . 899) (interval . 5)) nil success https://github.com/login/device/code t (:type "POST" :data "{\"client_id\":\"Iv1.b507a08c87ecfe98\",\"scope\":\"read:user\"}" :sync t :headers (("content-type" . "application/json") ("accept" . "application/json") ("editor-plugin-version" . "CopilotChat.nvim/2.0.0") ("user-agent" . "CopilotChat.nvim/2.0.0") ("editor-version" . "Neovim/0.10.0")) :parser json-read :complete (lambda (&rest --cl-rest--) "
(fn &key RESPONSE &key DATA &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ':response)))) (data (car (cdr (plist-member --cl-rest-- ':data))))) (print data t))) :error #[128 " \"A@ ! !
!]X H\0
##X <\0r !q db * X F\0 \" " [("https://github.com/login/device/code") request-log-level request-message-level request-log-buffer-name buffer-read-only inhibit-read-only plist-member :symbol-status #[257 " \0 A \0 " [request--log-level-def 0] 3 "
(fn LEVEL)"] error format "[%s] %s" "request-default-error-callback: %s %s" get-buffer-create t "
" message "%s"] 14 "
(fn &rest ARGS &key SYMBOL-STATUS &allow-other-keys)"] :url "https://github.com/login/device/code" :response #0 :encoding utf-8) #<killed buffer> "HTTP/1.1 200 OK
Server: GitHub.com
Date: Tue, 03 Sep 2024 07:01:38 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame
ETag: W/\"1de9bc7f6f74c5de2e2f3948e874ad95\"
Cache-Control: max-age=0, private, must-revalidate
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ github.com/webpack/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com api.githubcopilot.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com/v1/engines/github-completion/completions proxy.enterprise.githubcopilot.com/v1/engines/github-completion/completions *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ github.com/webpack/ github.com/assets/ gist.github.com/assets-cdn/worker/
Vary: Accept-Encoding, Accept, X-Requested-With
X-GitHub-Request-Id: 28B2:3FBB8A:5D7194:6A16A3:66D6B452
" nil curl)
Thanks
Can you try this branch: https://github.com/chep/copilot-chat.el/tree/21-authentication ? Thanks
@chep
Can you try this branch: https://github.com/chep/copilot-chat.el/tree/21-authentication ? Thanks
Super great !! It works now:
I've configured as follows:
(package! copilot-chat
:recipe (:host github :repo "chep/copilot-chat.el"
:branch "21-authentication"
:files ("*.el")))
@chep
I appreciate for your kind help and immediate response.
I've closed this issue because I can confirm it works.
If you need to track this topic in order to integrate master
branch, please feel free to reopen this or let me know.
Thank you again.
Dear Chep.
As per the README.md, the token-related files are generated by specified instruction.
However, in my case, the specified instruction is not introduced with following errors:
Therefore, I cannot access
copilot-chat
services.Could you please help me fix this problem?
FYI, I'm using Doom Emacs 29.3 on Windows 10. Also, when I use the
copilot.el
, the authentication works fine. Thenpm
andcurl
are installed and on the system PATH.Many thanks in advance.