Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGAIPLAY-7 enabled rag-index bundle and a couple of basic templates c… #239

Merged
merged 5 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ studio.json
.php_cs.cache
.php-cs-fixer.cache
.php-version

/index_outputs
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"netgen/notifications": "^1.0",
"netgen/ibexa-user-impersonation": "dev-NGSTACK-853",
"netgen/survey-builder": "^0.1.2",
"netgen/ibexa-logger": "^1.0@dev"
"netgen/ibexa-logger": "^1.0@dev",
"netgen/ibexa-rag-indexer": "dev-master"
},
"require-dev": {
"symfony/debug-bundle": "5.4.*",
Expand All @@ -78,7 +79,8 @@
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "5.4.*",
"symfony/css-selector": "5.4.*",
"symfony/phpunit-bridge": "5.4.*"
"symfony/phpunit-bridge": "5.4.*",
"franzl/studio": "^0.16.0"
},
"repositories": [
{ "type": "composer", "url": "https://packagist.netgen.biz", "canonical": false }
Expand Down
23,007 changes: 23,007 additions & 0 deletions composer.lock

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions config/app/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ parameters:
ngsite.default.token_validity.email_change: 900

app.testing.site_domain: '%env(TEST_DOMAIN)%'

siteaccess_indexer: rag

netgen_rag_indexer.contentclass_identifier:
- 'ng_article'

netgen_rag_indexer.site_domain: 'netgen-ai-site.dev10.netgen.biz'
15 changes: 15 additions & 0 deletions config/app/packages/ibexa_siteaccess.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ibexa:
- bold_ger
- peak_eng
- '%ngsite.admin_siteaccess_name%'
- rag
groups:
admin_group:
- '%ngsite.admin_siteaccess_name%'
Expand All @@ -28,6 +29,9 @@ ibexa:
impersonation_group:
- peak_eng
- '%ngsite.admin_siteaccess_name%'
rag_group:
- rag

system:
admin_group:
design: ngadmin
Expand Down Expand Up @@ -76,6 +80,13 @@ ibexa:
peak_eng:
languages:
- eng-GB
rag_group:
languages:
- eng-GB
design: rag
session:
name: eZSESSID


netgen_layouts:
design_list:
Expand Down Expand Up @@ -110,3 +121,7 @@ ibexa_design_engine:
- common
admin:
- common
rag:
- rag
- app
- common
25 changes: 25 additions & 0 deletions config/app/prepends/ibexa/content_view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,31 @@ system:
template: "@ibexadesign/content/views/search.html.twig"
match: ~

rag:
ng_content_view:
full:
ng_article:
template: "ng_article.twig"
match:
Identifier\ContentType: [ ng_article ]
ng_banner:
template: "ng_banner.twig"
match:
Identifier\ContentType: [ ng_banner ]
ng_blog_post:
template: "ng_blog_post.twig"
match:
Identifier\ContentType: [ ng_blog_post ]
ng_news:
template: "ng_news.twig"
match:
Identifier\ContentType: [ ng_news ]
ng_recipe:
template: "ng_recipe.twig"
match:
Identifier\ContentType: [ ng_recipe ]


default:
ng_content_view:
ngcb_preview:
Expand Down
1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@
Misd\PhoneNumberBundle\MisdPhoneNumberBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
Netgen\IbexaLoggerBundle\IbexaLoggerBundle::class => ['all' => true],
Netgen\Bundle\IbexaRagIndexer\IbexaRagIndexerBundle::class => ['all' => true],
];
1 change: 1 addition & 0 deletions config/routes/ibexa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ logout:

ibexa.core:
resource: '@IbexaCoreBundle/Resources/config/routing/internal.yml'

