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

[FEATURE] Configurable AI response timeout. #3231

Closed
BritishTeapot opened this issue Feb 10, 2025 · 6 comments
Closed

[FEATURE] Configurable AI response timeout. #3231

BritishTeapot opened this issue Feb 10, 2025 · 6 comments
Labels

Comments

@BritishTeapot
Copy link

Is your feature request related to a problem? Please describe.

I am using llama.cpp to host my local AI, or use AI horde. So, logically, I have tried linking it with QOwnNotes. However, my computer isn't exactly fast. So, 90% of the time I use any of the AI features, it triggers the timeout and my request gets rejected.

Describe the solution you'd like

Ability to configure the AI response timeout.

Describe alternatives you've considered

I can't think of any possible alternative.

Output from the debug section in the settings dialog

Expand QOwnNotes Debug Information ===========================

General Info

Current Date: Mon Feb 10 19:33:14 2025
Version: 25.2.3
Build date: Feb 7 2025
Build number: 1161
Platform: linux (wayland)
Operating System: KDE Flatpak runtime
Build architecture: x86_64
Current architecture: x86_64
Release: GitHub
Qt Version (build): 6.8.2
Qt Version (runtime): 6.8.2
Portable mode: no
Settings path / key: /home/fedir/.var/app/org.qownnotes.QOwnNotes/config/PBE/QOwnNotes.conf
Application database path: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/QOwnNotes.sqlite
Application arguments: /app/bin/QOwnNotes, QOwnNotes, --allow-multiple-instances
Qt Debug: 0
Locale (system): en_GB
Locale (interface): empty
Primary screen resolution: 1920x1080
Icon theme: breeze-dark-qownnotes
Notes in current note folder: 80
Calendar items: 0
Enabled scripts: 5
Database drivers: QSQLITE

Server Info

serverUrl: empty
appIsValid: yes
notesPathExists: empty
serverVersion: empty
appVersion: empty

Spellchecking

Enabled: true
Selected language: auto
Language codes: en_AU, en_BS, en_BZ, en_CA, en_GB, en_GH, en_IE, en_IL, en_IN, en_JM, en_MW, en_NA, en_NZ, en_PH, en_TT, en_US, en_ZA, en_ZW, sk_SK
Language names: Australian English (Australia), English (Bahamas), English (Belize), Canadian English (Canada), British English (United Kingdom), English (Ghana), English (Ireland), English (Israel), English (India), English (Jamaica), English (Malawi), English (Namibia), English (New Zealand), English (Philippines), English (Trinidad & Tobago), American English (United States), English (South Africa), English (Zimbabwe), slovenčina (Slovensko)
Application dictionaries path: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/dicts

Note folders

currentNoteFolderId: 1

Note folder default

id: 1
isCurrent: yes
activeTagId: -1
localPath: /home/fedir/Shared
remotePath: Notes
cloudConnectionId: 1
isShowSubfolders: yes
isUseGit: no
allowDifferentNoteFileName: yes
activeNoteSubFolder name: empty
database file: /home/fedir/Shared/notes.sqlite

Cloud connections

Cloud connection Default

id: 1
isCurrent: yes
serverUrl: empty
username: empty
accountId: empty

Enabled scripts

Script llama.cpp AI backend integration

id: 1
path: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/scripts/llama-cpp-integration/llama-cpp-integration.qml
variablesJson:

{
    "baseUrl": "http://localhost:5000/api",
    "models": "koboldcpp/gemma-2-2b-it-abliterated-Q8_0"
}

identifier: llama-cpp-integration
version: 0.0.2
minAppVersion: 24.6.3

Script AI Autocompletion

id: 2
path: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/scripts/ai-autocompletion/ai-autocompletion.qml
variablesJson:

{
}

identifier: ai-autocompletion
version: 0.0.1
minAppVersion: 24.5.3

Script AI Command

id: 3
path: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/scripts/ai-command/ai-command.qml
variablesJson:

{
}

identifier: ai-command
version: 0.1.1
minAppVersion: 24.11.4

Script AI Text Tool

id: 4
path: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/scripts/ai-text-tool/ai-text-tool.qml
variablesJson:

{
}

identifier: ai-text-tool
version: 0.2.0
minAppVersion: 24.11.4

Script Ollama AI backend integration

id: 5
path: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data/PBE/QOwnNotes/scripts/ollama-integration/ollama-integration.qml
variablesJson:

{
    "apiBaseUrl": "http://127.0.0.1:5000",
    "models": "llama3,gemma:2b"
}

identifier: ollama-integration
version: 0.1.3
minAppVersion: 24.6.3

Settings

ActiveNoteHistoryItem (NoteHistoryItem): <binary data>
Debug/fakeOldVersionNumber (bool): false
Debug/fileLogging (bool): false
DistractionFreeMode/isEnabled (QString): false
DistractionFreeMode/menuBarGeometry (QByteArray): <binary data>
DistractionFreeMode/menuBarHeight (QString): 28
DistractionFreeMode/menuBarVisible (QString): true
DistractionFreeMode/windowState (QByteArray): <binary data>
Editor/CurrentSchemaKey (QString): EditorColorSchema-cdbf28fc-1ddc-4d13-bb21-6a4043316a2f
Editor/autoBracketClosing (bool): true
Editor/autoBracketRemoval (bool): true
Editor/disableCursorBlinking (bool): false
Editor/editorWidthInDFMOnly (bool): true
Editor/highlightCurrentLine (bool): true
Editor/indentSize (int): 4
Editor/removeTrailingSpaces (bool): false
Editor/showLineNumbers (bool): false
Editor/useTabIndent (bool): false
Editor/vimMode (bool): false
LastUpdateCheck (QDateTime): 2025-02-10T19:32:52.876
MainWindow/geometry (QByteArray): <binary data>
MainWindow/mainToolBar.iconSize (int): 24
MainWindow/menuBarGeometry (QByteArray): <binary data>
MainWindow/noteTextEdit.code.font (QString): 0xProto,13,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextEdit.font (QString): 0xProto,13,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextView.code.font (QString): monospace,11,-1,5,400,0,0,0,1,0,0,0,0,0,0,1
MainWindow/noteTextView.font (QString): monospace,11,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextView.ignoreCodeFontSize (bool): true
MainWindow/noteTextView.refreshDebounceTime (int): 600
MainWindow/noteTextView.rtl (bool): false
MainWindow/noteTextView.underline (bool): false
MainWindow/noteTextView.useEditorStyles (bool): true
MainWindow/noteTextView.useInternalExportStyling (bool): true
MessageBoxOverride/linux-dark-mode (QString): 16384
NoteFolder-1/NoteTabNameList (QStringList): journal
NoteFolder-1/NoteTabStickinessList (QStringList): empty
NoteFolder-1/NoteTabSubFolderPathDataList (QStringList): empty
NoteFolder-1/allowDifferentNoteFileName (bool): true
NoteHistory-1 (QVariantList): <variant list with 18 item(s)>
NoteHistoryCurrentIndex-1 (int): 17
PiwikClientId (QString): <hidden>
ScriptRepositoryDialog/geometry (QByteArray): <binary data>
ScriptRepositoryDialog/mainSplitterState (QByteArray): <binary data>
SearchEngineId (int): 2
SettingsDialog/geometry (QByteArray): <binary data>
SettingsDialog/mainSplitterState (QByteArray): <binary data>
Shortcuts/MainWindow-customAction_run-ai-command (QKeySequence): empty
Shortcuts/MainWindow-customAction_run-ai-text-tool (QKeySequence): empty
ShowSystemTray (bool): false
StartHidden (bool): false
TextDiffDialog/geometry (QByteArray): <binary data>
WelcomeDialog/geometry (QByteArray): <binary data>
acceptAllExternalModifications (bool): false
ai/currentBackend (QString): llama-cpp
ai/enabled (bool): true
ai/groq/apiKey (QString): <hidden>
ai/groq/currentModel (QString): deepseek-r1-distill-llama-70b
ai/llama-cpp/currentModel (QString): koboldcpp/gemma-2-2b-it-abliterated-Q8_0
ai/openai/apiKey (QString): <hidden>
allowNoteEditing (bool): true
allowOnlyOneAppInstance (bool): true
appMetrics/disableAppHeartbeat (bool): false
appMetrics/disableTracking (bool): false
appMetrics/notificationShown (QString): true
autoReadOnlyMode (bool): false
autoReadOnlyModeTimeout (int): 30
automaticNoteFolderDatabaseClosing (bool): false
checkSpelling (bool): true
closeTodoListAfterSave (bool): false
cryptoKey (QString): <hidden>
currentNoteFolderId (QString): 1
currentWorkspace (QString): initial
cursorWidth (int): 1
darkMode (bool): true
darkModeColors (bool): true
darkModeIconTheme (bool): true
darkModeTrayIcon (bool): true
defaultNoteFileExtension (QString): md
disableAutomaticUpdateDialog (bool): true
disableSavedSearchesAutoCompletion (bool): false
dockWasInitializedOnce (QString): true
enableNoteTree (bool): false
enableSocketServer (bool): false
enableWebAppSupport (bool): false
externalEditorPath (QString): empty
fullyHighlightedBlockquotes (bool): false
gitCommitInterval (int): 30
gitExecutablePath (QString): empty
gitLogCommand (QString): empty
guiFirstRunInit (bool): true
ignoreAllExternalModifications (bool): false
ignoreAllExternalNoteFolderChanges (bool): false
ignoreNoteSubFolders (QString): ^\.
ignoredNoteFiles (QString): empty
imageScaleDown (bool): false
imageScaleDownMaximumHeight (int): 1024
imageScaleDownMaximumWidth (int): 1024
initialLayoutIdentifier (QString): full
insertTimeFormat (QString): empty
interfaceFontSize (int): 18
interfaceLanguage (QString): empty
interfaceStyle (QString): Adwaita-Dark
internalIconTheme (bool): false
itemHeight (int): 18
legacyLinking (bool): false
localTrash/autoCleanupDays (int): 30
localTrash/autoCleanupEnabled (bool): true
localTrash/supportEnabled (bool): true
markdownHighlightingEnabled (bool): true
maxNoteFileSize (int): 1048576
navigationPanelAutoSelect (bool): true
navigationPanelHideSearch (bool): false
networking/ignoreSSLErrors (bool): true
networking/proxyType (int): 2
newNoteAskHeadline (bool): false
noteEditIsCentralWidget (bool): true
noteFileExtensionList (QStringList): md, txt
noteListPreview (bool): false
noteSaveIntervalTime (int): 10
noteSubfoldersPanelDisplayAsFullTree (bool): false
noteSubfoldersPanelHideSearch (bool): false
noteSubfoldersPanelOrder (int): 0
noteSubfoldersPanelShowFullPath (bool): false
noteSubfoldersPanelShowNotesRecursively (bool): false
noteSubfoldersPanelShowRootFolderName (bool): false
noteSubfoldersPanelSort (int): 0
noteSubfoldersPanelTabsUnsetAllNotesSelection (bool): false
notesPanelOrder (int): 0
notesPanelSort (int): 1
notesPath (QString): /home/fedir/Shared
notifyAllExternalModifications (bool): false
overrideInterfaceFontSize (bool): false
ownCloud/supportEnabled (bool): false
ownCloud/todoCalendarBackend (int): 3
ownCloud/todoCalendarCalDAVPassword (QString): <hidden>
ownCloud/todoCalendarCalDAVServerUrl (QString): empty
ownCloud/todoCalendarCalDAVUsername (QString): empty
ownCloud/todoCalendarCloudConnectionId (int): 1
ownCloud/todoCalendarDisplayNameList (QStringList): empty
ownCloud/todoCalendarEnabledList (QStringList): empty
ownCloud/todoCalendarEnabledUrlList (QStringList): empty
ownCloud/todoCalendarUrlList (QStringList): empty
ownCloudInfo/appIsValid (bool): true
ownCloudInfo/connectionErrorMessage (QString): empty
ownCloudInfo/notesPathExistsText (QString): empty
ownCloudInfo/serverVersion (QString): empty
restoreCursorPosition (bool): true
restoreLastNoteAtStartup (bool): true
restoreNoteTabs (bool): true
savedSearches/noteFolder-1 (QString): Note 2025-02-10T15.11.06
showMatches (bool): true
showMenuBar (bool): true
showStatusBar (bool): true
showStatusBarNotePath (bool): true
showStatusBarRelativeNotePath (bool): false
spellCheckLanguage (QString): auto
startInReadOnlyMode (bool): false
systemIconTheme (bool): false
taggingShowNotesRecursively (bool): false
tagsPanelHideNoteCount (bool): false
tagsPanelHideSearch (bool): false
tagsPanelOrder (int): 0
tagsPanelSort (int): 0
todoCalendarSupport (bool): true
toolbar/1/items (QStringList): actionFormat_text_bold, actionFormat_text_italic, actionStrike_out_text, actionInsert_code_block, actionInsert_block_quote
toolbar/1/name (QString): formattingToolbar
toolbar/1/title (QString): formatting toolbar
toolbar/2/items (QStringList): actionInsert_text_link, actionInsert_image, actionInsert_current_time
toolbar/2/name (QString): insertingToolbar
toolbar/2/title (QString): inserting toolbar
toolbar/3/items (QStringList): action_Encrypt_note, actionEdit_encrypted_note, actionDecrypt_note
toolbar/3/name (QString): encryptionToolbar
toolbar/3/title (QString): encryption toolbar
toolbar/4/items (QStringList): actionEnable_AI, actionAiBackendComboBox, actionAiModelComboBox
toolbar/4/name (QString): aiToolbar
toolbar/4/title (QString): AI toolbar
toolbar/5/items (QStringList): actionWorkspaceComboBox, actionStore_as_new_workspace, actionRemove_current_workspace, actionRename_current_workspace, actionSwitch_to_previous_workspace, actionUnlock_panels, , actionToggle_distraction_free_mode, action_Increase_note_text_size, action_Decrease_note_text_size, action_Reset_note_text_size
toolbar/5/name (QString): windowToolbar
toolbar/5/title (QString): window toolbar
toolbar/6/items (QStringList): action_Quit
toolbar/6/name (QString): quitToolbar
toolbar/6/title (QString): quit toolbar
toolbar/7/items (QStringList): action_Quit
toolbar/7/name (QString): quitToolbar
toolbar/7/title (QString): quit toolbar
toolbar/size (int): 7
useNoteFolderButtons (bool): false
useUNIXNewline (bool): false
webAppClientService/serverUrl (QString): wss://app.qownnotes.org
webAppClientService/token (QString): <hidden>
webSocketServerService/bookmarksNoteName (QString): Bookmarks
webSocketServerService/bookmarksTag (QString): bookmarks
webSocketServerService/commandSnippetsNoteName (QString): Commands
webSocketServerService/commandSnippetsTag (QString): commands
webSocketServerService/port (int): 22222
workspace-initial/name (QString): Full
workspace-initial/noteSubFolderDockWidgetVisible (QString): true
workspace-initial/windowState (QByteArray): <binary data>
workspaces (QString): initial

