a5c4bcb821
- backend: career-advice module with analyze/chat/positions endpoints - frontend: career.vue page with profile form, AI advice, recommendation cards - config/api/pages/user.vue: full integration into existing flow - docs: PROJECT-STATUS v4.5, FEATURE-LIST v4.3, ROADMAP v4.3 - AGENTS.md: updated module count and career link paths
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { Controller, Post, Get, Body } from "@nestjs/common"
|
|
import { Public } from "../../common/decorators/public.decorator"
|
|
import { CareerAdviceService, CareerProfile, ChatMessage } from "./career-advice.service"
|
|
import { CurrentUser } from "../../common/decorators/current-user.decorator"
|
|
|
|
@Controller("career-advice")
|
|
export class CareerAdviceController {
|
|
constructor(private service: CareerAdviceService) {}
|
|
|
|
@Post("analyze")
|
|
async analyze(
|
|
@Body() profile: CareerProfile,
|
|
@CurrentUser("userId") userId: string,
|
|
) {
|
|
if (!profile.major || !profile.major.trim()) {
|
|
return { error: "请填写你的专业" }
|
|
}
|
|
return this.service.analyze(profile)
|
|
}
|
|
|
|
@Post("chat")
|
|
async chat(
|
|
@Body() body: { message: string; history: ChatMessage[] },
|
|
@CurrentUser("userId") userId: string,
|
|
) {
|
|
if (!body.message || !body.message.trim()) {
|
|
return { error: "请输入消息" }
|
|
}
|
|
return this.service.chat(body.message, body.history || [])
|
|
}
|
|
|
|
@Get("positions")
|
|
@Public()
|
|
async positions() {
|
|
return this.service.getHotPositions()
|
|
}
|
|
}
|