Ana Ai Chat for local multi modal (Ollama + Stable diffusion webui forge neo) - features chat history, chat drafts, media page, memory profile, ai text and code parsing, multi file upload for code, vision and image2image, prompt enhance, image upscale, infinite scroll with lazy load images, asynchronous decoupled queued processing, file based databases, lightbox viewer with navigation and slideshow.

----------------------------------------------------------------------
 twily.info                                                    v1.0.6
                                                                 2026

Custom AI Chat multi modal interface made in javascript/php, runs on apache or nginx, ie. for windows use xamp with a few pre configurations for long running tasks-

*You need to supply your own AI backend to the interface, ie. Ollama+Stable Diffusion for reason+vision+diffusion and set BACKEND_IP in setup.php

—
Pre-configurations for xamp - once installed, open XAMP control panel, only ever need Apache (no mysql etc etc), open config -> apache2.conf and add to the bottom of the file:

Timeout 1800

—
Then open config again -> php.ini and change these variables to these values:

max_execution_time=1800
memory_limit = 512M
post_max_size=5050M
upload_max_filesize=5000M
max_file_uploads=50

extension=gd ;uncomment in conf to enable for thumbnail/preview creations

—
Then Stop/Start and request to AI should no longer time out/invalid json if cut short if it takes 10-20 min. (If the AI backend is running on a slow/old system, may need to increase 1800 to 3600 etc, especially for vision model!)

(For nginx see details in note.txt about fcgi timeouts supplied with zip)

—

Use the setup_and_launch.py on the backend computer to setup/run the AI models (script is lacking the download parts for setup in both ollama and stable diffusion but can install through command line like this, or give the script to ai to complete to your needs:


Linux:
curl -fsSL https://ollama.com/install.sh | sh

Windows:
winget install -e --id Ollama.Ollama

To upgrade later
winget upgrade -e --id Ollama.Ollama



Further instructions are supplied in note.txt within zip (Or ask AI: “Setup Ollama on windows with api lan access on default port”, “Setup Stable Diffusion WebUI Forge Neo on windows with api endpoints with <add graphic card spec here> in mind”, and update setup.php)



—

To configure this web interface for a public cloud based ai like grok or gemini:
Would need to know the api endpoints and how to communicate with them/data wise, to make adjustments in the ai_chat worker curl calls. 

Ie. Ollama local model the context keeping it up to the interface, on sending a new message to ai, utilize endpoint /chat instead of /generate to feed a messages array with role user/assistant/system instead of just a prompt string. 

Stable diffusion does not utilize any context keeping so every image generate is a clean start (similar to enhance used with Ollama, utilizing /generate instead of /chat).

Custom memory profile for Ollama is experimental, daily feeding ai a sample of most recent chat to produce its own memory profile to feed back into the message array before the chats own context and then the actual relevant message/prompt at the end.


---


can ignore these files unless specifically need, ie fixes db for previous versions to be fully compatible.
none of these are needed post 1.0.6, except db-browser and rebuild-chats-json which is more a rescue tool.
recalculate-chat-count.php
pair-all-chat-times.php
rebuild-chats-json.php
db-browser.php
convert-databases-v1.0.2-to-v1.0.3.php

main web files are:
index.php [php/html/css/js]
ajax.php [php]
worker.php [php cli]
setup.php [php]
