UNPKG

@inworld/web-core

Version:
25 lines (24 loc) 1.13 kB
import { Feedback as FeedbackPb, } from '../../../proto/ai/inworld/engine/v1/feedback.pb.js'; import { SCENE_PATTERN } from '../../common/constants.js'; import { Feedback } from '../../entities/feedback.entity.js'; import { PbService } from './pb.service.js'; export class FeedbackService extends PbService { async createInteractionFeedback(props) { const { scene, correlationId = 'default', config, interactionFeedback, interactionId, session, } = props; const workspace = SCENE_PATTERN.exec(scene)[1]; const response = await this.request(config, session, FeedbackPb.CreateInteractionFeedback, { parent: `workspaces/${workspace}/` + `sessions/${session.sessionId}/` + `interactions/${interactionId}/` + `groups/${correlationId}`, interactionFeedback, }); return Feedback.fromProto(response); } async deleteInteractionFeedback(props) { const { session, name } = props; await this.request(props.config, session, FeedbackPb.DeleteInteractionFeedback, { name, }); } }