Compare commits

..

2 Commits

Author SHA1 Message Date
Jonas Luz Jr. ff19156d49 Updates Test scene. 2025-11-23 13:49:14 -03:00
Jonas Luz Jr. ebcb98d8d3 Improves /chat/ endpoint client. 2025-11-23 13:46:51 -03:00
12 changed files with 536 additions and 308 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a9e9a88d8a4978c4ba0e6bf106276b7a guid: b8301e63683d16d41abf9fbbf3b74507
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f21e446ea6b394b43b44c4d1e396ff48
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,337 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3050228793350555746
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3228149243574310962}
m_Layer: 0
m_Name: -- GAME MANAGER --
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3228149243574310962
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3050228793350555746}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7625920793580372814}
- {fileID: 8663494998515940154}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4601626619299515270
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7625920793580372814}
- component: {fileID: 1118623755729130604}
- component: {fileID: 4693018637014637836}
m_Layer: 0
m_Name: -- API Manager --
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7625920793580372814
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4601626619299515270}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3228149243574310962}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &1118623755729130604
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4601626619299515270}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &4693018637014637836
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4601626619299515270}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6df1f7169d6eca04abd7db0f712639ff, type: 3}
m_Name:
m_EditorClassIdentifier: PpgiaX540P3::PPGIA.X540.Project3.ApiClient
_apiBaseUrlDev: http://127.0.0.1:8000
_apiBaseUrlProd: https://gyzypaneqa.execute-api.us-east-1.amazonaws.com/api/
_environment: 0
_sessionInitEndpoint: /session/init
_sessionCloseEndpoint: /session/close
_chatEndpoint: /chat/
_llmAgentEndpoint: /agent/ask
_ttsEndpoint: /tts/synthesize
_sttEndpoint: /stt/upload
_clientId: unity-client
_timeoutInSeconds: 10
_query: 'Onde o caso do ET de Varginha foi registrado? '
_session:
session_id: 40abe282-9485-4bbd-aa3a-8d7209706626
created_at: 1763850149
_audioSource: {fileID: 1118623755729130604}
--- !u!1 &5836695571582163658
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8663494998515940154}
- component: {fileID: 1938294408165125026}
- component: {fileID: 796320736253214861}
m_Layer: 0
m_Name: -- AudioManager --
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8663494998515940154
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5836695571582163658}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3228149243574310962}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1938294408165125026
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5836695571582163658}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9523fc2f4430eb549ab3da789eaf70c1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PPGIA.X540.Project3.AudioCapture
_sampleRateInHz: 16000
_playingBack: 0
--- !u!82 &796320736253214861
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5836695571582163658}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 4597973050289367049, guid: b4346293b16e5254aadce52e891ff5e9, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 004ea84725223334994cf72d2115c180
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1c0f6c45ec256d441853e0c8509018da guid: 2a324b79bfeaa9842b22d76378b74b5d
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -119,150 +119,6 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &248765892
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 248765894}
- component: {fileID: 248765893}
- component: {fileID: 248765895}
m_Layer: 0
m_Name: -- AudioManager --
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &248765893
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 248765892}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9523fc2f4430eb549ab3da789eaf70c1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PPGIA.X540.Project3.AudioCapture
_sampleRateInHz: 16000
_playingBack: 0
--- !u!4 &248765894
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 248765892}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1044611067}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &248765895
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 248765892}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 4597973050289367049, guid: b4346293b16e5254aadce52e891ff5e9, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &330585543 --- !u!1 &330585543
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -308,12 +164,12 @@ Camera:
m_ShutterSpeed: 0.005 m_ShutterSpeed: 0.005
m_Aperture: 16 m_Aperture: 16
m_FocusDistance: 10 m_FocusDistance: 10
m_FocalLength: 50 m_FocalLength: 20.78461
m_BladeCount: 5 m_BladeCount: 5
m_Curvature: {x: 2, y: 11} m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25 m_BarrelClipping: 0.25
m_Anamorphism: 0 m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24} m_SensorSize: {x: 10.26, y: 7.49}
m_LensShift: {x: 0, y: 0} m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
@ -323,7 +179,7 @@ Camera:
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.3
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 20.42808
orthographic: 0 orthographic: 0
orthographic size: 5 orthographic size: 5
m_Depth: -1 m_Depth: -1
@ -349,8 +205,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543} m_GameObject: {fileID: 330585543}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: 0.021995738, z: -0, w: 0.9997581}
m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalPosition: {x: -0.05, y: 1.5, z: -1}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -576,95 +432,79 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1044611066 --- !u!1001 &7579352147520404884
GameObject: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1044611067}
m_Layer: 0
m_Name: -- GAME MANAGER --
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1044611067
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1044611066}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_Modification:
m_LocalPosition: {x: 0, y: 0, z: 0} serializedVersion: 3
m_LocalScale: {x: 1, y: 1, z: 1} m_TransformParent: {fileID: 0}
m_ConstrainProportionsScale: 0 m_Modifications:
m_Children: - target: {fileID: 1118623755729130604, guid: 004ea84725223334994cf72d2115c180, type: 3}
- {fileID: 1912693322} propertyPath: OutputAudioMixerGroup
- {fileID: 248765894} value:
m_Father: {fileID: 0} objectReference: {fileID: 4597973050289367049, guid: b4346293b16e5254aadce52e891ff5e9, type: 2}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - target: {fileID: 3050228793350555746, guid: 004ea84725223334994cf72d2115c180, type: 3}
--- !u!1 &1912693321 propertyPath: m_Name
GameObject: value: -- GAME MANAGER --
m_ObjectHideFlags: 0 objectReference: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 0} - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
m_PrefabInstance: {fileID: 0} propertyPath: m_LocalPosition.x
m_PrefabAsset: {fileID: 0} value: 0
serializedVersion: 6 objectReference: {fileID: 0}
m_Component: - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
- component: {fileID: 1912693322} propertyPath: m_LocalPosition.y
- component: {fileID: 1912693323} value: 0
m_Layer: 0 objectReference: {fileID: 0}
m_Name: -- API Manager -- - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
m_TagString: Untagged propertyPath: m_LocalPosition.z
m_Icon: {fileID: 0} value: 0
m_NavMeshLayer: 0 objectReference: {fileID: 0}
m_StaticEditorFlags: 0 - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
m_IsActive: 1 propertyPath: m_LocalRotation.w
--- !u!4 &1912693322 value: 1
Transform: objectReference: {fileID: 0}
m_ObjectHideFlags: 0 - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
m_CorrespondingSourceObject: {fileID: 0} propertyPath: m_LocalRotation.x
m_PrefabInstance: {fileID: 0} value: 0
m_PrefabAsset: {fileID: 0} objectReference: {fileID: 0}
m_GameObject: {fileID: 1912693321} - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
serializedVersion: 2 propertyPath: m_LocalRotation.y
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} value: 0
m_LocalPosition: {x: 0, y: 0, z: 0} objectReference: {fileID: 0}
m_LocalScale: {x: 1, y: 1, z: 1} - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
m_ConstrainProportionsScale: 0 propertyPath: m_LocalRotation.z
m_Children: [] value: 0
m_Father: {fileID: 1044611067} objectReference: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
--- !u!114 &1912693323 propertyPath: m_LocalEulerAnglesHint.x
MonoBehaviour: value: 0
m_ObjectHideFlags: 0 objectReference: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 0} - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
m_PrefabInstance: {fileID: 0} propertyPath: m_LocalEulerAnglesHint.y
m_PrefabAsset: {fileID: 0} value: 0
m_GameObject: {fileID: 1912693321} objectReference: {fileID: 0}
m_Enabled: 1 - target: {fileID: 3228149243574310962, guid: 004ea84725223334994cf72d2115c180, type: 3}
m_EditorHideFlags: 0 propertyPath: m_LocalEulerAnglesHint.z
m_Script: {fileID: 11500000, guid: 6df1f7169d6eca04abd7db0f712639ff, type: 3} value: 0
m_Name: objectReference: {fileID: 0}
m_EditorClassIdentifier: PpgiaX540P3::PPGIA.X540.Project3.ApiClient - target: {fileID: 4693018637014637836, guid: 004ea84725223334994cf72d2115c180, type: 3}
_apiBaseUrl: https://gyzypaneqa.execute-api.us-east-1.amazonaws.com/api/ propertyPath: _query
_sessionInitEndpoint: /session/init value: 'Bom dia, guru! '
_sessionCloseEndpoint: /session/close objectReference: {fileID: 0}
_llmAgentEndpoint: /agent/ask - target: {fileID: 4693018637014637836, guid: 004ea84725223334994cf72d2115c180, type: 3}
_ttsEndpoint: /tts/synthesize propertyPath: _session.created_at
_sttEndpoint: /stt/upload value: 1763908462
_clientId: unity-client objectReference: {fileID: 0}
_timeoutInSeconds: 10 - target: {fileID: 4693018637014637836, guid: 004ea84725223334994cf72d2115c180, type: 3}
_query: propertyPath: _session.session_id
_session: value: 9686ca2a-302a-4ac8-8709-a98067d37530
session_id: ddcc99fb-0474-4968-9b0c-ae13c56dfba6 objectReference: {fileID: 0}
created_at: 1763819290 m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 004ea84725223334994cf72d2115c180, type: 3}
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -672,4 +512,4 @@ SceneRoots:
- {fileID: 330585546} - {fileID: 330585546}
- {fileID: 410087041} - {fileID: 410087041}
- {fileID: 832575519} - {fileID: 832575519}
- {fileID: 1044611067} - {fileID: 7579352147520404884}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 99c9720ab356a0642a771bea13969a05 guid: 2970b36c4604a124a9fb330c622eb61c
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -52,7 +52,7 @@ namespace PPGIA.X540.Project3.API
byte[] bodyRaw = EncodePayload(payload); byte[] bodyRaw = EncodePayload(payload);
Debug.Log($"Payload size: {bodyRaw.Length} bytes - {payload}"); Debug.Log($"Payload size: {bodyRaw.Length} bytes - {payload}");
request.uploadHandler = new UploadHandlerRaw(bodyRaw); request.uploadHandler = new UploadHandlerRaw(bodyRaw);
} }
request.downloadHandler = new DownloadHandlerBuffer(); request.downloadHandler = new DownloadHandlerBuffer();
@ -86,7 +86,7 @@ Response Body: {body}";
} }
internal static IEnumerator CallEndpointWithGetCoroutine( internal static IEnumerator CallEndpointWithGetCoroutine(
string url, float timeoutInSeconds, string url, float timeoutInSeconds,
Action<UnityWebRequest> callbackOnSuccess) Action<UnityWebRequest> callbackOnSuccess)
{ {
yield return CallEndpointCoroutine( yield return CallEndpointCoroutine(
@ -94,7 +94,7 @@ Response Body: {body}";
} }
internal static IEnumerator CallEndpointWithPostCoroutine( internal static IEnumerator CallEndpointWithPostCoroutine(
string url, float timeoutInSeconds, object payload, string url, float timeoutInSeconds, object payload,
Action<UnityWebRequest> callbackOnSuccess) Action<UnityWebRequest> callbackOnSuccess)
{ {
yield return CallEndpointCoroutine( yield return CallEndpointCoroutine(
@ -102,7 +102,7 @@ Response Body: {body}";
} }
internal static IEnumerator CallEndpointWithPutCoroutine( internal static IEnumerator CallEndpointWithPutCoroutine(
string url, float timeoutInSeconds, object payload, string url, float timeoutInSeconds, object payload,
Action<UnityWebRequest> callbackOnSuccess) Action<UnityWebRequest> callbackOnSuccess)
{ {
yield return CallEndpointCoroutine( yield return CallEndpointCoroutine(
@ -110,58 +110,43 @@ Response Body: {body}";
} }
internal static IEnumerator CallEndpointWithDeleteCoroutine( internal static IEnumerator CallEndpointWithDeleteCoroutine(
string url, float timeoutInSeconds, string url, float timeoutInSeconds,
Action<UnityWebRequest> callbackOnSuccess) Action<UnityWebRequest> callbackOnSuccess)
{ {
yield return CallEndpointCoroutine( yield return CallEndpointCoroutine(
url, "DELETE", null, timeoutInSeconds, callbackOnSuccess); url, "DELETE", null, timeoutInSeconds, callbackOnSuccess);
} }
internal static IEnumerator ReadAudioResponseCoroutine( internal static IEnumerator DownloadAudioCoroutine(
UnityWebRequest request, string url,
float timeoutInSeconds,
Action<AudioClip> callbackOnSuccess) Action<AudioClip> callbackOnSuccess)
{ {
byte[] audioBytes = request.downloadHandler.data; using (UnityWebRequest mmRequest =
if (audioBytes == null || audioBytes.Length == 0) UnityWebRequestMultimedia.GetAudioClip(url, AudioType.OGGVORBIS))
{ {
Debug.LogError("No audio data received.");
yield break;
}
// Save temporarily to file for loading as AudioClip var op = mmRequest.SendWebRequest();
string tempPath = Path.Combine(Application.persistentDataPath, "tts_temp.ogg"); yield return WaitForTimeout(op, timeoutInSeconds, () =>
File.WriteAllBytes(tempPath, audioBytes);
using (var file = UnityWebRequestMultimedia.GetAudioClip(
"file://" + tempPath, AudioType.OGGVORBIS))
{
yield return file.SendWebRequest();
if (file.result == UnityWebRequest.Result.Success)
{ {
AudioClip clip = DownloadHandlerAudioClip.GetContent(file); Debug.LogError("Request timed out.");
callbackOnSuccess?.Invoke(clip); });
}
else
{
Debug.LogError($"Error loading AudioClip: {file.error}");
}
}
// Remove temporary file if (mmRequest.result != UnityWebRequest.Result.Success)
File.Delete(tempPath); {
Debug.LogError($"Error loading audio: {mmRequest.error}");
yield break;
}
AudioClip clip = DownloadHandlerAudioClip.GetContent(mmRequest);
if (clip == null)
{
Debug.LogError("AudioClip is null after download.");
yield break;
}
callbackOnSuccess?.Invoke(clip);
}
} }
} }
internal enum Environment
{
Development,
Production
}
[Serializable]
internal struct ChatServicePayload
{
public string message;
}
} }

View File

@ -90,6 +90,8 @@ namespace PPGIA.X540.Project3.API
[ContextMenu("Initiate Session")] [ContextMenu("Initiate Session")]
public void InitiateSession() public void InitiateSession()
{ {
StopAllCoroutines();
var url = EndpointUrl(_sessionInitEndpoint, _clientId); var url = EndpointUrl(_sessionInitEndpoint, _clientId);
StartCoroutine(ApiClient.CallEndpointWithPostCoroutine( StartCoroutine(ApiClient.CallEndpointWithPostCoroutine(
@ -103,13 +105,15 @@ namespace PPGIA.X540.Project3.API
[ContextMenu("Close Session")] [ContextMenu("Close Session")]
public void CloseSession() public void CloseSession()
{ {
if (_session == null) if (_session == null)
{ {
Debug.LogWarning("No active session to close."); Debug.LogWarning("No active session to close.");
return; return;
} }
StopAllCoroutines();
var url = EndpointUrl(_sessionCloseEndpoint, _session.SessionId); var url = EndpointUrl(_sessionCloseEndpoint, _session.SessionId);
StartCoroutine(ApiClient.CallEndpointWithDeleteCoroutine( StartCoroutine(ApiClient.CallEndpointWithDeleteCoroutine(
@ -130,6 +134,8 @@ namespace PPGIA.X540.Project3.API
return; return;
} }
StopAllCoroutines();
// Build the endpoint URL and payload // Build the endpoint URL and payload
var url = EndpointUrl(_chatEndpoint, _session.SessionId); var url = EndpointUrl(_chatEndpoint, _session.SessionId);
var payload = new ChatServicePayload { message = _query }; var payload = new ChatServicePayload { message = _query };
@ -138,8 +144,18 @@ namespace PPGIA.X540.Project3.API
StartCoroutine(ApiClient.CallEndpointWithPostCoroutine( StartCoroutine(ApiClient.CallEndpointWithPostCoroutine(
url, _timeoutInSeconds, payload, (request) => url, _timeoutInSeconds, payload, (request) =>
{ {
StartCoroutine(ApiClient.ReadAudioResponseCoroutine( var body = request.downloadHandler?.text ?? string.Empty;
request, (audioClip) => var response = ApiModel.FromJson<ChatServiceResponse>(body);
var audioUrl = response?.AudioUrl;
if (string.IsNullOrEmpty(audioUrl))
{
Debug.LogWarning("No audio URL in response.");
return;
}
Debug.Log($"Downloading audio from: {audioUrl}");
StartCoroutine(ApiClient.DownloadAudioCoroutine(
audioUrl, _timeoutInSeconds, (audioClip) =>
{ {
if (audioClip == null) if (audioClip == null)
{ {

View File

@ -0,0 +1,56 @@
using System;
using UnityEngine;
namespace PPGIA.X540.Project3.API
{
[Serializable]
public class ApiModel
{
public static T FromJson<T>(string json) =>
JsonUtility.FromJson<T>(json);
public static string ToJson<T>(T obj) =>
JsonUtility.ToJson(obj);
}
[Serializable]
public class Session: ApiModel
{
public string session_id;
public string created_at;
// Optional convenience properties with C#-style names:
public string SessionId => session_id;
public DateTime CreatedAt => DateTime.Parse(created_at);
}
[Serializable]
public class ChatServicePayload : ApiModel
{
public string message;
}
public class ChatServiceResponse : ApiModel
{
public string session_id;
public string message;
public string audio_url;
public string audio_key;
public int expires_in;
// Optional convenience properties with C#-style names:
public string SessionId => session_id;
public string Message => message;
public string AudioUrl => audio_url;
public string AudioKey => audio_key;
public int ExpiresIn => expires_in;
}
internal enum Environment
{
Development,
Production
}
}

View File

@ -1,21 +0,0 @@
using System;
using UnityEngine;
namespace PPGIA.X540.Project3.API
{
[Serializable]
public class Session
{
public string session_id;
public string created_at;
// Optional convenience properties with C#-style names:
public string SessionId => session_id;
public DateTime CreatedAt => DateTime.Parse(created_at);
public static Session FromJson(string json) =>
JsonUtility.FromJson<Session>(json);
}
}