vectorgov-cli 0.2.7__tar.gz → 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/PKG-INFO +1 -1
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/pyproject.toml +1 -1
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/__init__.py +1 -1
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/lookup.py +66 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/.gitignore +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/README.md +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/__init__.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/ask.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/audit.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/auth.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/config.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/context.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/docs.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/explain.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/feedback.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/fs_search.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/grep_cmd.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/hybrid.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/init.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/merged.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/prompts.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/quota.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/read.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/search.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/smart_search.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/commands/tokens.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/main.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/utils/__init__.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/utils/config.py +0 -0
- {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.8}/src/vectorgov/cli/utils/output.py +0 -0
|
@@ -130,6 +130,72 @@ def lookup( # noqa: C901
|
|
|
130
130
|
|
|
131
131
|
status = getattr(result, "status", None)
|
|
132
132
|
|
|
133
|
+
# Backend faz auto-split quando a query contem multiplas referencias
|
|
134
|
+
# separadas por virgula ou "e" (ex: "inc. I do Art. 4, inc. II do Art. 4").
|
|
135
|
+
# Nesse caso retorna status=batch com a lista em `results`.
|
|
136
|
+
if status == "batch":
|
|
137
|
+
batch_results = getattr(result, "results", None) or []
|
|
138
|
+
if raw or effective_output == "raw":
|
|
139
|
+
data = {
|
|
140
|
+
"batch": True,
|
|
141
|
+
"total": len(batch_results),
|
|
142
|
+
"results": [],
|
|
143
|
+
}
|
|
144
|
+
for r in batch_results:
|
|
145
|
+
raw_r = getattr(r, "_raw_response", None) or {}
|
|
146
|
+
data["results"].append({
|
|
147
|
+
"reference": getattr(r, "query", ""),
|
|
148
|
+
"status": getattr(r, "status", "unknown"),
|
|
149
|
+
"text": raw_r.get("text") or getattr(r, "stitched_text", "") or "",
|
|
150
|
+
"evidence_url": absolute_url(
|
|
151
|
+
getattr(r, "evidence_url", None) or raw_r.get("evidence_url")
|
|
152
|
+
),
|
|
153
|
+
"document_url": absolute_url(
|
|
154
|
+
getattr(r, "document_url", None) or raw_r.get("document_url")
|
|
155
|
+
),
|
|
156
|
+
"document_id": raw_r.get("document_id", ""),
|
|
157
|
+
"device_type": raw_r.get("device_type", ""),
|
|
158
|
+
"breadcrumb": raw_r.get("breadcrumb", ""),
|
|
159
|
+
})
|
|
160
|
+
print(json.dumps(data, ensure_ascii=False, indent=2))
|
|
161
|
+
return
|
|
162
|
+
|
|
163
|
+
# Text / json / llm output
|
|
164
|
+
if effective_output == "llm":
|
|
165
|
+
for i, r in enumerate(batch_results):
|
|
166
|
+
raw_r = getattr(r, "_raw_response", None) or {}
|
|
167
|
+
r_status = getattr(r, "status", "unknown")
|
|
168
|
+
r_text = raw_r.get("text") or getattr(r, "stitched_text", "") or ""
|
|
169
|
+
r_ref = getattr(r, "query", f"ref {i+1}")
|
|
170
|
+
r_ev = absolute_url(getattr(r, "evidence_url", None) or raw_r.get("evidence_url"))
|
|
171
|
+
r_doc = absolute_url(getattr(r, "document_url", None) or raw_r.get("document_url"))
|
|
172
|
+
print(f"[{i+1}/{len(batch_results)}] {r_ref} ({r_status})")
|
|
173
|
+
if r_text:
|
|
174
|
+
print(r_text)
|
|
175
|
+
if r_ev:
|
|
176
|
+
print(f"EVIDENCE: {r_ev}")
|
|
177
|
+
if r_doc:
|
|
178
|
+
print(f"PDF: {r_doc}")
|
|
179
|
+
if i < len(batch_results) - 1:
|
|
180
|
+
print("---")
|
|
181
|
+
else:
|
|
182
|
+
console.print(f"[bold]Batch:[/bold] {len(batch_results)} referencias encontradas")
|
|
183
|
+
for i, r in enumerate(batch_results):
|
|
184
|
+
raw_r = getattr(r, "_raw_response", None) or {}
|
|
185
|
+
r_status = getattr(r, "status", "unknown")
|
|
186
|
+
r_text = raw_r.get("text") or getattr(r, "stitched_text", "") or ""
|
|
187
|
+
r_ref = getattr(r, "query", f"ref {i+1}")
|
|
188
|
+
r_breadcrumb = raw_r.get("breadcrumb", "")
|
|
189
|
+
title = f"[{i+1}] {r_ref} [{r_status}]"
|
|
190
|
+
if r_breadcrumb:
|
|
191
|
+
title += f"\n {r_breadcrumb}"
|
|
192
|
+
if r_text:
|
|
193
|
+
console.print(Panel(r_text, title=title, border_style="cyan"))
|
|
194
|
+
else:
|
|
195
|
+
console.print(f"\n[yellow]{title}[/yellow]")
|
|
196
|
+
console.print(f" Nenhum texto retornado.")
|
|
197
|
+
return
|
|
198
|
+
|
|
133
199
|
# Fallback: SDK v0.16 falha ao parsear `match` quando o backend aplica
|
|
134
200
|
# _strip_lookup_internals (remove node_id/span_id por segurança). O
|
|
135
201
|
# backend envia text/document_id/device_type no root do response mas
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|