diff --git a/my-labai.el b/my-labai.el index b81ab85..31e9ba3 100644 --- a/my-labai.el +++ b/my-labai.el @@ -9,35 +9,64 @@ ;; configuration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defvar lab-ai-url - "https://amorphous.tf.chiba-u.jp/lab-ai/chat") +(defgroup lab-ai nil + "Lab-AI client." + :group 'applications) -(defvar lab-ai-image-url - "https://amorphous.tf.chiba-u.jp/lab-ai/image") +(defconst lab-ai-url + "https://amorphous.tf.chiba-u.jp/lab-ai/chat" + "Lab-AI chat endpoint.") -(defvar lab-ai-image-edit-url - "https://amorphous.tf.chiba-u.jp/lab-ai/image-edit") +(defconst lab-ai-image-url + "https://amorphous.tf.chiba-u.jp/lab-ai/image" + "Lab-AI image generation endpoint.") -(defvar lab-ai-image-size - "1024x1024") +(defconst lab-ai-image-edit-url + "https://amorphous.tf.chiba-u.jp/lab-ai/image-edit" + "Lab-AI image editing endpoint.") +(defconst lab-ai-supported-models + '("gpt-5.6-luna" + "gpt-5.6-terra" + "gpt-5.6-sol") + "Models supported by the Lab-AI gateway.") -(defvar lab-ai-models - '("gpt-5-mini" - "gpt-5" - "gpt-5.5")) +(defcustom lab-ai-model + "gpt-5.6-terra" + "Default model used by Lab-AI." + :type '(choice + (const :tag "GPT-5.6 Luna" "gpt-5.6-luna") + (const :tag "GPT-5.6 Terra" "gpt-5.6-terra") + (const :tag "GPT-5.6 Sol" "gpt-5.6-sol")) + :group 'lab-ai) -(defvar lab-ai-model - "gpt-5.5") +(defcustom lab-ai-image-size + "1024x1024" + "Default image size used by Lab-AI." + :type '(choice + (const "1024x1024") + (const "1024x1536") + (const "1536x1024")) + :group 'lab-ai) -(defvar lab-ai-timeout - "600") +(defcustom lab-ai-timeout + "600" + "Timeout in seconds passed to curl." + :type 'string + :group 'lab-ai) -(defvar lab-ai-max-attachment-size - (* 50 1024 1024)) +(defcustom lab-ai-max-attachment-size + (* 5 1024 1024) + "Maximum attachment size in bytes." + :type 'integer + :group 'lab-ai) + +(defcustom lab-ai-chat-history-max-messages + 200 + "Maximum number of chat history messages." + :type 'integer + :group 'lab-ai) -(defvar lab-ai-chat-history-max-messages - 200) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; API @@ -510,6 +539,8 @@ Run again to clear previews." #'lab-ai-chat-clear-attachments) (define-key map (kbd "C-c C-h") #'lab-ai-chat-clear-history) + (define-key map (kbd "C-c C-m") + #'lab-ai-switch-model) map)) @@ -885,13 +916,16 @@ Run again to clear previews." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun lab-ai-show-model () + (interactive) + (message "Lab-AI model: %s" lab-ai-model)) (defun lab-ai-switch-model () (interactive) (setq lab-ai-model (completing-read "Model: " - lab-ai-models + lab-ai-supported-models nil t lab-ai-model)) (when (get-buffer lab-ai-chat-buffer) @@ -899,9 +933,6 @@ Run again to clear previews." (lab-ai-chat-update-mode-line))) (message "lab-ai model => %s" lab-ai-model)) -(defun lab-ai-show-model () - (interactive) - (message "Lab-AI model: %s" lab-ai-model)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Keys