Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai_summarize_document
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_summarize_document
Commits
0d78ac7d
Commit
0d78ac7d
authored
7 months ago
by
Adam Nagy
Browse files
Options
Downloads
Patches
Plain Diff
Throw exception if document or file can't be loaded.
parent
bed18b44
Branches
Branches containing commit
Tags
1.0.0-alpha1
Tags containing commit
No related merge requests found
Pipeline
#313989
passed with warnings
7 months ago
Stage: build
Stage: validate
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/AiCKEditor/SummarizeDocument.php
+2
-4
2 additions, 4 deletions
src/Plugin/AiCKEditor/SummarizeDocument.php
with
2 additions
and
4 deletions
src/Plugin/AiCKEditor/SummarizeDocument.php
+
2
−
4
View file @
0d78ac7d
...
@@ -196,15 +196,13 @@ final class SummarizeDocument extends AiCKEditorPluginBase {
...
@@ -196,15 +196,13 @@ final class SummarizeDocument extends AiCKEditorPluginBase {
$document
=
$this
->
entityTypeManager
->
getStorage
(
'media'
)
->
load
(
$values
[
'plugin_config'
][
'document'
]);
$document
=
$this
->
entityTypeManager
->
getStorage
(
'media'
)
->
load
(
$values
[
'plugin_config'
][
'document'
]);
if
(
!
$document
instanceof
MediaInterface
)
{
if
(
!
$document
instanceof
MediaInterface
)
{
$this
->
logger
->
error
(
'Could not load the selected document.'
);
throw
new
\Exception
(
'Could not load the selected document.'
);
return
$form
[
'plugin_config'
][
'response_text'
][
'#value'
]
=
'Could not load the selected document.'
;
}
}
$file_id
=
$document
->
getSource
()
->
getSourceFieldValue
(
$document
);
$file_id
=
$document
->
getSource
()
->
getSourceFieldValue
(
$document
);
$file
=
$this
->
entityTypeManager
->
getStorage
(
'file'
)
->
load
(
$file_id
);
$file
=
$this
->
entityTypeManager
->
getStorage
(
'file'
)
->
load
(
$file_id
);
if
(
!
$file
instanceof
FileInterface
)
{
if
(
!
$file
instanceof
FileInterface
)
{
$this
->
logger
->
error
(
'Could not load the file from the selected document.'
);
throw
new
\Exception
(
'Could not load the file from the selected document.'
);
return
$form
[
'plugin_config'
][
'response_text'
][
'#value'
]
=
'Could not load the file from the selected document.'
;
}
}
$parser
=
new
Parser
();
$parser
=
new
Parser
();
...
...
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