Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai_evaluations
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ai_evaluations
Commits
6039e0ba
Commit
6039e0ba
authored
3 months ago
by
Marcus Johansson
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3487155
: Remove voting for the user message
parent
30fa3079
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Issue #3487155: Remove voting for the user message
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ai_evaluations.module
+32
-26
32 additions, 26 deletions
ai_evaluations.module
templates/ai-chatbot-message--evaluation.html.twig
+1
-1
1 addition, 1 deletion
templates/ai-chatbot-message--evaluation.html.twig
with
33 additions
and
27 deletions
ai_evaluations.module
+
32
−
26
View file @
6039e0ba
...
...
@@ -31,40 +31,46 @@ function ai_evaluations_cron() {
}
}
/**
* Implements hook_preprocess_HOOK() for ai_chatbot.
*/
function
ai_evaluations_preprocess_ai_chatbot
(
&
$variables
)
{
$variables
[
'#attached'
]
=
[
'library'
=>
[
'core/drupal.ajax'
,
'ai_evaluations/evaluations'
,
],
];
}
/**
* Implements hook_preprocess_HOOK() for ai_chatbot_message.
*/
function
ai_evaluations_preprocess_ai_chatbot_message
(
&
$variables
)
{
$variables
[
'evaluation'
]
=
[
'downvote'
=>
Link
::
fromTextAndUrl
([
'#theme'
=>
'image'
,
'#uri'
=>
\Drupal
::
moduleHandler
()
->
getModule
(
'ai_evaluations'
)
->
getPath
()
.
'/assets/dislike-button-icon.svg'
,
'#alt'
=>
new
TranslatableMarkup
(
'Downvote'
),
],
Url
::
fromRoute
(
'ai_evaluations.vote'
,
[
'assistant_id'
=>
$variables
[
'assistant_id'
]
??
NULL
,
'thread_id'
=>
$variables
[
'thread_id'
]
??
NULL
,
'vote'
=>
0
,
]))
->
toRenderable
()
+
[
'#attributes'
=>
[
'class'
=>
[
'use-ajax'
,
'ai-evaluation-vote'
,
'ai-evaluation-vote--downvote'
]],
],
'upvote'
=>
Link
::
fromTextAndUrl
([
'#theme'
=>
'image'
,
'#uri'
=>
\Drupal
::
moduleHandler
()
->
getModule
(
'ai_evaluations'
)
->
getPath
()
.
'/assets/
dis
like-button-icon.svg'
,
'#alt'
=>
new
TranslatableMarkup
(
'
Down
vote'
),
'#uri'
=>
\Drupal
::
moduleHandler
()
->
getModule
(
'ai_evaluations'
)
->
getPath
()
.
'/assets/like-button-icon.svg'
,
'#alt'
=>
new
TranslatableMarkup
(
'
Up
vote'
),
],
Url
::
fromRoute
(
'ai_evaluations.vote'
,
[
'assistant_id'
=>
$variables
[
'assistant_id'
]
??
NULL
,
'thread_id'
=>
$variables
[
'thread_id'
]
??
NULL
,
'vote'
=>
0
,
]))
->
toRenderable
()
+
[
'#attributes'
=>
[
'class'
=>
[
'use-ajax'
,
'ai-evaluation-vote'
,
'ai-evaluation-vote--downvote'
]],
],
'upvote'
=>
Link
::
fromTextAndUrl
([
'#theme'
=>
'image'
,
'#uri'
=>
\Drupal
::
moduleHandler
()
->
getModule
(
'ai_evaluations'
)
->
getPath
()
.
'/assets/like-button-icon.svg'
,
'#alt'
=>
new
TranslatableMarkup
(
'Upvote'
),
],
Url
::
fromRoute
(
'ai_evaluations.vote'
,
[
'assistant_id'
=>
$variables
[
'assistant_id'
]
??
NULL
,
'thread_id'
=>
$variables
[
'thread_id'
]
??
NULL
,
'vote'
=>
1
,
]))
->
toRenderable
()
+
[
'#attributes'
=>
[
'class'
=>
[
'use-ajax'
,
'ai-evaluation-vote'
,
'ai-evaluation-vote--upvote'
]],
],
'#attached'
=>
[
'library'
=>
[
'core/drupal.ajax'
,
'ai_evaluations/evaluations'
,
],
'assistant_id'
=>
$variables
[
'assistant_id'
]
??
NULL
,
'thread_id'
=>
$variables
[
'thread_id'
]
??
NULL
,
'vote'
=>
1
,
]))
->
toRenderable
()
+
[
'#attributes'
=>
[
'class'
=>
[
'use-ajax'
,
'ai-evaluation-vote'
,
'ai-evaluation-vote--upvote'
]],
],
];
}
...
...
This diff is collapsed.
Click to expand it.
templates/ai-chatbot-message--evaluation.html.twig
+
1
−
1
View file @
6039e0ba
...
...
@@ -19,7 +19,7 @@
</div>
{%
if
evaluation
%}
{%
if
evaluation
and
user
==
'assistant'
%}
<div
class=
"chat-message-evaluation"
>
{{
evaluation
}}
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment