-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #610
- Loading branch information
Showing
6 changed files
with
237 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
imixs-office-workflow-app/src/main/webapp/pages/workitems/workitem_ai copy.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<f:subview 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:i="http://xmlns.jcp.org/jsf/composite/imixs"> | ||
|
||
<!-- Integration of Imixs-AI | ||
--> | ||
<dl> | ||
<dt style="clear: left;"> | ||
<h:outputText value="Prompt:" /> | ||
</dt> | ||
<dd> | ||
<f:ajax render="chatlist"> | ||
<h:inputTextarea required="false" value="#{workflowController.workitem.item['ai.chat.prompt']}" | ||
id="description_id" style="height: 5em; width: 95%"> | ||
</h:inputTextarea> | ||
<h:commandButton value="#{message.send}" actionListener="#{aiController.sendAsync}" /> | ||
</f:ajax> | ||
</dd> | ||
</dl> | ||
|
||
<h:panelGroup layout="block" id="chatlist" style="margin-bottom:10px;"> | ||
Chat History.... | ||
<br /> | ||
<ui:repeat var="answer" value="#{aiController.chatHistory}"> | ||
#{answer} | ||
<hr /> | ||
</ui:repeat> | ||
</h:panelGroup> | ||
|
||
<h:commandScript name="refreshStockData" render="chatlist" /> | ||
<h:outputScript> | ||
console.log('ich mache irgendwas'); | ||
if (refreshStockData) { | ||
console.log('die methode scheint es zu geben'); | ||
} | ||
setInterval(refreshStockData, 500); // Refresh every 500ms | ||
</h:outputScript> | ||
|
||
</f:subview> |
77 changes: 62 additions & 15 deletions
77
imixs-office-workflow-app/src/main/webapp/pages/workitems/workitem_ai.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,77 @@ | ||
<f:subview 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:i="http://xmlns.jcp.org/jsf/composite/imixs"> | ||
xmlns:a="http://xmlns.jcp.org/jsf/passthrough" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | ||
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"> | ||
|
||
<!-- Integration of Imixs-AI | ||
--> | ||
<dl> | ||
<dt style="clear: left;"> | ||
<h:outputText value="Prompt:" /> | ||
</dt> | ||
|
||
<dd> | ||
<f:ajax render="chatlist"> | ||
<h:inputTextarea required="false" value="#{workflowController.workitem.item['ai.chat.prompt']}" | ||
id="description_id" style="height: 5em; width: 95%"> | ||
</h:inputTextarea> | ||
<h:commandButton value="#{message.send}" actionListener="#{aiController.send}" /> | ||
</f:ajax> | ||
<h:inputTextarea required="false" value="#{workflowController.workitem.item['ai.chat.prompt']}" | ||
a:placeholder="#{message['ai.prompt']}" id="promptInput" style="height: 5em; width: 95%"> | ||
</h:inputTextarea> | ||
<h:commandButton value="#{message.send}" actionListener="#{aiController.sendAsync}"> | ||
<f:ajax execute="promptInput" render="@none" onevent="handleSendEvent" /> | ||
</h:commandButton> | ||
</dd> | ||
</dl> | ||
|
||
<h:panelGroup layout="block" id="chatlist" style="margin-bottom:10px;"> | ||
Chat History.... | ||
<br /> | ||
<ui:repeat var="answer" value="#{aiController.chatHistory}"> | ||
#{answer} | ||
<!-- Imixs AI Life-Answering Block --> | ||
<h:panelGroup layout="block" id="imixs_ai_life_stream" style="display:none;"> | ||
<pre style="overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;"> | ||
<div class="imixs-ai-loader"></div><span>...</span><h:outputText id="aiResultStream" value="#{aiController.streamResult}" escape="false" /> | ||
</pre> | ||
</h:panelGroup> | ||
|
||
<!-- Imixs AI Chat history--> | ||
<h:panelGroup layout="block" id="imixs_ai_chatlist" style="margin-bottom:10px;"> | ||
<ui:repeat var="aiResultEntry" value="#{aiController.aiChatHistory}"> | ||
#{aiResultEntry} | ||
<hr /> | ||
</ui:repeat> | ||
</h:panelGroup> | ||
|
||
<h:commandScript name="refreshAILifeResult" render="aiResultStream" onevent="handleRefreshEvent" /> | ||
<h:commandScript name="refreshAIChatHistory" render="imixs_ai_chatlist" /> | ||
<script type="text/javascript"> | ||
/*<![CDATA[*/ | ||
var refreshInterval; | ||
function handleSendEvent(data) { | ||
if (data.status === "begin") { | ||
console.log('streaming started....'); | ||
startRefreshing(); | ||
} | ||
} | ||
function handleRefreshEvent(data) { | ||
if (data.status === 'success') { | ||
console.log('handle refreshEvent: ' + data.responseText); | ||
if (data.responseText && data.responseText.indexOf('imixs.ai.stream.completed') > -1) { | ||
stopRefreshing(); | ||
} | ||
} | ||
} | ||
function startRefreshing() { | ||
console.log('Start Refreshing...'); | ||
refreshInterval = setInterval(refreshAILifeResult, 100); | ||
// show imixs_ai_life_stream | ||
lifeStreamBlock = document.querySelector('[id$=":imixs_ai_life_stream"]'); | ||
if (lifeStreamBlock) { | ||
lifeStreamBlock.style.display = ''; | ||
} | ||
|
||
} | ||
function stopRefreshing() { | ||
console.log('Stop Refreshing!'); | ||
clearInterval(refreshInterval); | ||
refreshAIChatHistory(); | ||
// hide imixs_ai_life_stream | ||
lifeStreamBlock = document.querySelector('[id$=":imixs_ai_life_stream"]'); | ||
if (lifeStreamBlock) { | ||
lifeStreamBlock.style.display = 'none'; | ||
} | ||
} | ||
/*]]>*/ | ||
</script> | ||
|
||
</f:subview> |
Oops, something went wrong.