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

question on how to use md-roam #77

Open
randomwangran opened this issue Mar 5, 2023 · 3 comments
Open

question on how to use md-roam #77

randomwangran opened this issue Mar 5, 2023 · 3 comments

Comments

@randomwangran
Copy link

I have a file, generated by interaction with chatgpt-arcana.el .

The file name is: 2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md

------- system:

You are a large language model living inside Emacs, and an excellent conversation partner. Respond concisely.  Current Emacs major mode: chatgpt-arcana-chat-mode. Respond in well-formatted markdown, with headers, tables, lists, and so on.

------- user:

who are you?

------- assistant:

# Introduction

I am a large language model living inside Emacs, designed to engage in conversation and assist you with a variety of tasks. Whether you need help with coding, or writing, or simply want to chat, I am here to help!

# About Me

As an AI language model, I am constantly learning and evolving based on the input I receive from users like you. I am designed to understand and generate natural language, and I can help with a wide range of tasks, including:

- Answering questions
- Generating text
- Providing suggestions and recommendations
- And much more!

# How to Use Me

To use me, simply activate chatgpt-arcana-chat-mode in your Emacs buffer, and start typing. I will respond to your messages and provide suggestions and feedback as needed. If you need assistance or have any questions, simply ask and I will do my best to help!

I would like to use md-roam as connector to Org-roam, so that I can use it to index all the conversions with ai.com.

I installed md-roam with following setup:

(require 'org-roam)
(setq org-roam-directory (file-truename "path/to/org-roam-directory")) 
;; file-truename is optional; it seems required when you use symbolic
;; links, which Org-roam does not resolve
(setq org-roam-file-extensions '("org" "md")) ; enable Org-roam for a markdown extension
(add-to-list 'load-path "path/to/md-roam") ; installation as above
(require 'md-roam)
(md-roam-mode 1) ; md-roam-mode must be active before org-roam-db-sync
(setq md-roam-file-extension "md") ; default "md". Specify an extension such as "markdown"
(org-roam-db-autosync-mode 1) ; autosync-mode triggers db-sync. md-roam-mode must be already active

Then force change the font matter as:

title: Guide to Markdown Mode for Emacs
id: 2021-11--7T185856
category: \#markdown
------- system:

Nothing happens, the file name is like:
2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md, so maybe that is the issue?

Do you have any suggestions on how mark-down file should be called and store? The file is generated in this snippet:

https://github.com/CarlQLange/chatgpt-arcana.el/blob/9d35495b1dbbe9a6a9b82ab732a8b1bc33fac6e1/chatgpt-arcana.el#L95-L109

@nobiot
Copy link
Owner

nobiot commented Mar 6, 2023

You need a yaml frontmatter on top of the file. The first line must be “---“ (three hyphens). And close the front matter with “---“ (three hyphens).

@randomwangran
Copy link
Author

Thanks for sharing it.

After adding this info, I still can not find it via org-roam-node-find. Here's how I do it:

  1. Turn off org-roam-db-autosync-mode
  2. Switch to 2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md
  3. Modify the buffer and save the change.
  4. M-x org-roam-node-find
  5. There is no Guide to Markdown Mode for Emacs
---
title: Guide to Markdown Mode for Emacs
id: 2021-11--7T185856
category: \#markdown
---

------- system:

You are a large language model living inside Emacs, and an excellent conversation partner. Respond concisely.  Current Emacs major mode: chatgpt-arcana-chat-mode. Respond in well-formatted markdown, with headers, tables, lists, and so on.

------- user:

who are you?

@nobiot
Copy link
Owner

nobiot commented Mar 6, 2023

  • Turn off org-roam-db-autosync-mode
  • Switch to 2023-03-05-12-33-51-emacs-chatgpt-arcana-chat-mode-introduction-and-description.chatgpt-arcana.md
  • Modify the buffer and save the change.

Kill the markdown buffer first. org-roam-db-autosync-mode adds find-file hook for the function to register the current node into the database. If the buffer is already open, no matter what you do to it won’t go into the database. Therefore, combined with md-roam, the sequence must be like this:

  1. Ensure the markdown buffer (note) is not open. If it is, kill it
  2. Activate md-roam-mode
  3. Activate org-roam-db-autosunc-mode
  4. Find-file and open the markdown buffer (this way, find-file hook adds some functions to after-save-hook — have a look)
  5. Modify the markdown buffer and save

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

2 participants