Skip to content

Commit da1faa6

Browse files
refactor: Intent UI improvements (#194)
* improve intent create/edit ui * add intent validations * entity ui improvements
1 parent f6bc19b commit da1faa6

File tree

6 files changed

+167
-136
lines changed

6 files changed

+167
-136
lines changed

docs/03-creating-order-status-check.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Example API Response:
4949
```
5050

5151
Configuration steps:
52-
1. Enable "Trigger API"
52+
1. Enable "REST API Calling"
5353
2. Add the API URL with parameter templating:
5454
```
5555
https://fake-store-api.mock.beeceptor.com/api/orders/status?order_id={{ parameters['name'] }}

frontend/app/admin/entities/[id]/page.tsx

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import React, { useState, useEffect, use, KeyboardEvent, useCallback } from 'rea
44
import { getEntity, saveEntity } from '../../../services/entities';
55
import type { EntityModel, EntityValue } from '../../../services/training';
66
import { useSnackbar } from '../../../components/Snackbar/SnackbarContext';
7+
import { Popover } from 'flowbite-react';
8+
import { QuestionMarkCircleIcon } from '@heroicons/react/24/outline';
79

810
const EntityPage = ({ params }: { params: Promise<{ id: string }> }) => {
911
const { id } = use(params);
@@ -151,7 +153,36 @@ const EntityPage = ({ params }: { params: Promise<{ id: string }> }) => {
151153

152154
<div className="border-t border-gray-200 pt-6">
153155
<div className="flex items-center justify-between mb-4">
154-
<h2 className="text-lg font-medium text-gray-800">Values</h2>
156+
<div className="flex items-center gap-2">
157+
<h2 className="text-lg font-medium text-gray-800">Values</h2>
158+
<Popover
159+
content={
160+
<div className="max-w-sm space-y-2 p-3 bg-gray-50 rounded-lg">
161+
<p>
162+
Entity values and their synonyms help identify different ways users refer to the same entity.
163+
</p>
164+
<p className="mt-2">
165+
Example:
166+
</p>
167+
<div className="bg-white p-3 rounded-lg border border-gray-200">
168+
<p className="font-medium">Value: "credit_card"</p>
169+
<p className="text-sm text-gray-600 mt-1">Synonyms:</p>
170+
<ul className="list-disc pl-5 text-sm text-gray-600">
171+
<li>card</li>
172+
<li>credit</li>
173+
<li>visa</li>
174+
<li>mastercard</li>
175+
</ul>
176+
<p className="mt-2 text-sm text-gray-600">
177+
When users mention any of these synonyms, the intent will receive "credit_card" as the entity value.
178+
</p>
179+
</div>
180+
</div>
181+
}
182+
>
183+
<QuestionMarkCircleIcon className="h-5 w-5 text-gray-400 hover:text-gray-500 cursor-help" />
184+
</Popover>
185+
</div>
155186
<button
156187
type="button"
157188
onClick={addValue}
@@ -251,4 +282,4 @@ const EntityPage = ({ params }: { params: Promise<{ id: string }> }) => {
251282
);
252283
};
253284

254-
export default EntityPage;
285+
export default EntityPage;

frontend/app/admin/entities/page.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ const EntitiesPage: React.FC = () => {
6565
}
6666
};
6767

68-
const handleKeyPress = (e: React.KeyboardEvent) => {
69-
if (e.key === 'Enter') {
70-
handleNewEntity();
71-
}
72-
};
73-
7468
return (
7569
<div className="p-6 max-w-4xl">
7670
<div className="mb-8">
@@ -85,9 +79,10 @@ const EntitiesPage: React.FC = () => {
8579
type="text"
8680
value={newEntityName}
8781
onChange={(e) => setNewEntityName(e.target.value)}
88-
onKeyPress={handleKeyPress}
82+
onKeyDown={(e) => { if (e.key === 'Enter') {handleNewEntity();}}}
8983
placeholder="Enter entity name"
9084
className="w-full p-2.5 rounded-lg border border-gray-300 focus:ring-2 focus:ring-green-200 focus:border-green-500 transition-colors duration-200"
85+
required
9186
/>
9287
</div>
9388
<button

0 commit comments

Comments
 (0)