System environment

ALSA_CONFIG_DIR: /usr/share/alsa
ALSA_CONFIG_PATH: /usr/share/alsa/alsa-flatpak.conf
AT_SPI_BUS_ADDRESS: unix:path=/run/flatpak/at-spi-bus
CONDA_EXE: /usr/bin/conda
CONDA_PYTHON_EXE: /usr/bin/python3
CONDA_SHLVL: 0
DBUS_SESSION_BUS_ADDRESS: unix:path=/run/flatpak/bus
DEBUGINFOD_IMA_CERT_PATH: /etc/keys/ima
DEBUGINFOD_URLS: https://debuginfod.fedoraproject.org/
DESKTOP_SESSION: gnome
EDITOR: nvim
FLATPAK_ID: org.qownnotes.QOwnNotes
FLATPAK_SANDBOX_DIR: /home/fedir/.var/app/org.qownnotes.QOwnNotes/sandbox
GDMSESSION: gnome
GDM_LANG: en_GB.UTF-8
GIO_LAUNCHED_DESKTOP_FILE: /var/lib/flatpak/exports/share/applications/org.qownnotes.QOwnNotes.desktop
GIO_LAUNCHED_DESKTOP_FILE_PID: 41285
GI_TYPELIB_PATH: /app/lib/girepository-1.0
GJS_DEBUG_OUTPUT: stderr
GJS_DEBUG_TOPICS: JS ERROR;JS LOG
GNOME_SETUP_DISPLAY: :1
GST_PLUGIN_PATH: /app/lib/gstreamer-1.0:/usr/lib/extensions/gstreamer-1.0:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
HOME: /home/fedir
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
INFOPATH: /home/linuxbrew/.linuxbrew/share/info:
INVOCATION_ID: dcc9308334134dcdb86dd6832a1ef0b5
JOURNAL_STREAM: 9:23660
KDE_FORK_SLAVES: 1
LANG: en_GB.UTF-8
LD_LIBRARY_PATH: empty
LOGNAME: fedir
MANAGERPID: 2070
MANPATH: /home/linuxbrew/.linuxbrew/share/man:
MEMORY_PRESSURE_WATCH: /sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/[email protected]/memory.pressure
MEMORY_PRESSURE_WRITE: c29tZSAyMDAwMDAgMjAwMDAwMAA=
PATH: /app/bin:/usr/bin
PS1: [📦 $FLATPAK_ID \W]\$
PWD: /home/fedir
PYTHONUSERBASE: /var/data/python
QML2_IMPORT_PATH: /app/lib/qml
QT_IM_MODULE: ibus
QT_PLUGIN_PATH: /app/lib/plugins:/usr/share/runtime/lib/plugins
QT_WAYLAND_DECORATION: adwaita
SESSION_MANAGER: local/unix:@/tmp/.ICE-unix/2172,unix/unix:/tmp/.ICE-unix/2172
SHELL: /bin/sh
SHLVL: 0
SSH_AUTH_SOCK: /run/user/1000/keyring/ssh
SYSTEMD_EXEC_PID: 2229
SYSTEMD_SLEEP_FREEZE_USER_SESSIONS: 0
USER: fedir
USERNAME: fedir
WAYLAND_DISPLAY: wayland-0
XAUTHORITY: /run/user/1000/.mutter-Xwaylandauth.EM8E12
XDG_CACHE_HOME: /home/fedir/.var/app/org.qownnotes.QOwnNotes/cache
XDG_CONFIG_DIRS: /app/etc/xdg:/etc/xdg
XDG_CONFIG_HOME: /home/fedir/.var/app/org.qownnotes.QOwnNotes/config
XDG_CURRENT_DESKTOP: GNOME
XDG_DATA_DIRS: /app/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:/run/host/share
XDG_DATA_HOME: /home/fedir/.var/app/org.qownnotes.QOwnNotes/data
XDG_MENU_PREFIX: gnome-
XDG_RUNTIME_DIR: /run/user/1000
XDG_SESSION_CLASS: user
XDG_SESSION_DESKTOP: gnome
XDG_SESSION_TYPE: wayland
XDG_STATE_HOME: /home/fedir/.var/app/org.qownnotes.QOwnNotes/.local/state
XMODIFIERS: @im=ibus
__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS: /etc/egl/egl_external_platform.d:/usr/lib/x86_64-linux-gnu/GL/egl/egl_external_platform.d:/usr/share/egl/egl_external_platform.d
container: flatpak

