File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22Imports AI_Contracts
33Public Class AI_AgentModel
44 'ShortTerm Memory
5- Private PreviousResponses As List( Of String )
6- Private PreviousUserInputs As List( Of String )
5+ Private PreviousResponses As New List( Of String )
6+ Private PreviousUserInputs As New List( Of String )
77
88 'Working Memory
99 Public PreviousResponse As String
@@ -27,7 +27,10 @@ Public Class AI_AgentModel
2727 'IF NO RESPONSE TRY - Question Answer Database
2828 If GET_RESPONSE = "" Then GetQAResponse(UserInput, GET_RESPONSE)
2929 'TRY EMOTIONAL RESPONSE
30- If GET_RESPONSE = "" And Sentiment.NewEmotionDetected(UserInput) = True Then Sentiment.MakeEmotionalResponse()
30+ If GET_RESPONSE = "" And Sentiment.NewEmotionDetected(UCase(UserInput)) = True Then
31+ GET_RESPONSE = Sentiment.MakeEmotionalResponse()
32+ End If
33+
3134 'IF No Response Fallback Response
3235 If GET_RESPONSE = "" Then GET_RESPONSE = "Excuse me? Please, Rephrase?"
3336
Original file line number Diff line number Diff line change 7070 MakeEmotionalResponse = "" & LCase(FoundEmotion) & " "
7171 End Select
7272 End Function
73- Private Sub SetEmotionState( ByRef UserInput As String )
73+
74+ Private Sub ResetStateCounters()
7475 'Reset Counters
7576 StateChanged = False
7677 DetectedState = EmotionType.Neutral
7778 StateDetected = False
79+ End Sub
80+ Private Sub SetCurrentQuotient()
81+ 'Check if neutral - Then reduce current Quotient
82+ If Handler.DetectedEmotion = EmotionType.Neutral Then
83+ CurrentQuotient -= 1
84+ If CurrentQuotient = 0 Then
85+ CurrentState = EmotionType.Neutral
86+ Else
87+ End If
88+ End If
89+ End Sub
90+
91+ Private Handler As New EmotionHandler
92+
93+ Private Sub SetEmotionState( ByRef UserInput As String )
94+ ResetStateCounters()
7895
7996 'Start - Emotion Test
80- Dim Handler As New EmotionHandler
8197 If Handler.DetectEmotion(UserInput) = True Then
82- 'Check if neutral - Then reduce current Quotient
83- If Handler.DetectedEmotion = EmotionType.Neutral Then
84- CurrentQuotient -= 1
85- If CurrentQuotient = 0 Then
86- CurrentState = EmotionType.Neutral
87- Else
88- End If
89- End If
98+
99+ SetCurrentQuotient()
90100
91101 'Get State
92102 DetectedState = Handler.DetectedEmotion
93103 StateDetected = True
94104 'IF State is the same Increase Intensity
95105 If DetectedState = CurrentState Then
96106 CurrentQuotient += 1
107+ CurrentStateStr = Handler.DetectedEmotionStr
108+ CurrentState = DetectedState
97109 Else
98110 'IF State is the differnt then change
99111 CurrentStateStr = Handler.DetectedEmotionStr
You can’t perform that action at this time.
0 commit comments