3 changes: 3 additions & 0 deletions config/routes/netgen_rag_indexer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
netgen_rag_indexer:
resource: '@IbexaRagIndexerBundle/Resources/config/routing.yml'
prefix: '%netgen_rag_indexer.route_prefix%'
2 changes: 1 addition & 1 deletion src/Controller/Chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class Chat extends AbstractController
{
/**
* @Route("/ai")
* @Route("/ai-proxy")
*/
public function __invoke(): StreamedResponse
{
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ProxyChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class ProxyChat extends AbstractController
{
/**
* @Route("/ai-proxy")
* @Route("/ai")
*/
public function __invoke(): StreamedResponse
{
Expand Down
1 change: 1 addition & 0 deletions templates/themes/rag/default.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Default twig!
28 changes: 28 additions & 0 deletions templates/themes/rag/ng_article.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{# content \Netgen\IbexaSiteApi\API\Values\Content #}
{# location \Netgen\IbexaSiteApi\API\Values\Location #}

{# Setting metadata for the page #}
{% set meta_data = {'description': content.fields.teaser_intro.value.xml.saveXML()|striptags|trim|u.truncate(152)} %}

<article class="ng-article">
<header>
<h1>{{ ng_render_field(content.fields.title) }}</h1>
{% include '@ibexadesign/content/parts/time.html.twig' %}
</header>

<div class="container container-narrow">
{% if not content.fields.full_intro.empty %}
<div class="full-page-intro">
{{ ng_render_field(content.fields.full_intro) }}
</div>
{% endif %}

{% if not content.fields.body.empty %}
<div class="full-page-body">
{{ ng_render_field(content.fields.body) }}
</div>
{% endif %}

{% include '@ibexadesign/content/parts/tags.html.twig' %}
</div>
</article>
20 changes: 20 additions & 0 deletions templates/themes/rag/ng_banner.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{# content \Netgen\IbexaSiteApi\API\Values\Content #}
{# location \Netgen\IbexaSiteApi\API\Values\Location #}

<article class="ng-banner">
{% if not content.fields.image.empty %}
<figure class="image">
{{ ng_render_field(content.fields.image) }}
</figure>
{% endif %}

<header>
<h2>{{ ng_render_field(content.fields.title) }}</h2>
</header>

{% if with_intro|default(false) %}
<div class="intro">
{{ ng_render_field(content.fields.description) }}
</div>
{% endif %}
</article>
25 changes: 25 additions & 0 deletions templates/themes/rag/ng_blog_post.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{# content \Netgen\IbexaSiteApi\API\Values\Content #}
{# location \Netgen\IbexaSiteApi\API\Values\Location #}

{% set meta_data = {'description': content.fields.teaser_intro.value.xml.saveXML()|striptags|trim|u.truncate(152) } %}

<article class="view-type ng-blog-post vf1">
<header>
<h1>{{ ng_render_field(content.fields.title) }}</h1>
{% include '@ibexadesign/content/parts/time.html.twig' %}
</header>

<div class="container container-narrow">
{% if not content.fields.full_intro.empty %}
<div class="full-page-intro">
{{ ng_render_field(content.fields.full_intro) }}
</div>
{% endif %}

{% if not content.fields.body.empty %}
{{ ng_render_field(content.fields.body) }}
{% endif %}

{% include '@ibexadesign/content/parts/tags.html.twig' %}
</div>
</article>
25 changes: 25 additions & 0 deletions templates/themes/rag/ng_news.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{# content \Netgen\IbexaSiteApi\API\Values\Content #}
{# location \Netgen\IbexaSiteApi\API\Values\Location #}

{% set meta_data = {'description': content.fields.teaser_intro.value.xml.saveXML()|striptags|trim|u.truncate(152)} %}

<article class="view-type ng-news">
<header>
<h1>{{ ng_render_field(content.fields.title) }}</h1>
{% include '@ibexadesign/content/parts/time.html.twig' %}
</header>

<div class="container container-narrow">
{% if not content.fields.full_intro.empty %}
<div class="full-page-intro">
{{ ng_render_field(content.fields.full_intro) }}
</div>
{% endif %}

{% if not content.fields.body.empty %}
{{ ng_render_field(content.fields.body) }}
{% endif %}

{% include '@ibexadesign/content/parts/tags.html.twig' %}
</div>
</article>
59 changes: 59 additions & 0 deletions templates/themes/rag/ng_recipe.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{# content \Netgen\IbexaSiteApi\API\Values\Content #}
{# location \Netgen\IbexaSiteApi\API\Values\Location #}

{% set meta_data = {'description': content.fields.teaser_intro.value.xml.saveXML()|striptags|trim|u.truncate(152)} %}

<article class="ng-recipe">
<header>
<h1>{{ ng_render_field(content.fields.title) }}</h1>
{% include '@ibexadesign/content/parts/time.html.twig' %}
</header>

{% if not content.fields.image.empty %}
<div class="recipe-image">
{{ ng_render_field(content.fields.image) }}
</div>
{% endif %}

<div class="container container-narrow">
{% if not content.fields.full_intro.empty %}
<div class="recipe-intro">
{{ ng_render_field(content.fields.full_intro) }}
</div>
{% endif %}

{% if not content.fields.body.empty %}
<div class="recipe-body">
{{ ng_render_field(content.fields.body) }}
</div>
{% endif %}

<div class="recipe-info">
{% if not content.fields.serving_calories.empty %}
<div class="recipe-calories">
{{ ng_render_field(content.fields.serving_calories) }} cal
</div>
{% endif %}

<ul class="recipe-nutrition">
{% if not content.fields.serving_fat.empty %}
<li>Fat: {{ ng_render_field(content.fields.serving_fat) }}g</li>
{% endif %}
{% if not content.fields.serving_carbohydrates.empty %}
<li>Carbs: {{ ng_render_field(content.fields.serving_carbohydrates) }}g</li>
{% endif %}
{% if not content.fields.serving_protein.empty %}
<li>Protein: {{ ng_render_field(content.fields.serving_protein) }}g</li>
{% endif %}
</ul>

{% if not content.fields.preparation_time.empty %}
<div class="recipe-time">
Preparation Time: {{ ng_render_field(content.fields.preparation_time) }} min
</div>
{% endif %}
</div>

{% include '@ibexadesign/content/parts/tags.html.twig' %}
</div>
</article>