Skip to content

Commit

Permalink
linkable examples
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Feb 21, 2025
1 parent fed83d0 commit a161edc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions ui/projects/ask/src/app/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ <h2>&hellip;and we'll try to locate the answer in <span [innerHTML]='deployment?
<div class='examples'>
<h3>Not sure what to search for? Here are a few examples:</h3>
<div class='example-list'>
@for (example of deployment?.examples ; track example) {
<div class='example'>- &nbsp;"{{ example }}"</div>
@for (example of deployment?.examples ; track example) {
<div class='example'>- &nbsp;"
<a (click)='ask(example)'>{{ example }}</a>
"</div>
}
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions ui/projects/ask/src/app/home/home.component.less
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@
.font-sans-400;
font-size: 16px;
font-style: italic;
a {
cursor: pointer;
text-decoration: underline;
color: @color-blue-2;
}
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions ui/projects/ask/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ export class HomeComponent {
});
}

ask() {
if (this.question) {
ask(example?: string) {
const question = example || this.question;
if (question) {
this.loading = true;
this.api.getAnswer(undefined, this.question, this.deployment_id)
this.api.getAnswer(undefined, question, this.deployment_id)
.pipe(
catchError((error) => {
this.setAnswer('Error: ' + error.message);
Expand Down

0 comments on commit a161edc

Please sign in to comment.