Skip to content

Commit

Permalink
added new llm module
Browse files Browse the repository at this point in the history
Issue #580
  • Loading branch information
rsoika committed May 13, 2024
1 parent 7376111 commit b433c14
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* --- Imixs-ML/AI Office Integration ---------------------------- */

.imixs-ml,
.imixs-ml:focus {
background: url(./idea_16.png) no-repeat scroll right #fff !important;
border: 1px solid #faa732 !important;
text-align: left !important;
}

.imixs-date.imixs-ml,
.imixs-date.imixs-ml:focus {
background: url(./calendar_14.png) no-repeat scroll left #fff !important;
background-position: 4px 6px, center !important;
border: 1px solid #faa732 !important;
}

.imixs-ml:focus,
.imixs-date.imixs-ml:focus {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 8px rgba(244, 160, 97, 0.55) !important;
}



.imixs-llm,
.imixs-llm:focus {
background: url(./idea_16.png) no-repeat scroll right #fff !important;
border: 1px solid #faa732 !important;
text-align: left !important;
}

.imixs-date.imixs-llm,
.imixs-date.imixs-llm:focus {
background: url(./calendar_14.png) no-repeat scroll left #fff !important;
background-position: 4px 6px, center !important;
border: 1px solid #faa732 !important;
}

.imixs-llm:focus,
.imixs-date.imixs-llm:focus {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 8px rgba(244, 160, 97, 0.55) !important;
}

This file was deleted.

48 changes: 20 additions & 28 deletions imixs-office-workflow-app/src/main/webapp/layout/template.xhtml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions" xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">

<h:head>
Expand All @@ -19,11 +15,11 @@
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<meta name="robots" content="noindex" />

<title><ui:param name="title"
value="#{propertyController.getProperty('application.title')}"></ui:param>
<h:outputText rendered="#{empty title}"
value="#{resourceBundleHandler.findMessage('application_title')}" />
<h:outputText rendered="#{!empty title}" value="#{title}" /></title>
<title>
<ui:param name="title" value="#{propertyController.getProperty('application.title')}"></ui:param>
<h:outputText rendered="#{empty title}" value="#{resourceBundleHandler.findMessage('application_title')}" />
<h:outputText rendered="#{!empty title}" value="#{title}" />
</title>

<!-- *** CSS *** -->

Expand All @@ -41,9 +37,7 @@


<!-- imixsHeader (must be loaded before office-css! -->
<i:imixsHeader disablecss="false"
dateformat="#{message.datePatternShort}"
build="#{app.application_workflow_build}"
<i:imixsHeader disablecss="false" dateformat="#{message.datePatternShort}" build="#{app.application_workflow_build}"
xtheme="#{facesContext.externalContext.requestContextPath}/layout/themes/#{app.application_theme}" />

<!-- font icons -->
Expand Down Expand Up @@ -79,7 +73,7 @@

<!-- ML Feature css -->
<link
href="#{facesContext.externalContext.requestContextPath}/layout/css/office-theme-ml.css?build=#{app.application_build_timestamp}"
href="#{facesContext.externalContext.requestContextPath}/layout/css/office-theme-ai.css?build=#{app.application_build_timestamp}"
charset="UTF-8" type="text/css" rel="stylesheet" />

<!-- custom css -->
Expand Down Expand Up @@ -109,13 +103,12 @@

<!-- The Top-Margin form the content container depends on the HistoryNav panel. If not history entries are displayed the
top margin is reduced -->
<ui:fragment
rendered="#{(loginController.authenticated) and (!empty historyController.workitems)}">
<ui:fragment rendered="#{(loginController.authenticated) and (!empty historyController.workitems)}">
<style>
#container {
margin-top: 100px;
}
</style>
#container {
margin-top: 100px;
}
</style>
</ui:fragment>

<!-- *** SCRIPTS *** -->
Expand Down Expand Up @@ -191,13 +184,12 @@
</div>
</ui:fragment>

<ui:fragment
rendered="#{(loginController.authenticated) and (!empty historyController.workitems)}">
<ui:fragment rendered="#{(loginController.authenticated) and (!empty historyController.workitems)}">
<div id="imixs-history" class="imixs-header-history">
<ui:include src="historynav.xhtml" />
</div>
</ui:fragment>

<div id="imixs-main">
<ui:include src="/error_message.xhtml" />
<ui:insert name="content">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty" xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">

<!-- Imixs-AI LLM integration
This subform is loaded by the workitem.xhtml page if the LLMController form Imixs-AI is available.
The list of all LLM Suggest Items is stored in the item suggest-items.
The subform provides a jsf commandScript which calls the llmController.search method in the backend.
The script below inits a autocompletion feature for each llm sugget input field.
See imixs-office.autocompletion.js
See also:
https://stackoverflow.com/questions/16588327/how-to-invoke-a-jsf-managed-bean-on-a-html-dom-event-using-native-javascript
https://dzone.com/articles/execute-a-jsf-ajax-request-by-just-a-function-call
https://www.w3schools.com/howto/howto_js_autocomplete.asp
-->
<h:commandScript name="llmSearch" action="#{llmSuggestController.search()}" rendered="#{llmSuggestController!=null}"
render="autocomplete-resultlist-ml" onevent="autocompleteShowResult" />


<script type="text/javascript">
/*<![CDATA[*/
// get the current imixs-ml status
var llmSuggestResult = #{ llmSuggestController.getSuggestResult()};

// init ml input fields...
$(document).ready(function () {
if (mlResult) {
fullItemList = $("input[data-item]");
// if suggest mode than update the style for input items associated with ai.suggest.items.
if (mlResult.mode == 'ON') {
// find all ml data items
$(fullItemList).each(function () {
// select data-item value
var dataItem = $(this).data('item');
var bIgnoreInput = false;
var classNamesDef = $(this).attr("class");
if (classNamesDef) {
classNames = classNamesDef.split(/\s+/);
if (classNames.indexOf("imixs-date") > -1) {
bIgnoreInput = true; // we skip imixs-date inputs!
}
}

// test if this data-item is a ml-item...
if (mlResult.items.indexOf(dataItem) > -1) {
// ok we have a llm suggest-item
$(this).addClass("imixs-llm");
if (!bIgnoreInput) {
autocompleteInitInput(this, llmSearch, 'autocomplete-resultlist-llm');
}
}
});
}
}
});

/*]]>*/
</script>

<h:panelGroup id="autocomplete-resultlist-llm" layout="block" class="autocomplete-resultlist">
<ui:repeat var="suggest" value="#{llmSuggestController.searchResult}">
<div class="autocomplete-resultlist-element" onclick="autocompleteSelectElement('#{suggest}')">
<a href="#">
<h:outputText value="#{suggest}" escape="false" />
</a>
</div>
</ui:repeat>
</h:panelGroup>
</ui:composition>
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@
<button type="submit" onclick="return false;" style="display:none;"></button>


<!-- Imixs-ML integration -->
<!-- Imixs-ML/AI integration -->
<ui:fragment rendered="#{mlController!=null}">
<ui:include src="/pages/workitems/workitem-ml.xhtml">
<ui:param name="workitem" value="#{workflowController.workitem}" />
</ui:include>
</ui:fragment>
<ui:fragment rendered="#{llmSuggestController!=null}">
<ui:include src="/pages/workitems/workitem-llm.xhtml">
<ui:param name="workitem" value="#{workflowController.workitem}" />
</ui:include>
</ui:fragment>

<div class="imixs-workitem">

Expand Down

0 comments on commit b433c14

Please sign in to comment.