How akutishevsky/salesforce-local-llm-assistant works
Project type and purpose
• This is a Salesforce-native, full-stack application built with SFDX (Salesforce DX), Lightning Web Components (LWC) on the front end, and Apex classes on the back end, packaged as a Salesforce “Local LLM Assistant.”
• It embeds a WebAssembly/JavaScript LLM engine (picoLLM.js) as a static resource to run inference locally in the browser, and it uses Salesforce records (custom metadata and custom objects) for prompts and context.
File structure
• Top‐level: sfdx-project.json, package.json, jest.config.js (project config and test runner).
• force-app/main/default:
• classes/ – Apex controllers (ModalAssistantSelect*, PicklistLocalLLMAgentSettings, RecordSelector, RecordUtils, SObjectUtils, SystemPromptSelector) plus unit tests.
• lwc/ – multiple LWC components: assistant, assistantChat, assistantHeader, assistantPublisher, and configuration & selection modals.
• objects/ – Custom Metadata Type Local_LLM_Assistant_Setting__mdt and custom object System_Prompt__c for system prompts.
• staticresources/ – picoLLM.js static resource that loads and runs the local LLM.
• pages/ – a Visualforce page (PicollmWeb.page) for legacy/demo embedding.
• layouts/ and tabs/ – configuration to expose System_Prompt__c in the UI.
README for additional insights
• Purpose: “LWC that runs LLMs locally on your computer and uses Salesforce records for context.”
• Setup: Deploy code, configure API key in custom metadata, drop component on any Lightning page.
• Dependencies: picovoice.ai for model download & API key; Salesforce LWC & Apex runtime.
Capturing essential architectural elements
• Be exhaustive: show all the modals and controllers as part of the configuration flow.
• Data stores: custom metadata vs. custom object vs. user records.
• Real-time inference path: UI → picoLLM → UI.
• Don’t over-complicate: focus on logical layers (UI, Data Service, Persistence, External).