-
Notifications
You must be signed in to change notification settings - Fork 2
feat(ai): Integrate AiChat with webservice SmartQL API #37
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
Conversation
Connect AIChat component to the Laravel API which proxies to SmartQL. Add aiApi service for API communication. Render query results based on format_type (scalar, pair, record, list, pair_list, table, raw) with appropriate styling for each format. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Set up Vitest with happy-dom for component testing. Add tests for aiApi service and AIChat component covering all format type renderings and error handling. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Deploying webui with
|
| Latest commit: |
16b86b1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://13a5527d.webui-9fh.pages.dev |
| Branch Preview URL: | https://ai-insights.webui-9fh.pages.dev |
Code Review SummaryThis pull request introduces significant enhancements to the application, primarily by implementing an AI chat feature with structured data display and by establishing a robust testing framework across the project. The changes include adding a new API service for AI interactions, creating a sophisticated 🚀 Key Improvements
💡 Minor Suggestions
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete. See the overview comment for a summary.
🔍 Code Review💡 1. **.github/workflows/checks.yml** (Line 1) - CLARITYThe workflow name has been updated from 'Lint' to 'CI', which is more descriptive given that the workflow now includes linting, formatting, and testing jobs. This improves the clarity of the workflow's purpose. Suggested Code: Current Code: name: Lint💡 2. **.github/workflows/checks.yml** (Lines 34-51) - IMPROVEMENTA new Suggested Code: 💡 3. **components/ai/AIChat.vue** (Lines 1-67) - IMPROVEMENTThe Suggested Code: Current Code: <template>
<div class="ai-chat card">
<h2 class="title">AI Insights Chat</h2>
<div class="chat-window">
<div
v-for="(message, index) in chatHistory"
:key="index"
class="chat-row"
:class="message.type"
>
<div class="bubble" :class="message.type">{{ message.text }}</div>💡 4. **components/ai/AIChat.vue** (Lines 79-83) - IMPROVEMENTDisabling the input and send button while the AI is processing prevents multiple submissions and provides clear user feedback. The dynamic button text ( Suggested Code: Current Code: placeholder="Ask me anything about your finances..."
/>
<button type="submit" class="send-btn">Send</button>💡 5. **components/ai/AIChat.vue** (Lines 89-165) - REFACTORThe refactoring of the Suggested Code: Current Code: <script setup>
import { ref } from 'vue';
const chatHistory = ref([
{ type: 'ai', text: 'Hello! I am your personal financial assistant. How can I help you today?' }
]);
const input = ref('');
const handleSendMessage = () => {
if (!input.value.trim()) return;
const userMessage = { type: 'user', text: input.value };
chatHistory.value.push(userMessage);
let aiResponse = 'I am not quite sure how to answer that yet. Please try a different query.';
const lower = input.value.toLowerCase();
if (lower.includes('highest-paying months')) {
aiResponse =
"Based on last year's data, your highest-paying months were November ($8,500) and December ($7,900) due to holiday bonuses and year-end client projects.";
} else if (lower.includes('on track to save')) {
aiResponse =
'Yes, you are currently on track to save 20% of your income. Your current savings rate is 21.5%, which is slightly ahead of your goal.';
}
setTimeout(() => {
chatHistory.value.push({ type: 'ai', text: aiResponse });
}, 600);
input.value = '';
};💡 6. **package.json** (Lines 35-40) - IMPROVEMENTAdding Suggested Code: 💡 7. **tests/components/AIChat.test.ts** (Lines 1-440) - IMPROVEMENTAdding a dedicated test file for Suggested Code: 💡 8. **tests/components/TransactionForm.test.ts** (Lines 1-289) - IMPROVEMENTAdding a comprehensive test file for Suggested Code: 💡 9. **tests/pages/categories.test.ts** (Lines 1-230) - IMPROVEMENTThe new test file for Suggested Code: 💡 10. **tests/pages/dashboard.test.ts** (Lines 1-219) - IMPROVEMENTThe new test file for Suggested Code: 💡 11. **tests/pages/groups.test.ts** (Lines 1-185) - IMPROVEMENTThe new test file for Suggested Code: 💡 12. **tests/pages/wallets.test.ts** (Lines 1-165) - IMPROVEMENTThe new test file for Suggested Code: 💡 13. **tests/services/aiApi.test.ts** (Lines 1-107) - IMPROVEMENTThe new test file Suggested Code: Verdict: APPROVE Posted as a comment because posting a review failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete. See the overview comment for a summary.
Add tests for: - TButton component (variants, sizes, states, loading) - TransactionForm (validation, submission, editing) - Dashboard KPIs (wallet selector, statistics display) - Wallets page logic (CRUD operations) - Groups page logic (CRUD operations) - Categories page logic (filtering, CRUD operations) Update CI workflow to run tests before build. Signed-off-by: nfebe <fenn25.fn@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete. See the overview comment for a summary.
No description provided.