@pbek
Copy link
Owner

pbek commented Feb 13, 2025

I'd also would like some visual feedback, but it's tricky the way the AI service is implemented. 🤔

@BritishTeapot
Copy link
Author

BritishTeapot commented Feb 14, 2025

You mean on the UI?

Here you go:

Image

Textbox in settings should be enough I think. Even if you have many different backends with different speeds, you should be able to set the response time of the slowest one.

But now after letting the idea to marinate a bit longer, I think an "Abort generation" button would solve the same issues far better, and even solve a lot of other issues, like not being able to abort a wrong request and not really knowing which response time is the best.

I am thinking of something like this:

Image

When the generation is in progress (the button becomes clickable).

Image

When no generation is being done at the moment (the button is grayed out).

To be honest, thinking about AI features in QOwnNotes makes my head explode with ideas. I will probably need to make a few more issues to fully express my ideas 😁.

EDIT: If both features are to be implemented, I think the timeout has to become optional (for those backends, which have unreliable response time).

@pbek
Copy link
Owner

pbek commented Feb 14, 2025

You mean on the UI?

No, not yet. 😊
It's tricky to interact with the UI the way the AI service is implemented.

pbek added a commit that referenced this issue Feb 15, 2025
Signed-off-by: Patrizio Bekerle <[email protected]>
pbek added a commit that referenced this issue Feb 15, 2025
Signed-off-by: Patrizio Bekerle <[email protected]>
pbek added a commit that referenced this issue Feb 16, 2025
Signed-off-by: Patrizio Bekerle <[email protected]>
pbek added a commit that referenced this issue Feb 16, 2025
Signed-off-by: Patrizio Bekerle <[email protected]>
pbek added a commit that referenced this issue Feb 16, 2025
pbek added a commit that referenced this issue Feb 16, 2025
Signed-off-by: Patrizio Bekerle <[email protected]>
pbek added a commit that referenced this issue Feb 16, 2025
Signed-off-by: Patrizio Bekerle <[email protected]>
pbek added a commit that referenced this issue Feb 16, 2025
Signed-off-by: Patrizio Bekerle <[email protected]>
@pbek
Copy link
Owner

pbek commented Feb 16, 2025

25.2.6

  • There now is a setting to increase the API response timeout in the AI settings
    (for #3231)
  • Now a loading spinner is shown in the status bar during AI activity
    (for #3231)

There now is a new release, could you please test it and report if it works for you?

pbek added a commit that referenced this issue Feb 16, 2025
@BritishTeapot
Copy link
Author

Just updated to the latest version, and it work beautifully 🤩. Thank you so much!

@pbek
Copy link
Owner

pbek commented Feb 21, 2025

Great, thank you for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants