-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
1,555 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ target | |
.linklint | ||
.lycheecache | ||
build.log | ||
.aigenpipeline | ||
.aigenpipeline* |
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
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
6 changes: 6 additions & 0 deletions
6
aem/ui.apps/src/main/content/jcr_root/apps/composum-ai/prototype/templating/.content.xml
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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" | ||
sling:resourceType="composum-ai/prototype/templating" | ||
jcr:title="AI templating exploration app" | ||
jcr:description="Expore AITemplatingServlet services at e.g. http://localhost:4502/apps/composum-ai/prototype/templating.html" | ||
jcr:primaryType="sling:Folder"/> |
109 changes: 109 additions & 0 deletions
109
aem/ui.apps/src/main/content/jcr_root/apps/composum-ai/prototype/templating/templating.html
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,109 @@ | ||
<!-- AIGenPromptStart(foobar) | ||
Just copy. | ||
AIGenCommand(foobar) | ||
-m copy | ||
../../../../../../../../../../composum/package/src/main/content/jcr_root/libs/composum/pages/options/ai/prototype/templating/templating.html | ||
AIGenPromptEnd(foobar) --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Create a page from a template with AI</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> | ||
<style> | ||
body { | ||
background-color: #cfe2f3; | ||
} | ||
.container { | ||
background-color: #b3d7f7; | ||
padding: 20px; | ||
border-radius: 10px; | ||
margin-top: 20px; | ||
} | ||
.btn-primary { | ||
background-color: #5eadff; | ||
border-color: #5eadff; | ||
} | ||
.btn-primary:hover { | ||
background-color: #3ca9ff; | ||
border-color: #3ca9ff; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Create a page from a template with AI</h1> | ||
<p>This single page application allows you to generate a complete text for a page by replacing prompts with AI-generated content. The page structure contains various components with prompts marked by special placeholders, such as 'PROMPTFIELD: ' for individual prompts and 'PROMPTFIELD#ID: ' for referenced prompts. Additionally, URLs can be included using 'SOURCEURL(https://example.com/)'. The application interacts with the AITemplatingServlet to process the page template.</p> | ||
|
||
<form id="templatingForm"> | ||
<div class="form-group"> | ||
<label for="resourcePath">Resource Path:</label> | ||
<input type="text" class="form-control" id="resourcePath" name="resourcePath" required> | ||
<small class="form-text text-muted">Enter the path of the resource to process.</small> | ||
</div> | ||
<div class="form-group"> | ||
<label for="additionalPrompt">Additional Prompt:</label> | ||
<textarea class="form-control" id="additionalPrompt" name="additionalPrompt" rows="3"></textarea> | ||
<small class="form-text text-muted">Optionally, provide an additional prompt for the AI.</small> | ||
</div> | ||
<div class="form-group"> | ||
<label for="additionalUrls">Additional URL:</label> | ||
<input type="url" class="form-control" id="additionalUrls" name="additionalUrls"> | ||
<small class="form-text text-muted">Enter a URL for context.</small> | ||
</div> | ||
<div class="form-group"> | ||
<label for="backgroundInformation">Background Information:</label> | ||
<textarea class="form-control" id="backgroundInformation" name="backgroundInformation" rows="3"></textarea> | ||
<small class="form-text text-muted">Optionally, provide additional background information for the AI.</small> | ||
</div> | ||
<button type="submit" class="btn btn-primary" id="replacePromptsBtn">Replace Prompts</button> | ||
<button type="submit" class="btn btn-primary" id="resetPromptsBtn">Reset to Prompts</button> | ||
</form> | ||
|
||
<div class="mt-4"><pre style="white-space: pre-wrap;" id="resultDiv"></pre></div> | ||
</div> | ||
|
||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> | ||
<script> | ||
$(document).ready(function() { | ||
var formData = JSON.parse(localStorage.getItem('composum-ai-prototype-templating')) || {}; | ||
$('#resourcePath').val(formData.resourcePath || ''); | ||
$('#additionalPrompt').val(formData.additionalPrompt || ''); | ||
$('#additionalUrls').val(formData.additionalUrls || ''); | ||
$('#backgroundInformation').val(formData.backgroundInformation || ''); | ||
|
||
$('#templatingForm').submit(function(event) { | ||
event.preventDefault(); | ||
var method = event.originalEvent.submitter.id === 'replacePromptsBtn' ? 'replacePromptsInResource' : 'resetToPrompts'; | ||
var formData = { | ||
resourcePath: $('#resourcePath').val(), | ||
additionalPrompt: $('#additionalPrompt').val(), | ||
additionalUrls: $('#additionalUrls').val(), | ||
backgroundInformation: $('#backgroundInformation').val() | ||
}; | ||
localStorage.setItem('composum-ai-prototype-templating', JSON.stringify(formData)); | ||
|
||
$('#replacePromptsBtn, #resetPromptsBtn').prop('disabled', true); | ||
$('#resultDiv').text('Contacting the AI ...'); | ||
$.post('/bin/cpm/ai/experimental/templating.' + method + '.json', formData) | ||
.done(function(data) { | ||
$('#resultDiv').text(JSON.stringify(data, null, 2)); | ||
}) | ||
.fail(function(jqXHR, textStatus, errorThrown) { | ||
$('#resultDiv').text('Error: ' + errorThrown); | ||
}) | ||
.always(function() { | ||
$('#replacePromptsBtn, #resetPromptsBtn').prop('disabled', false); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
|
||
<!-- --> | ||
|
||
|
||
<!-- AIGenVersion(794dd7c5, templating.html-0caedaea, templating.html-20fd7529) --> |
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
Oops, something went wrong.