Meta tags:
description= Capture rendered page HTML with a custom tag and use it as context for an AI session;
Headings (most frequently used words):
the, step, page, ai, context, from, content, optional, table, of, contents, overview, wrap, read, body, in, tag, clean, html, build, system, message, ask, questions, split, output, around, widget, persist, session, across, requests, configuration, security, when, to, use, this, related, documentation, see, also,
Text of the page (most frequently used words):
the (56), lucee (42), page (32), and (24), content (18), tag (17), close (16), add (15), from (14), custom (12), #session (12), for (12), context (10), step (10), tags (9), functions (9), with (9), widget (9), arguments (9), documentation (8), thistag (8), var (8), inquiryaisession (7), system (7), body (7), html (7), string (7), trim (7), server (7), this (6), class (6), div (6), aisession (6), that (6), rawcontent (6), generatedcontent (6), cfoutput (6), output (6), pagetitle (6), text (6), openpos (6), file (6), configuration (5), use (5), your (5), model (5), name (5), serialized (5), message (5), user (5), optional (5), len (5), answer (5), required (5), pagecontext (5), chr (5), integration (4), see (4), questions (4), what (4), settings (4), ask (4), not (4), mychatgpt (4), pre (4), span (4), cfml (4), build (4), marker (4), markerpos (4), split (4), form (4), function (4), msg (4), return (4), findnocase (4), raw (4), read (4), wrap (4), building (4), extensions (4), web (4), mappings (3), serialization (3), llm (3), how (3), save (3), core (3), across (3), when (3), security (3), data (3), application (3), store (3), new (3), contentbefore (3), contentafter (3), hasendtag (3), after (3), end (3), question (3), writeoutput (3), tax (3), product (3), options (3), striptagblocks (3), tagname (3), openneedle (3), closetag (3), closepos (3), rereplace (3), all (3), clean (3), systemmessage (3), createaisession (3), about (3), cf_pageai (3), template (3), docs (3), search (3), download (3), source (3), forum (3), features (3), java (3), linux (3), xml (3), syntax (3), extension (3), where (2), place (2), conversation (2), related (2), without (2), many (2), augmentation (2), lucene (2), does (2), help (2), external (2), log (2), handler (2), separate (2), rest (2), send (2), field (2), openai (2), type (2), highlight (2), render (2), keep (2), large (2), scope (2), load (2), request (2), layout (2), cross (2), cache (2), persist (2), requests (2), location (2), find (2), left (2), mid (2), example (2), before (2), flow (2), only (2), around (2), chunk (2), rate (2), follow (2), value (2), input (2), you (2), can (2), buildsystemmessage (2), assistant (2), expressions (2), lcase (2), cleanpagecontext (2), rendered (2), final (2), cfif (2), cfscript (2), attributes (2), pageai (2), cfm (2), label (2), overview (2), applications (2), recipes (2), previous (2), menu (2), code (2), credits (2), get (2), services (2), using (2), locking (2), down (2), tomcat (2), migrating (2), railo (2), updating (2), installer (2), support (2), sysadmin (2), windows (2), date (2), time (2), files (2), deploy (2), enhanced (2), ajax (2), upgrading (2), modified (2), modifiers (2), matrix (2), components (2), cfcs (2), scopes (2), objects (2), language (2), getting (2), developed, maintained, association, switzerland, licensed, under, creative, commons, attribution, noncommercial, sharealike, unported, license, also, work, restore, state, one, off, direct, broad, knowledge, topics, consider, alternatives, maintaining, duplicate, specific, screen, wizards, dashboards, good, fit, review, sent, providers, endpoint, protect, like, app, password, secret, values, runtime, openaiengine, secretkey, openai_api_key, gpt, mini, timeout, 30000, aihas, any, configured, connection, out, grows, usually, safer, stored, call, again, capture, common, loading, condense, maxlength, serializeaisession, database, next, loadaisession, creating, every, works, demos, chat, survives, reloads, serialize, keyed, needed, else, known, intro, block, itself, set, merge, panel, should, sit, captured, three, parts, inside, cfflush, throwonerror, false, streaming, still, knows, typical, keeps, history, stay, metadata, role, same, way, extra, lines, are, helpful, described, below, clearly, answers, short, discuss, appears, invent, fields, title, prepend, instructions, then, append, cleaned, pages, instead, very, complex, regular, while, break, script, style, strip, scripts, styles, gets, readable, runs, already, contains, executionmode, param, default, limit, temperature, ready, true, comment, here, resolves, mapped, folder, calls, configure, shipping, taxrate, main, execution, everything, was, between, opening, closing, flowchart, renders, reads, asks, via, pass, part, turn, into, plain, idea, simple, need, understands, its, labels, visible, just, generic, chatbot, looking, introduced, edit, table, contents, category, dark_mode, light_mode, toggle, theme, swap_calls, random, arrow_forward, experimental, arrow_back, youtube, play_circle, git, book, menu_book, javadocs, repository, issue, tracker, bug_report, newsletter, signup, developer, website, public, downloads, referencing, markdown, structure, why, great, compared, mailing, list, rules, contributor, agreement, translations, involved, professional, 3rd, party, libraries, configuring, regional, preparing, contributors, performance, caching, lockdown, guide, url, rewriting, best, practices, deploying, coldfusion, update, securing, inf, mod_cfml, macos, install, installing, kabang, format, locale, upload, operation, result, cfadmin, awselasticbeanstalk, ubuntu, tomcat7, multi, instance, tutorials, todo, tips, setting, osx, 2008, plesk, 2003, iis6, embedding, servers, resources, virtual, systems, general, deviations, types, faqs, capistrano, command, line, interface, amf, bind, various, unquoted, osgi, loop, times, lambda, dialect, removed, access, variables, abstract, couchdb, mongodb, membase, infinispan, provider, dynamic, config, consumer, admin, plugins, zip, wddx, video, threads, structures, strings, static, sorting, regex, redis, queries, internet, protocols, printing, pdfs, parsing, orm, numbers, math, lists, ldap, json, javascript, iterator, internationalization, image, manipulation, formatting, control, handling, encode, decode, event, gateways, decision, logic, devops, debugging, currency, cryptography, compatibility, migration, collections, booleans, binary, arrays, categories, sys, prop, env, change, deprecated, unsupported, annotations, additional, reference, operators, reserved, words, editors, ides, commandbox, know, requirements, first, steps, started,
Text of the page (random words):
ai context from page content lucee documentation getting started close add first steps system requirements getting to know lucee server commandbox lucee editors ides lucee syntax close add language and syntax reserved words operators scopes reference close add functions tags objects additional tags functions annotations unsupported tags functions deprecated tags functions change log sys prop env var recipes categories close add ai llm integration ajax features arrays application binary data booleans cache collections compatibility migration components cfcs core cfml language cryptography currency features date and time debugging devops decision logic event gateways encode decode extensions file handling flow control formatting html image manipulation internationalization iterator java javascript json ldap lists math numbers objects orm parsing pdfs printing internet protocols queries redis regex rest scopes search server session sorting static strings structures s3 threads video wddx web services xml zip files extensions close add admin plugins cfcs matrix support components extension consumer config xml matrix dynamic extension content extension provider infinispan membase mongodb couchdb lucee 5 close add extensions in lucee 5 abstract final modifiers access modifiers for variables class updating the lucee dialect removed 6 1 new and modified functions lambda expressions loop times osgi new and modified tags unquoted arguments upgrading from lucee 4 5 upgrading from railo various close add ajax bind syntax amf configuration command line interface web xml deploy with capistrano enhanced functions faqs file system types general deviations lucee resources virtual file systems lucee server web servers embedding lucee in java applications server 2003 and iis6 server 2008 with tomcat and plesk setting up osx tips todo lucee tutorials ubuntu 12 04 lucee 4 with tomcat7 multi instance enhanced tags deploy awselasticbeanstalk cfadmin documentation file upload operation result custom date and time format for a locale using df files lucee 5 3 kabang lucee 6 2 lucee 7 lucee 7 1 installing lucee close add download and install windows lucee installer macos linux mod_cfml sysadmin windows securing web inf sysadmin linux installer support updating lucee close add how to update lucee migrating from railo migrating from coldfusion deploying lucee close add lucee security best practices url rewriting lockdown guide template performance caching locking down lucee locking down tomcat credits and contributors preparing your server linux configuring regional settings building lucee close add building lucee 5 6 from source building lucee 4 x from source using lucee in java 3rd party libraries building extensions professional services get involved close add translations contributor s agreement mailing list rules about lucee close add how to get help lucee compared credits lucee features why lucee server s great about the docs close add content documentation structure build lucee docs markdown cross referencing downloads public lucee website forum developer forum forum newsletter signup bug_report issue tracker code source repository code lucee javadocs menu_book git book download download play_circle lucee on youtube menu menu close previous page ai augmentation with lucene arrow_back previous page ai integration for documentation experimental arrow_forward random page swap_calls toggle theme light_mode dark_mode search search close ai context from page content ai context from page content docs lucee recipes ai context from page content category ai llm integration table of contents ai context from page content overview step 1 wrap the page step 2 read the body in the tag step 3 clean the html step 4 build the system message step 5 ask questions optional split output around the widget optional persist the session across requests configuration security when to use this related documentation edit introduced 7 0 ai context from page content many applications need an assistant that understands the page the user is looking at its labels options and visible text not just a generic chatbot the idea is simple wrap page content in a custom tag read the rendered html from the tag body turn that into plain text pass it to createaisession as the system message or as part of it for ai configuration and core functions see ai overview flowchart lr a page template b custom tag body renders b c tag reads generatedcontent c d clean html to text d e createaisession with context e f user asks via inquiryaisession at end execution a custom tag with a body can read thistag generatedcontent everything that was output between the opening and closing tag that string is your page context step 1 wrap the page in your layout or template wrap the main content cf_pageai pagetitle product settings cfoutput h1 product settings h1 p configure shipping and tax options for this store p form label tax rate input type text name taxrate value 8 5 label form cfoutput cf_pageai place the tag file where lucee resolves custom tags for example a mapped custom tag folder lucee calls it as cf_pageai when the file is pageai cfm step 2 read the body in the tag pageai cfm cfif thistag executionmode eq end or thistag hasendtag cfscript param name attributes pagetitle default rawcontent thistag hasendtag trim thistag generatedcontent pagecontext cleanpagecontext rawcontent systemmessage buildsystemmessage attributes pagetitle pagecontext aisession createaisession name mychatgpt systemmessage systemmessage limit 8 temperature 0 3 cfscript cfoutput div class page ai data ready true p class comment ask a question about this page p your question form widget here div cfoutput cfif the tag runs after the body is rendered so generatedcontent already contains the final html step 3 clean the html strip scripts styles and tags so the model gets readable text function striptagblocks required string raw required string tagname var t arguments raw var openneedle lcase arguments tagname var closetag lcase arguments tagname var openpos findnocase openneedle t while openpos var closepos findnocase closetag t openpos if closepos break t left t openpos 1 mid t closepos len closetag openpos findnocase openneedle t openpos return t function cleanpagecontext required string raw var t trim arguments raw if len t return t striptagblocks t script t striptagblocks t style t rereplace t all t rereplace t t all t rereplace t r n s 2 chr 10 all return trim t use string functions find findnocase on large pages instead of very complex regular expressions step 4 build the system message prepend instructions then append the cleaned page text function buildsystemmessage required string pagetitle required string pagecontext var msg you are a helpful assistant for the page described below answer clearly and keep answers short only discuss content that appears on this page do not invent fields or options if len trim arguments pagetitle msg chr 10 page title trim arguments pagetitle if len trim arguments pagecontext msg chr 10 chr 10 page content chr 10 trim arguments pagecontext return msg you can add optional metadata page id product name user role the same way as extra lines before page content step 5 ask questions send user input with inquiryaisession the session keeps conversation history so follow up questions stay in context answer inquiryaisession aisession what does the tax rate field do writeoutput answer follow up the model still knows the page content from the system message answer inquiryaisession aisession what is a typical value writeoutput answer for streaming output inquiryaisession aisession form question function chunk writeoutput chunk cfflush throwonerror false optional split output around the widget if the ai panel should sit inside the page flow not only at the end of the tag split the captured html and output in three parts content before the widget set thistag generatedcontent tag merge output the widget itself content after the widget use a marker in the page body for example ai location or split after a known intro block marker ai location markerpos find marker rawcontent if markerpos contentbefore left rawcontent markerpos 1 contentafter mid rawcontent markerpos len marker else contentbefore contentafter rawcontent if thistag hasendtag thistag generatedcontent contentbefore div class highlight pre span span pre div br cfml cfoutput widget contentafter cfoutput optional persist the session across requests creating a new session on every page load works for demos for a chat that survives reloads serialize the session and store it keyed by page and user if needed serialized serializeaisession aisession save serialized in application scope a cache or a database on the next request aisession loadaisession mychatgpt serialized see ai session serialization for maxlength condense and cross model loading a common layout is custom tag capture content build system message render widget separate request handler load stored session call inquiryaisession save serialized session again keep serialized data out of the cfml session if it grows large application scope or an external store is usually safer configuration use any configured ai connection by name ai mychatgpt class lucee runtime ai openai openaiengine custom secretkey openai_api_key model gpt 4o mini type openai timeout 30000 div class highlight pre span span pre div br cfml if aihas mychatgpt render the widget security do not send password or secret field values to the model if the ask handler is a separate endpoint protect it like the rest of your app review ai log to see what page content is sent to external providers when to use this good fit help on a specific screen settings wizards dashboards what does this page do without maintaining duplicate documentation consider alternatives broad knowledge across many topics ai augmentation with lucene one off questions with no page context direct inquiryaisession without a custom tag related documentation ai ai configuration and core functions ai session serialization save and restore conversation state custom tag mappings where to place custom tags and how mappings work see also ai llm integration ai ai session serialization custom tag mappings the lucee documentation is developed and maintained by the lucee association switzerland and licensed under a creative commons attribution noncommercial sharealike 3 0 unported license
|