cheshire-cat-ai / docs

Documentation for the Cheshire Cat AI
https://cheshire-cat-ai.github.io/docs/
33 stars 28 forks source link

Available hooks table #93

Closed nicola-corbellini closed 8 months ago

nicola-corbellini commented 8 months ago

This PR adds a section to list all the available hooks with a short description. For each hook, an annotation display the most essential information: the input arguments, a practical example and additional links.

Try to solve #36 and #90

For anybody willing to contribute

If you want to help documenting the hooks, please ensure these elements are not missing:

  1. Annotation number with bold heading
  2. Input arguments description with code snippet
  3. collapsible snippet example (??? example)
  4. optional: any other warning box/additional info for tips, tricks and discouraged behaviors
  5. collapsible note section with title: ??? note "Other resources" --> in this section please include the link to the hook Python reference in the documentation and any other useful links to other doc's pages.

Example

1. **Input arguments**  
        `user_message_json`, i.e. the JSON message sent via WebSocket done like this:  
        ```JSON
        {
            "text": # user's message here
        }
    ??? example

        ```python
        from cat.mad_hatter.decorators import hook

        @hook  # default priority = 1 
        def before_cat_reads_message(user_message_json, cat):
            user_message_json["text"] = "The original message has been replaced"
            cat.working_memory["hacked"] = True

            return user_message_json
        ```

    ??? note "Other resources"

        - [Python reference]()


### Rendered doc
![immagine](https://github.com/cheshire-cat-ai/docs/assets/67009524/9f641cb0-3a04-4eb0-9c72-ff2f47fdeae8)
![immagine](https://github.com/cheshire-cat-ai/docs/assets/67009524/fa0c0df2-a8e9-4227-89ab-23341ae6f15d)