Skip to content

New script ollama.py: AI auto-responder using Ollama #572

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

prietus
Copy link
Contributor

@prietus prietus commented Mar 1, 2025

Single commit, single file added
Commit message: New script ollama.py: AI auto-responder using Ollama
No similar script already exists
Name: max 32 chars, only lower case letters, digits and underscores
Unique name, does not already exist in repository
No shebang on the first line
Comment in script with name/pseudo, e-mail and license
Only English in code/comments
Pure WeeChat API used, no extra API
Function hook_process is used for any blocking call
For Python script: works with Python 3 (Python 2 support is optional)
Score 100 / 100 displayed by weechat-script-lint

@flashcode
Copy link
Member

Hi,

Thank you for the script.

Before your script can be integrated, please:

  • squash all your commits in a single one
  • include in your PR description the checklist (it is displayed when you make a new PR)
  • please use hook_url (WeeChat ≥ 4.1.0) or hook_process_hashtable to fetch URL (otherwise it would block WeeChat)

@flashcode flashcode self-assigned this Mar 9, 2025
@flashcode flashcode added waiting info Waiting for info from author of issue new script New script labels Mar 9, 2025
…ess_hashtable()

feat: rework to use hook_url instead of requests

feat: non-blocking Ollama script with hook_process_hashtable, no debug logs
@@ -0,0 +1,2134 @@
0e021b6 (HEAD -> add-ollama-bot) New script ollama_bot.py: Adds non-blocking API calls using hook_process_hashtable()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this file has been committed by error, please remove it.

@@ -0,0 +1,146 @@
import weechat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add SPDX tags for copyright/license, which have been made mandatory in the meanwhile (see Contributing guide), for example:

# SPDX-FileCopyrightText: 2025 teraflops <[email protected]>                                                                                                                            
#                                                                                                                                                                                      
# SPDX-License-Identifier: MIT

- Can respond to private messages if enabled.
- Allows manual queries using the /ollama command.
- Configurable via WeeChat /set commands.
- Uses hook_url for non-blocking HTTP requests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says it uses hook_url, but hook_process_hashtable is used instead.

Using hook_url has 2 advantages:

  • it does not rely on an external curl command (which may not be available), but it still uses curl internally (linked with weechat)
  • it uses a thread instead of a process, which is more lightweight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new script New script waiting info Waiting for info from author of issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants