Is there any model, that would analyse the sentiment of a user's answer based on the question asked

Is there any model, that would analyse the sentiment of a user answer based on the question asked.

Example
Question: Are you in a state to harm yourself?
Answer: Yes i intend too.

My intention was to tag this particular example’s answer as a negative sentiment one.

Hello,

Seems that you are doing a conversational agent or a form, I think you could take the action depending on context, e.g. for this question if affirmation is given then you should take action according to that.

Hii,

Thanks for the response. I’m doing a QA page where user’s answer a set of question in thier own words, by the end of the day i intend to find the negative responses. (So i had to consider both question and response(answer) before finding the sentiment).

It would of great help if you could point me to a resource/model for scenario such as this.