Skip to content
Open

Docs #108

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions config_examples/application_specific_commands.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# To run this do in the Julia REPL `include("path-to-file")` or simply copy paste it inside.
using JustSayIt

# 1) Define reusable commands shared by several application contexts.
base_commands = Dict(
"sentence" => Keyboard.type_sentence,
"continuation" => Keyboard.type_sentence_lowercase,
"spell" => Keyboard.type_letters,
"type summary" => LLM.type_summary,
"answer" => LLM.read_text_answer,
"followup" => LLM.read_followup,
"read this" => TTS.read,
"pause" => TTS.pause,
"stop" => TTS.stop,
)

# 2) Extend the base dictionary with browser-specific commands.
browser_commands = merge(
base_commands,
Dict(
"new tab" => (Key.ctrl, 't'),
"close tab" => (Key.ctrl, 'w'),
"jump address" => (Key.ctrl, 'l'),
"search web" => [(Key.ctrl, 'l'), Keyboard.type_lowercase, Key.enter],
),
)

# 3) Extend the base dictionary with coding-specific commands.
coding_commands = merge(
base_commands,
Dict(
"comment" => (Key.ctrl, '/'),
"format selection" => [(Key.ctrl, 'k'), (Key.ctrl, 'f')],
"workspace search" => (Key.ctrl, Key.shift, 'f'),
"jump line" => [(Key.ctrl, 'g'), Keyboard.type_digits, Key.enter],
),
)

# 4) Assemble top-level commands that activate nested application contexts.
commands = Dict(
"help" => Help.help,
"browser" => [`firefox`, browser_commands],
"coding" => [`code`, coding_commands],
)

# 5) Start JustSayIt with the application-specific command dictionaries.
start(commands=commands)
10 changes: 5 additions & 5 deletions config_examples/config_custom_function.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# To run this do in the Julia REPL `include("path-to-file")` or simply copy paste it inside.
using JustSayIt
using JustSayIt.API # Import JustSayIt API to write @voicearg functions
using JustSayIt.API # Import JustSayIt API to write @voiceargs functions
using DefaultApplication # To install type: `]` and then `add DefaultApplication`

# 1) Define a custom weather forecast search function.
Expand All @@ -15,10 +15,10 @@ weather
DefaultApplication.open("https://www.google.com/search?q=weather+$day")
end

# 2) Define command name to function mapping, calling custom function
commands = Dict("help" => Help.help,
"weather" => weather,
);
# 2) Define command name to function mapping, calling the custom function.
commands = Dict("help" => Help.help,
"weather" => weather,
)

# 3) Start JustSayIt with the custom commands.
start(commands=commands) # If you say "help weather", it will show the documentation written above in the Julia REPL.
24 changes: 24 additions & 0 deletions config_examples/jupyter_llm_commands.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# To run this do in the Julia REPL `include("path-to-file")` or simply copy paste it inside.
using JustSayIt

# 1) Define the Jupyter notebook LLM-assisted commands shown in the JuliaCon 2025 slides.
jupyter_llm_commands = Dict(
"generate magic" => () -> LLM.type_answer(
instruction_prefix="Generate the appropriate IPython magic command for the following task using proper syntax (%line magic or %%cell magic) with necessary options:"
),
"explain cell" => () -> LLM.type_text_answer_to(
"Explain what the selected cell code does in simple terms. Include key functions, algorithms, and data transformations. Format as markdown with clear section headings."
),
"parallelize code" => () -> LLM.type_text_answer_to(
"Convert the selected code to use parallel processing. Use appropriate IPython magic commands (%%px, %%parallel) and add necessary setup. Return only the parallelized code with essential comments."
),
"visualize data" => () -> LLM.type_text_answer_to(
"Generate visualization code for the selected data/variables. Choose appropriate plotting libraries and create informative visualizations. Use %matplotlib inline for display. Return only executable code."
),
)

# 2) Combine them with the top-level help command.
commands = merge(Dict("help" => Help.help), jupyter_llm_commands)

# 3) Start JustSayIt with the Jupyter notebook LLM-assisted commands.
start(commands=commands)
Loading
Loading