AI (beta) panel

AI Settings

The provider, endpoint, model and API key Ask AI uses: the Settings window opened on its AI section.

On the ribbonStacked button, AI (beta) panel
NeedsNothing

What it does#

Opens the ordinary Settings window scrolled to AI assistant (beta). Two providers: Anthropic, and OpenAI-compatible, which covers OpenAI itself, Azure OpenAI, Ollama, LM Studio and most local servers through one base URL. The model is a list you can also type into. Test sends one tiny request with the values as they stand and reports what came back.

How to use it#

  1. Pick the provider. For a local server choose OpenAI-compatible and set the base URL, for example http://localhost:11434/v1; leave the key empty.
  2. Paste the key. It is stored encrypted for your Windows account in %APPDATA%\pyNavis\secrets.json, never in config.json, so sharing your config or a screenshot of it never shares the key. It is saved for the endpoint you entered it with and only sent there, over https or to this computer; change the provider or base URL and you enter the new endpoint's key. Remove deletes it.
  3. Click Test, then Save. Ask AI uses the new values from its next message; no Reload is needed for these.

Limitations#

  • The key is readable only by the Windows account that saved it. A copied secrets.json reads as "no key" on another machine.
  • Provider, base URL, model and longest answer live in config.json under ai, like every other setting.

Source#

The tool's own files, word for word as shipped in AI_(beta).panel/Setup.stack/AI_Settings.pushbutton. Every pyNavis tool is an ordinary bundle: copy these into your own extension and change what you like.

script.py Runs on a click. View on GitHub
# -*- coding: utf-8 -*-
"""Opens the Settings window scrolled to the AI assistant section.

The section itself is part of Settings, so there is one place where every
pyNavis setting lives. This button is the short way there from the AI panel.
"""

import clr

clr.AddReference('PyNavis.Runtime')
from PyNavis.Runtime.Forms import SettingsDialog

from pynavis import forms, script, toast


def run():
    try:
        outcome = SettingsDialog.ShowAndSave('ai')
    except Exception as error:
        script.get_logger().error('settings not saved: %s' % error)
        toast.error('Could not save your settings', str(error))
        return

    if outcome == SettingsDialog.Outcome.Cancelled:
        return                                  # cancelled: say nothing

    if outcome == SettingsDialog.Outcome.NeedsRestart:
        toast.warning('Settings saved',
                      'The engine paths changed, so Navisworks needs restarting')
        return

    # The AI keys take effect at the next message with no Reload, but the same
    # window edits everything else too, so offer the Reload the Settings button does.
    if forms.confirm('Reload pyNavis now so the changes show?', 'Settings saved'):
        script.reload_pynavis()
        toast.success('Settings saved', 'pyNavis reloaded, so they show now')
    else:
        toast.success('Settings saved', 'Ask AI uses them from your next message')


if '__commandpath__' in globals():
    run()
bundle.yaml The bundle contract: the keys pyNavis reads for this tool. View on GitHub
title: AI Settings
tooltip: Which provider Ask AI talks to (Anthropic, or any OpenAI-compatible endpoint such as Azure OpenAI or a local server), the model, and your API key. The key is stored encrypted for your Windows account, never in config.json. Opens the Settings window on its AI section.