brestok commited on
Commit
8e611c3
·
1 Parent(s): c6cc0f2
trauma/api/message/ai/prompts.py CHANGED
@@ -111,10 +111,6 @@ Je moet een antwoord genereren aan de gebruiker waarin je aangeeft dat je geschi
111
 
112
  You must determine whether the user's request is valid. Provide your answer in the [is_valid] field in JSON format.
113
 
114
- ## Context
115
-
116
- You are Bennie, an AI assistant specializing in trauma-related therapy and mental health provider recommendations. Your expertise includes trauma treatment types (EMDR, pre-verbal EMDR, Slapende Honden method), age-specific therapy needs, and special cases like transgender-related trauma or low IQ (LVB) therapy.
117
-
118
  ## Data
119
 
120
  **User Request**:
@@ -139,13 +135,10 @@ You are Bennie, an AI assistant specializing in trauma-related therapy and menta
139
 
140
  ## Instructions for Filling JSON
141
 
142
- The field is considered valid (`is_valid = true`) if the user's message is:
143
- - trauma-related therapy and mental health provider recommendations
144
- - trauma treatment types (EMDR, pre-verbal EMDR, Slapende Honden method)
145
- - age-specific therapy needs
146
- - special cases like transgender-related trauma or low IQ (LVB) therapy
147
-
148
- In the other cases, `is_valid` must be set to `false`.
149
 
150
  [/INST]"""
151
  generate_invalid_response = """## Taak
 
111
 
112
  You must determine whether the user's request is valid. Provide your answer in the [is_valid] field in JSON format.
113
 
 
 
 
 
114
  ## Data
115
 
116
  **User Request**:
 
135
 
136
  ## Instructions for Filling JSON
137
 
138
+ The field is considered valid (`is_valid = true`) if:
139
+ - The user describes the patient, their data, illness, treatment method, etc.
140
+ - The user's request relates to a medical topic.
141
+ - The user's request is a valid response to the assistant's question.
 
 
 
142
 
143
  [/INST]"""
144
  generate_invalid_response = """## Taak
trauma/api/message/views.py CHANGED
@@ -18,7 +18,7 @@ from trauma.core.wrappers import TraumaResponseWrapper
18
  @message_router.get('/{chatId}/all')
19
  async def get_all_chat_messages(
20
  chatId: str,
21
- account: AccountModel = Depends(PermissionDependency([AccountType.Admin]))
22
  ) -> AllMessageWrapper:
23
  messages, _ = await get_all_chat_messages_obj(chatId, account)
24
  response = AllMessageResponse(
 
18
  @message_router.get('/{chatId}/all')
19
  async def get_all_chat_messages(
20
  chatId: str,
21
+ account: AccountModel = Depends(PermissionDependency([AccountType.Admin, AccountType.User])),
22
  ) -> AllMessageWrapper:
23
  messages, _ = await get_all_chat_messages_obj(chatId, account)
24
  response = AllMessageResponse(
trauma/core/security.py CHANGED
@@ -44,6 +44,8 @@ class PermissionDependency:
44
 
45
  except JWTError:
46
  raise HTTPException(status_code=403, detail="Permission denied")
 
 
47
 
48
  @staticmethod
49
  async def get_account_by_id(account_id: str) -> dict:
 
44
 
45
  except JWTError:
46
  raise HTTPException(status_code=403, detail="Permission denied")
47
+ except Exception:
48
+ raise HTTPException(status_code=403, detail="Permission denied")
49
 
50
  @staticmethod
51
  async def get_account_by_id(account_id: str) -> dict: