Skip to content

Agent frontend#283

Open
CHELSEADOPAMIN wants to merge 11 commits intomainfrom
agent-frontend
Open

Agent frontend#283
CHELSEADOPAMIN wants to merge 11 commits intomainfrom
agent-frontend

Conversation

@CHELSEADOPAMIN
Copy link
Collaborator

Screenshot 2026-01-15 at 17 20 03 实现了 agent的前端 可以生成 cover letter 和 parent letter

@vercel
Copy link

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
qrent-frontend Ready Ready Preview, Comment Jan 25, 2026 4:03am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements an agent-powered frontend for the Qrent platform that enables users to generate rental cover letters and parent guarantee letters using AI assistance.

Changes:

  • Adds a comprehensive AI assistant frontend using the @assistant-ui/react library with streaming chat capabilities
  • Implements a backend agent service using LangGraph with RAG (Retrieval-Augmented Generation) for rental knowledge queries and automated cover letter generation
  • Integrates the assistant UI as a resizable sidebar panel alongside existing application content

Reviewed changes

Copilot reviewed 51 out of 68 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
pnpm-lock.yaml Added dependencies for assistant-ui React components, Radix UI components, and typography plugin
packages/frontend/package.json Updated with new frontend dependencies for the AI assistant interface
packages/frontend/src/lib/trpc.ts Improved error handling type safety in retry logic
packages/frontend/src/lib/templates.ts Added cover letter data types and prompt generation logic
packages/frontend/src/components/ui/* Added new UI components (tooltip, resizable, dialog, avatar) to support the assistant interface
packages/frontend/src/components/assistant-ui/* Implemented complete assistant UI with thread management, markdown rendering, and file attachments
packages/frontend/src/components/CoverLetterForm.tsx Created comprehensive form for collecting user information to generate cover letters
packages/frontend/src/components/AIChatBox.tsx Enhanced existing chat component with markdown support and cover letter form integration
packages/frontend/src/app/layout.tsx Removed duplicate AIChatBox components from root layout
packages/frontend/src/app/[locale]/layout.tsx Wrapped application in MyAssistant provider for AI functionality
packages/frontend/src/app/api/assistant/chat/route.ts Created API route to proxy requests to the backend agent service
packages/agent/* Complete restructure of agent package with LangGraph-based architecture, RAG tools, and cover letter generation
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,100 @@
import { NextRequest } from 'next/server';

const BACKEND_URL = 'http://45.32.212.237:8000/stream';
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded backend URL http://45.32.212.237:8000/stream exposes infrastructure details and creates a security risk. This should be moved to an environment variable (e.g., NEXT_PUBLIC_ASSISTANT_API_URL) for better security and configurability across environments.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
"" No newline at end of file
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty file config/__init__.py contains only "" instead of being truly empty or having a proper docstring. This should either be removed entirely or contain a proper empty string/docstring like """Configuration module."""

Suggested change
""
"""Configuration module."""

Copilot uses AI. Check for mistakes.
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.2).with_config({"async": True})
TOOLS = ALL_TOOLS
TOOLS_BY_NAME = TOOLS_BY_NAME
CONSULTANT_PROMPT = CONSULTANT_PROMPT = """
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable CONSULTANT_PROMPT is defined redundantly with a double assignment operator (CONSULTANT_PROMPT = CONSULTANT_PROMPT = ...). This is likely a typo and should be a single assignment.

Copilot uses AI. Check for mistakes.
# 工作人员版本
elif data.user_type == "worker":
# 中文工作者身份
employer_name = data.employer_name if data.employer_name else "[请在此处补充公司名称]"
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tool accesses data.employer_name on line 109, but this field is not defined in the FullApplicationInput model. This will cause an AttributeError when user_type is "worker". The employer_name field should be added to the model or this logic should be refactored to use existing fields.

Copilot uses AI. Check for mistakes.
__pycache__/
Qrent_knowledge_base/
coverletter.ts
<<<<<<< HEAD
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .gitignore file has a Git merge conflict marker (<<<<<<< HEAD) at line 1 that was not resolved. This needs to be cleaned up before merging.

Suggested change
<<<<<<< HEAD

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,11 @@
import os
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'os' is not used.

Suggested change
import os

Copilot uses AI. Check for mistakes.
from langgraph.runtime import Runtime
from typing_extensions import TypedDict

import json
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'json' is not used.

Copilot uses AI. Check for mistakes.
from typing_extensions import TypedDict

import json
import asyncio
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'asyncio' is not used.

Copilot uses AI. Check for mistakes.
Comment on lines 19 to 21
from langchain_core.messages import (
BaseMessage, HumanMessage, SystemMessage, ToolMessage, AIMessage
)
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'HumanMessage' is not used.
Import of 'AIMessage' is not used.

Copilot uses AI. Check for mistakes.
from langchain_core.messages import (
BaseMessage, HumanMessage, SystemMessage, ToolMessage, AIMessage
)
from langchain_core.runnables import RunnableConfig
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'RunnableConfig' is not used.

Copilot uses AI. Check for mistakes.
@wiperi
Copy link
Owner

wiperi commented Jan 18, 2026

Would it better to put the code change of the agent in a separate PR?

@wiperi
Copy link
Owner

wiperi commented Jan 18, 2026

Please reference current ai-chatbot design i.e. fold/unfold button, floating chat box. Sliding side bar looks nice on PC but it might bring trouble to mobile users. We want to put mobile user experience on the first place.

Copy link
Owner

@wiperi wiperi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better let AI put some description text on the beginning of each file / components. This might help other human / AI better understand the code structure.

@wiperi
Copy link
Owner

wiperi commented Jan 25, 2026

image

may be we can put these 2 button together. On the bottom of the page.

@wiperi
Copy link
Owner

wiperi commented Jan 25, 2026

image

I think we may need to adjust the size and location of chat box for mobile size. Remove the gap between chat box and switch button.

and avoid overflowing on the right side, make it at the center of screen.

@wiperi
Copy link
Owner

wiperi commented Jan 25, 2026

image

may be wen can enhance the style of button. Add some enhancement based on current button style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants