Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
9b9bead
creating workflows
paullizer Sep 23, 2025
92db48f
fraud analyssis
paullizer Sep 23, 2025
864a80e
support agents
paullizer Sep 23, 2025
4e98d2a
update
paullizer Sep 23, 2025
64080a5
fix
paullizer Sep 23, 2025
20dc12d
updated demo
paullizer Sep 23, 2025
8df0343
Swagger lite (#469)
paullizer Sep 29, 2025
d24ff83
adding support for xlsm, Macro Excel files.
paullizer Sep 29, 2025
446b71f
Merge branch 'workflows' into Development
paullizer Sep 29, 2025
e97d470
moved into features
paullizer Sep 29, 2025
adbed01
initial
paullizer Sep 30, 2025
3292be1
added readme
paullizer Sep 30, 2025
75ca487
removed html code
paullizer Sep 30, 2025
24528ac
Update config.py (#477)
Patrick-Davis-MSFT Oct 1, 2025
e37bf50
Initial Setup for Pages documentation (#479)
paullizer Oct 2, 2025
46b9163
initial
paullizer Oct 2, 2025
58b58b0
added to base
paullizer Oct 2, 2025
5cd2f28
adding real data endpoints
paullizer Oct 2, 2025
2e0942f
Update route_backend_control_center.py
paullizer Oct 2, 2025
6ec77ee
added individual charts
paullizer Oct 3, 2025
1eda535
fix for bug 485
nadoylemsft Oct 3, 2025
e42ce5c
added document metrics
paullizer Oct 4, 2025
b225502
added links to control center
paullizer Oct 4, 2025
7841e42
debug
paullizer Oct 5, 2025
f39da82
added date
paullizer Oct 6, 2025
a8221b9
fixed bugs due to branch descrepancies
cjackson202 Oct 6, 2025
3e3c8c8
added Azure SQL Driver Docker File
cjackson202 Oct 7, 2025
c93ea7b
added documentation for docker_fileSession updates
cjackson202 Oct 7, 2025
8c5c2ba
Redis Managed Identity Azure Government Support Changes
cjackson202 Oct 7, 2025
39b4528
Stop tracking ignored folders
cjackson202 Oct 8, 2025
ba1ca48
updated gitignore
cjackson202 Oct 8, 2025
95a7647
Merge branch 'cj-dev' into Development - Ensured ManagedIdentity supp…
cjackson202 Oct 8, 2025
711e0de
Merge pull request #488 from cjackson202/Development
Bionic711 Oct 10, 2025
6a3c322
Merge branch 'Development' into bugfix485
nadoylemsft Oct 10, 2025
71eff52
Merge pull request #487 from microsoft/bugfix485
Bionic711 Oct 10, 2025
33f5d8c
added sort by to table for user management
paullizer Oct 16, 2025
9e124ff
storage account size processing
paullizer Oct 16, 2025
fe75d09
Front end now shows storage account sizing
paullizer Oct 16, 2025
556f6d8
export user management list to csv
paullizer Oct 16, 2025
6e6c976
adding group management
paullizer Oct 16, 2025
f5fa596
fixing swagger generation
paullizer Oct 23, 2025
b412a60
fix
paullizer Oct 23, 2025
17e6fed
Added inline dynamic property generation
paullizer Oct 23, 2025
9ca0bf2
added YAML support
paullizer Oct 23, 2025
34b2b71
Improved muiltform vs app/json detection
paullizer Oct 23, 2025
5090eec
added Control Center Admin role
paullizer Oct 23, 2025
52ac365
ai search sizing is working for groups
paullizer Oct 24, 2025
0a0978e
group refresh fixed
paullizer Oct 24, 2025
c72dfe1
added group data fix
paullizer Oct 24, 2025
503a3e0
group table refresh
paullizer Oct 24, 2025
0f5c73f
updated export to include group docs
paullizer Oct 25, 2025
b4007c8
adding public workspace management
paullizer Oct 25, 2025
9eca474
removed sample data and consolidated row generators
paullizer Oct 25, 2025
8469bc7
Changed both caching helper functions to use the existing update_docu…
paullizer Oct 29, 2025
b520432
removed workflow, will work on that in different branch
paullizer Oct 31, 2025
044c7d9
Document Set Fingerprinting, Scope-Aware Cache Key Generation, Event-…
paullizer Nov 10, 2025
7ac37b4
added debug logging
paullizer Nov 10, 2025
3d84394
setup cache feature and ttl time to admin app settings
paullizer Nov 10, 2025
bf1f14a
removed cosmos level ttl
paullizer Nov 10, 2025
baa71a9
Keyvault for secrets (#492)
Bionic711 Nov 11, 2025
db74c0d
Feature/remove abp for pr (#510)
Bionic711 Nov 12, 2025
0fd0eae
Merge branch 'improved-search' into Development
paullizer Nov 12, 2025
2035b90
Feature/group agents actions (#521)
Bionic711 Nov 19, 2025
fab926b
Merge branch 'Data-and-Workspace-Management' into Development
paullizer Nov 19, 2025
ab0a4ef
Add cosmos activity logs container configuration
paullizer Nov 20, 2025
d50064a
incorporate branch updates Add 372 fix 489
paullizer Nov 21, 2025
41e924d
Support deployment via AZD UP (#530)
SteveCInVA Nov 23, 2025
e545917
Video Indexer, Multi-Modal Enhancements, Scope Bug
paullizer Nov 24, 2025
164459f
Conversation Management Features (#532)
paullizer Nov 24, 2025
3bf067a
Message management (#553)
paullizer Dec 19, 2025
c91d555
Configure Application from AZD Up command (#548)
SteveCInVA Dec 19, 2025
f7afced
Adds Azure Billing Plugin in Community Customizations (#546)
Bionic711 Dec 19, 2025
ef2a2a7
Security/container build (#549)
Bionic711 Dec 19, 2025
04b5c12
Feature/speech managed identity (#543)
Xeelee33 Dec 19, 2025
6a85856
Banner text color picker from Vivien (#555)
clarked-msft Dec 23, 2025
0e67ac8
Remove opencensus
clarked-msft Jan 5, 2026
460b14b
Merge pull request #559 from clarked-msft/remove-opencensus-requirement
Bionic711 Jan 6, 2026
1555dbf
Add flask instrumentation
clarked-msft Jan 6, 2026
40f5cfd
Add troubleshooting doc
clarked-msft Jan 6, 2026
74df9f8
Add troubleshooting doc
clarked-msft Jan 6, 2026
164dd80
Merge pull request #562 from clarked-msft/flask-intrumentor
Bionic711 Jan 6, 2026
3913480
Control center (#567)
paullizer Jan 13, 2026
a2bb469
Adding release notes
paullizer Jan 13, 2026
43989ac
Merge origin/main into Development - Resolved all conflicts
paullizer Jan 13, 2026
29dfbe0
fixed debug_debug_print
paullizer Jan 13, 2026
df2d77e
Updated README
paullizer Jan 13, 2026
2c7b627
Update README.md
paullizer Jan 13, 2026
9a8ce3b
Merge branch 'main' into Development
paullizer Jan 13, 2026
de013e4
accepted changes
paullizer Jan 13, 2026
49959e8
removed files
paullizer Jan 13, 2026
db0729e
GitHub Actions workflow that runs Python compilation checks on all Py…
paullizer Jan 13, 2026
1c3c133
Upated to v0.235.002
paullizer Jan 13, 2026
b20a5c7
removed debug test file
paullizer Jan 13, 2026
f70934c
Updated to v0.235.003
paullizer Jan 13, 2026
80ec215
Merge branch 'main' into Development
paullizer Jan 13, 2026
09fe817
Update python-syntax-check.yml
paullizer Jan 13, 2026
ce140f5
fixed disable group creation bug
paullizer Jan 15, 2026
4aac607
fixed bug not showing raw activity log for groups
paullizer Jan 15, 2026
9b9644e
fixed control center access to not require admin role when enabling c…
paullizer Jan 15, 2026
31ced93
fix documentation
paullizer Jan 15, 2026
e6f33c0
Update release_notes.md
paullizer Jan 15, 2026
919ed52
Update README.md
paullizer Jan 15, 2026
8878f1d
Merge branch 'main' into control-center-bug-fixes
paullizer Jan 15, 2026
646aaba
added click restrictions to top items in control center
paullizer Jan 15, 2026
2c2d92a
Merge pull request #598 from microsoft/control-center-bug-fixes
Bionic711 Jan 15, 2026
8af21bc
bug fix - fixed group member select after search, group member remova…
Xeelee33 Jan 16, 2026
3b0aa7f
Retention execution activity log (#600)
paullizer Jan 17, 2026
db25652
Merge branch 'Staging' into Development
paullizer Jan 17, 2026
305275d
Updated branch flow
paullizer Jan 17, 2026
7c04b7e
Merge pull request #608 from Xeelee33/bugfix/manage_group_errors
Bionic711 Jan 18, 2026
2ebfff6
added log_event to exceptions
paullizer Jan 20, 2026
5c58096
enforce-branch-flow
paullizer Jan 20, 2026
49c3a69
Merge branch 'Staging' into Development
paullizer Jan 20, 2026
875c338
v0.235.025 (#609)
paullizer Jan 20, 2026
d05f354
Updated searchUsers() function with inline and toast messages instead…
Xeelee33 Jan 21, 2026
3378bb9
Bugfix - removed hardcoded references to commerical cognitive service…
Xeelee33 Jan 21, 2026
db5a3f8
Support of Private Networking via Bicep / AZD (#617)
SteveCInVA Jan 21, 2026
467d7b9
Configure a user agreement that users must accept before uploading fi…
paullizer Jan 21, 2026
7525792
Merge branch 'Staging' into Development
paullizer Jan 21, 2026
74cccf4
Add default retention policy (#623)
paullizer Jan 22, 2026
ebe25ce
Web Search and other Misc items (#624)
Bionic711 Jan 22, 2026
6dbb107
Updated release notes
paullizer Jan 22, 2026
d0872e6
Create release-notes-check.yml
paullizer Jan 22, 2026
4e0a54b
added debug_print logging to web search
paullizer Jan 22, 2026
c44ca65
Updated the admin UI for web search
paullizer Jan 23, 2026
56212be
Added configuration setup to web search admin ui
paullizer Jan 23, 2026
98ac837
Added chat ui user message for web search
paullizer Jan 23, 2026
d7d9bc1
Updated release notes
paullizer Jan 23, 2026
d754af6
removed agent template gallery from release notes as its not in this …
paullizer Jan 23, 2026
efea5aa
removed broad ai foundry agent support release notes, as its not in t…
paullizer Jan 23, 2026
5cd3e1d
bugfix - fixed content safety client creation so that it creates prop…
Xeelee33 Jan 23, 2026
a639f0e
Merge pull request #632 from microsoft/v0.236.011-release-notes
Bionic711 Jan 23, 2026
258cd16
Merge pull request #636 from microsoft/Development
Bionic711 Jan 23, 2026
e20f549
pipeline trigger fix (#637)
Bionic711 Jan 23, 2026
24bca76
Merge pull request #638 from microsoft/Development
Bionic711 Jan 23, 2026
315f8fd
added events for buttons
paullizer Jan 24, 2026
1bb6863
updated the logging logic when running retention delete with archivin…
paullizer Jan 26, 2026
abe76ef
Development (#646)
paullizer Jan 26, 2026
b36325c
Development to Staging - v0.237.001 (#650)
paullizer Jan 26, 2026
42a7673
Merge branch 'main' into Staging
paullizer Jan 26, 2026
8f4ef13
Development to Staging - v0.237.003 (#655)
paullizer Jan 26, 2026
c4e04c1
Merge branch 'main' into Staging
paullizer Jan 26, 2026
9446de9
Development (#658)
paullizer Jan 26, 2026
468c7e5
Merge branch 'main' into Staging
paullizer Jan 26, 2026
6ed8e19
v0.237.005 (#673)
paullizer Jan 30, 2026
c95093d
Merge branch 'main' into Staging
paullizer Jan 30, 2026
53447c9
Development (#677)
paullizer Jan 30, 2026
12910ab
Merge branch 'main' into Staging
paullizer Jan 30, 2026
77b3385
v0.237.007 (#680)
paullizer Jan 30, 2026
4f296b5
Merge branch 'main' into Staging
paullizer Jan 30, 2026
3e208c7
v0.237.009 (#699)
paullizer Feb 9, 2026
6862f6e
Merge branch 'main' into Staging
paullizer Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions application/single_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@
EXECUTOR_TYPE = 'thread'
EXECUTOR_MAX_WORKERS = 30
SESSION_TYPE = 'filesystem'
VERSION = "0.237.007"

VERSION = "0.237.009"

SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production')

Expand Down Expand Up @@ -123,11 +122,49 @@
CLIENTS = {}
CLIENTS_LOCK = threading.Lock()

ALLOWED_EXTENSIONS = {
'txt', 'pdf', 'doc', 'docm', 'docx', 'xlsx', 'xlsm', 'xls', 'csv', 'pptx', 'html', 'jpg', 'jpeg', 'png', 'bmp', 'tiff', 'tif', 'heif', 'md', 'json',
'mp4', 'mov', 'avi', 'mkv', 'flv', 'mxf', 'gxf', 'ts', 'ps', '3gp', '3gpp', 'mpg', 'wmv', 'asf', 'm4a', 'm4v', 'isma', 'ismv',
'dvr-ms', 'wav', 'xml', 'yaml', 'yml', 'log'
# Base allowed extensions (always available)
BASE_ALLOWED_EXTENSIONS = {'txt', 'doc', 'docm', 'html', 'md', 'json', 'xml', 'yaml', 'yml', 'log'}
DOCUMENT_EXTENSIONS = {'pdf', 'docx', 'pptx', 'ppt'}
TABULAR_EXTENSIONS = {'csv', 'xlsx', 'xls', 'xlsm'}

# Updates to image, video, or audio extensions should also be made in static/js/chat/chat-enhanced-citations.js if the new file types can be natively rendered in the browser.
IMAGE_EXTENSIONS = {'jpg', 'jpeg', 'png', 'bmp', 'tiff', 'tif', 'heif', 'heic'}

# Optional extensions by feature
VIDEO_EXTENSIONS = {
'mp4', 'mov', 'avi', 'mkv', 'flv', 'mxf', 'gxf', 'ts', 'ps', '3gp', '3gpp',
'mpg', 'wmv', 'asf', 'm4v', 'isma', 'ismv', 'dvr-ms', 'webm', 'mpeg'
}

AUDIO_EXTENSIONS = {'mp3', 'wav', 'ogg', 'aac', 'flac', 'm4a'}

def get_allowed_extensions(enable_video=False, enable_audio=False):
"""
Get allowed file extensions based on feature flags.

Args:
enable_video: Whether video file support is enabled
enable_audio: Whether audio file support is enabled

Returns:
set: Allowed file extensions
"""
extensions = BASE_ALLOWED_EXTENSIONS.copy()
extensions.update(DOCUMENT_EXTENSIONS)
extensions.update(IMAGE_EXTENSIONS)
extensions.update(TABULAR_EXTENSIONS)

if enable_video:
extensions.update(VIDEO_EXTENSIONS)

if enable_audio:
extensions.update(AUDIO_EXTENSIONS)

return extensions

ALLOWED_EXTENSIONS = get_allowed_extensions(enable_video=True, enable_audio=True)

# Admin UI specific extensions (for logo/favicon uploads)
ALLOWED_EXTENSIONS_IMG = {'png', 'jpg', 'jpeg'}
MAX_CONTENT_LENGTH = 5000 * 1024 * 1024 # 5000 MB AKA 5 GB

Expand Down
159 changes: 138 additions & 21 deletions application/single_app/functions_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -4851,7 +4851,7 @@ def process_di_document(document_id, user_id, temp_file_path, original_filename,
is_pdf = file_ext == '.pdf'
is_word = file_ext in ('.docx', '.doc')
is_ppt = file_ext in ('.pptx', '.ppt')
is_image = file_ext in ('.jpg', '.jpeg', '.png', '.bmp', '.tiff', '.tif', '.heif')
is_image = file_ext in tuple('.' + ext for ext in IMAGE_EXTENSIONS)

try:
if is_pdf:
Expand Down Expand Up @@ -5233,23 +5233,138 @@ def process_audio_document(
print(f"[Debug] Transcribing chunk {idx}: {chunk_path}")

# Get fresh config (tokens expire after ~1 hour)
speech_config = _get_speech_config(settings, endpoint, locale)
try:
speech_config = _get_speech_config(settings, endpoint, locale)
except Exception as e:
print(f"[Error] Failed to get speech config for chunk {idx}: {e}")
raise RuntimeError(f"Speech configuration failed for chunk {idx}: {e}")

audio_config = speechsdk.AudioConfig(filename=chunk_path)
speech_recognizer = speechsdk.SpeechRecognizer(
speech_config=speech_config,
audio_config=audio_config
)
try:
audio_config = speechsdk.AudioConfig(filename=chunk_path)
except Exception as e:
print(f"[Error] Failed to load audio file {chunk_path}: {e}")
raise RuntimeError(f"Audio file loading failed: {e}")

result = speech_recognizer.recognize_once()
if result.reason == speechsdk.ResultReason.RecognizedSpeech:
print(f"[Debug] Recognized: {result.text}")
all_phrases.append(result.text)
elif result.reason == speechsdk.ResultReason.NoMatch:
print(f"[Warning] No speech in {chunk_path}")
elif result.reason == speechsdk.ResultReason.Canceled:
print(f"[Error] {result.cancellation_details.reason}: {result.cancellation_details.error_details}")
raise RuntimeError(f"Transcription canceled for {chunk_path}: {result.cancellation_details.error_details}")
try:
speech_recognizer = speechsdk.SpeechRecognizer(
speech_config=speech_config,
audio_config=audio_config
)
except Exception as e:
print(f"[Error] Failed to create speech recognizer for chunk {idx}: {e}")
raise RuntimeError(f"Speech recognizer creation failed: {e}")

# Use continuous recognition instead of recognize_once
all_results = []
done = False
error_occurred = False
error_message = None

def stop_cb(evt):
nonlocal done
print(f"[Debug] Session stopped for chunk {idx}")
done = True

def recognized_cb(evt):
try:
if evt.result.reason == speechsdk.ResultReason.RecognizedSpeech:
all_results.append(evt.result.text)
print(f"[Debug] Recognized: {evt.result.text}")
elif evt.result.reason == speechsdk.ResultReason.NoMatch:
print(f"[Debug] No speech recognized in segment")
except Exception as e:
print(f"[Error] Error in recognized callback: {e}")
# Don't fail on individual recognition errors

def canceled_cb(evt):
nonlocal done, error_occurred, error_message
print(f"[Debug] Recognition canceled for chunk {idx}: {evt.cancellation_details.reason}")

if evt.cancellation_details.reason == speechsdk.CancellationReason.Error:
error_occurred = True
error_message = evt.cancellation_details.error_details
print(f"[Error] Recognition error: {error_message}")
elif evt.cancellation_details.reason == speechsdk.CancellationReason.EndOfStream:
print(f"[Debug] End of audio stream reached")

done = True

try:
# Connect callbacks
speech_recognizer.recognized.connect(recognized_cb)
speech_recognizer.session_stopped.connect(stop_cb)
speech_recognizer.canceled.connect(canceled_cb)

# Start continuous recognition
print(f"[Debug] Starting continuous recognition for chunk {idx}")
speech_recognizer.start_continuous_recognition()

# Wait for completion with timeout
import time
timeout_seconds = 600 # 10 minutes max per chunk
start_time = time.time()

while not done:
if time.time() - start_time > timeout_seconds:
print(f"[Error] Recognition timeout for chunk {idx}")
error_occurred = True
error_message = f"Recognition timed out after {timeout_seconds} seconds"
break
time.sleep(0.5)

# Stop recognition
try:
speech_recognizer.stop_continuous_recognition()
print(f"[Debug] Stopped continuous recognition for chunk {idx}")
except Exception as e:
print(f"[Warning] Error stopping recognition for chunk {idx}: {e}")
# Continue even if stop fails

# Check for errors after completion
if error_occurred:
raise RuntimeError(f"Recognition failed for chunk {idx}: {error_message}")

# Add all recognized phrases to the overall list
if all_results:
all_phrases.extend(all_results)
print(f"[Debug] Total phrases from chunk {idx}: {len(all_results)}")
else:
print(f"[Warning] No speech recognized in {chunk_path}")
# Continue to next chunk - empty result is not necessarily an error

except RuntimeError as e:
# Re-raise runtime errors (these are our custom errors)
raise
except Exception as e:
print(f"[Error] Unexpected error during recognition for chunk {idx}: {e}")
raise RuntimeError(f"Recognition failed unexpectedly for chunk {idx}: {e}")
finally:
# Cleanup: disconnect callbacks and dispose recognizer
try:
speech_recognizer.recognized.disconnect_all()
speech_recognizer.session_stopped.disconnect_all()
speech_recognizer.canceled.disconnect_all()
except Exception as e:
print(f"[Warning] Error disconnecting callbacks for chunk {idx}: {e}")

# # Get fresh config (tokens expire after ~1 hour)
# speech_config = _get_speech_config(settings, endpoint, locale)

# audio_config = speechsdk.AudioConfig(filename=chunk_path)
# speech_recognizer = speechsdk.SpeechRecognizer(
# speech_config=speech_config,
# audio_config=audio_config
# )

# result = speech_recognizer.recognize_once()
# if result.reason == speechsdk.ResultReason.RecognizedSpeech:
# print(f"[Debug] Recognized: {result.text}")
# all_phrases.append(result.text)
# elif result.reason == speechsdk.ResultReason.NoMatch:
# print(f"[Warning] No speech in {chunk_path}")
# elif result.reason == speechsdk.ResultReason.Canceled:
# print(f"[Error] {result.cancellation_details.reason}: {result.cancellation_details.error_details}")
# raise RuntimeError(f"Transcription canceled for {chunk_path}: {result.cancellation_details.error_details}")

else:
# Use the fast-transcription API if not in sovereign or custom cloud
Expand Down Expand Up @@ -5357,8 +5472,12 @@ def process_document_upload_background(document_id, user_id, temp_file_path, ori
enable_extract_meta_data = settings.get('enable_extract_meta_data', False) # Used by DI flow
max_file_size_bytes = settings.get('max_file_size_mb', 16) * 1024 * 1024

video_extensions = ('.mp4', '.mov', '.avi', '.mkv', '.flv')
audio_extensions = ('.mp3', '.wav', '.ogg', '.aac', '.flac', '.m4a')
# Get allowed extensions from config.py to determine which processing function to call
tabular_extensions = tuple('.' + ext for ext in TABULAR_EXTENSIONS)
image_extensions = tuple('.' + ext for ext in IMAGE_EXTENSIONS)
di_supported_extensions = tuple('.' + ext for ext in DOCUMENT_EXTENSIONS | IMAGE_EXTENSIONS)
video_extensions = tuple('.' + ext for ext in VIDEO_EXTENSIONS)
audio_extensions = tuple('.' + ext for ext in AUDIO_EXTENSIONS)

# --- Define update_document callback wrapper ---
# This makes it easier to pass the update function to helpers without repeating args
Expand Down Expand Up @@ -5402,8 +5521,6 @@ def update_doc_callback(**kwargs):

# --- 1. Dispatch to appropriate handler based on file type ---
# Note: .doc and .docm are handled separately by process_doc() using docx2txt
di_supported_extensions = ('.pdf', '.docx', '.pptx', '.ppt', '.jpg', '.jpeg', '.png', '.bmp', '.tiff', '.tif', '.heif')
tabular_extensions = ('.csv', '.xlsx', '.xls', '.xlsm')

is_group = group_id is not None

Expand Down Expand Up @@ -5512,7 +5629,7 @@ def update_doc_callback(**kwargs):
final_status = "Processing complete"
if total_chunks_saved == 0:
# Provide more specific status if no chunks were saved
if file_ext in ('.jpg', '.jpeg', '.png', '.bmp', '.tiff', '.tif', '.heif'):
if file_ext in image_extensions:
final_status = "Processing complete - no text found in image"
elif file_ext in tabular_extensions:
final_status = "Processing complete - no data rows found or file empty"
Expand Down
23 changes: 15 additions & 8 deletions application/single_app/route_backend_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def result_requires_message_reload(result: Any) -> bool:
doc_results = list(cosmos_container.query_items(
query=doc_query, parameters=doc_params, enable_cross_partition_query=True
))
if doc_results:
if doc_results and 'workspace_search' in user_metadata:
doc_info = doc_results[0]
user_metadata['workspace_search']['document_name'] = doc_info.get('title') or doc_info.get('file_name')
user_metadata['workspace_search']['document_filename'] = doc_info.get('file_name')
Expand All @@ -465,18 +465,22 @@ def result_requires_message_reload(result: Any) -> bool:

if group_doc.get('name'):
group_name = group_doc.get('name')
user_metadata['workspace_search']['group_name'] = group_name
debug_print(f"Workspace search - set group_name to: {group_name}")
if 'workspace_search' in user_metadata:
user_metadata['workspace_search']['group_name'] = group_name
debug_print(f"Workspace search - set group_name to: {group_name}")
else:
debug_print(f"Workspace search - no name for group: {active_group_id}")
user_metadata['workspace_search']['group_name'] = None
if 'workspace_search' in user_metadata:
user_metadata['workspace_search']['group_name'] = None
else:
debug_print(f"Workspace search - no group found for id: {active_group_id}")
user_metadata['workspace_search']['group_name'] = None
if 'workspace_search' in user_metadata:
user_metadata['workspace_search']['group_name'] = None

except Exception as e:
debug_print(f"Error retrieving group details: {e}")
user_metadata['workspace_search']['group_name'] = None
if 'workspace_search' in user_metadata:
user_metadata['workspace_search']['group_name'] = None
import traceback
traceback.print_exc()

Expand All @@ -492,8 +496,11 @@ def result_requires_message_reload(result: Any) -> bool:
except Exception as e:
debug_print(f"Error checking public workspace status: {e}")

user_metadata['workspace_search']['active_public_workspace_id'] = active_public_workspace_id
else:
if 'workspace_search' in user_metadata:
user_metadata['workspace_search']['active_public_workspace_id'] = active_public_workspace_id

# Ensure workspace_search key always exists for consistency
if 'workspace_search' not in user_metadata:
user_metadata['workspace_search'] = {
'search_enabled': False
}
Expand Down
20 changes: 17 additions & 3 deletions application/single_app/route_backend_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,23 @@ def api_patch_user_document(document_id):
try:
# Log the metadata update transaction if any fields were updated
if updated_fields:
# Get document details for logging
doc = get_document(user_id, document_id)
if doc:
# Get document details for logging - handle tuple return
doc_response = get_document(user_id, document_id)
doc = None

# Handle tuple return (response, status_code)
if isinstance(doc_response, tuple):
resp, status_code = doc_response
if hasattr(resp, "get_json"):
doc = resp.get_json()
else:
doc = resp
elif hasattr(doc_response, "get_json"):
doc = doc_response.get_json()
else:
doc = doc_response

if doc and isinstance(doc, dict):
log_document_metadata_update_transaction(
user_id=user_id,
document_id=document_id,
Expand Down
Loading
Loading