feat: orchestrate goals with local and cloud models
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Body, Controller, Get, Headers, Inject, Param, Post, Query } from '@nestjs/common';
|
||||
import { ok } from '../common/api-response.js';
|
||||
import { actorFromHeaders } from '../common/auth-context.js';
|
||||
import { GoalsService, type GoalStartInput } from './goals.service.js';
|
||||
|
||||
@Controller('api/v1/goals')
|
||||
export class GoalsController {
|
||||
constructor(@Inject(GoalsService) private readonly service: GoalsService) {}
|
||||
|
||||
@Post()
|
||||
async start(@Body() body: GoalStartInput, @Headers() headers: Record<string, string | string[] | undefined>) {
|
||||
return ok(await this.service.start(body, actorFromHeaders(headers)));
|
||||
}
|
||||
|
||||
@Get()
|
||||
list(@Headers() headers: Record<string, string | string[] | undefined>, @Query('limit') limit?: string) {
|
||||
return ok(this.service.list(actorFromHeaders(headers), Number(limit) || 20));
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
get(@Param('id') id: string, @Headers() headers: Record<string, string | string[] | undefined>) {
|
||||
return ok(this.service.get(id, actorFromHeaders(headers)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user