Implement UpdateDataset and UpdateMetadata in GO (#13928)

### What problem does this PR solve?

Implement UpdateDataset and UpdateMetadata in GO

Add cli:
UPDATE CHUNK <chunk_id> OF DATASET <dataset_name> SET <update_fields>
REMOVE TAGS 'tag1', 'tag2' from DATASET 'dataset_name';
SET METADATA OF DOCUMENT <doc_id> TO <meta>


### Type of change

- [ ] Refactoring
This commit is contained in:
qinling0210
2026-04-07 09:44:51 +08:00
committed by GitHub
parent 60ec5880e5
commit 49386bc1b5
27 changed files with 1620 additions and 171 deletions

View File

@@ -136,6 +136,24 @@ def _load_user():
return user[0]
except Exception as e_api_token:
logging.warning(f"load_user got exception {e_api_token}")
# Fallback: try raw authorization value as access_token (for login tokens sent without JWT)
try:
authorization = request.headers.get("Authorization")
if authorization and len(authorization.split()) == 1:
# Single value without "Bearer " prefix - try as raw access_token
access_token = authorization.strip()
if access_token and len(access_token) >= 32:
user = UserService.query(
access_token=access_token, status=StatusEnum.VALID.value
)
if user:
if not user[0].access_token or not user[0].access_token.strip():
logging.warning(f"User {user[0].email} has empty access_token in database")
return None
g.user = user[0]
return user[0]
except Exception as e_raw_token:
logging.warning(f"load_user raw token fallback got exception {e_raw_token}")
current_user = LocalProxy(_load_user)