@tikomni/skills 1.0.4 → 1.0.5
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tikomni/skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "TikOmni skill installer CLI for structured social media crawling in Codex, Claude Code, and OpenClaw",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/mark-ly-wang/TikOmni-Skills#readme",
|
|
@@ -1586,22 +1586,8 @@ def run_u2_asr_batch_with_timeout_retry(
|
|
|
1586
1586
|
existing = mapped_results.get(file_url)
|
|
1587
1587
|
if existing is None:
|
|
1588
1588
|
mapped_results[file_url] = candidate
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
old_score = (
|
|
1592
|
-
1 if existing.get("ok") else 0,
|
|
1593
|
-
len(str(existing.get("transcript_text") or "")),
|
|
1594
|
-
1 if existing.get("transcription_url") else 0,
|
|
1595
|
-
1 if not existing.get("error_reason") else 0,
|
|
1596
|
-
)
|
|
1597
|
-
new_score = (
|
|
1598
|
-
1 if candidate.get("ok") else 0,
|
|
1599
|
-
len(str(candidate.get("transcript_text") or "")),
|
|
1600
|
-
1 if candidate.get("transcription_url") else 0,
|
|
1601
|
-
1 if not candidate.get("error_reason") else 0,
|
|
1602
|
-
)
|
|
1603
|
-
if new_score > old_score:
|
|
1604
|
-
mapped_results[file_url] = candidate
|
|
1589
|
+
# When the provider returns file_url, treat it as the source of truth.
|
|
1590
|
+
# item_index remains a fallback only for older payloads without file_url.
|
|
1605
1591
|
|
|
1606
1592
|
mapped_results = hydrate_u2_batch_results_from_transcription_urls(
|
|
1607
1593
|
mapped_results=mapped_results,
|
|
@@ -12,6 +12,7 @@ SKILL_ROOT = Path(__file__).resolve().parents[1]
|
|
|
12
12
|
if str(SKILL_ROOT) not in sys.path:
|
|
13
13
|
sys.path.insert(0, str(SKILL_ROOT))
|
|
14
14
|
|
|
15
|
+
from scripts.core.asr_pipeline import run_u2_asr_batch_with_timeout_retry
|
|
15
16
|
from scripts.pipelines import homepage_collectors
|
|
16
17
|
from scripts.pipelines import run_xiaohongshu_single_work
|
|
17
18
|
|
|
@@ -164,6 +165,71 @@ class FixedPipelineFallbackTest(unittest.TestCase):
|
|
|
164
165
|
self.assertEqual(web_attempt.get("param_reason"), "fallback_requires_cookie")
|
|
165
166
|
self.assertEqual(raw.get("error_reason"), "posts_all_routes_failed")
|
|
166
167
|
|
|
168
|
+
def test_u2_batch_prefers_file_url_mapping_over_item_index_fallback(self) -> None:
|
|
169
|
+
file_url = "https://example.com/video.mp4"
|
|
170
|
+
raw_task = {
|
|
171
|
+
"data": {
|
|
172
|
+
"task_status": "SUCCEEDED",
|
|
173
|
+
"task_metrics": {"TOTAL": 1, "SUCCEEDED": 1, "FAILED": 0},
|
|
174
|
+
"items": [
|
|
175
|
+
{
|
|
176
|
+
"item_index": 0,
|
|
177
|
+
"task_status": "SUCCEEDED",
|
|
178
|
+
"transcript_text": "索引映射文本。",
|
|
179
|
+
"transcription_url": "https://example.com/index.json",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"file_url": file_url,
|
|
183
|
+
"task_status": "SUCCEEDED",
|
|
184
|
+
"transcript_text": "file_url 映射文本。",
|
|
185
|
+
"transcription_url": "https://example.com/file.json",
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
submit_bundle = {
|
|
192
|
+
"submit_response": {"ok": True, "request_id": "req-submit"},
|
|
193
|
+
"task_id": "task-1",
|
|
194
|
+
"final_submit_status": "success",
|
|
195
|
+
"retry_chain": [],
|
|
196
|
+
}
|
|
197
|
+
poll_result = {
|
|
198
|
+
"ok": True,
|
|
199
|
+
"task_id": "task-1",
|
|
200
|
+
"task_status": "SUCCEEDED",
|
|
201
|
+
"request_id": "req-poll",
|
|
202
|
+
"error_reason": "",
|
|
203
|
+
"raw_task": raw_task,
|
|
204
|
+
"task_metrics": {"TOTAL": 1, "SUCCEEDED": 1, "FAILED": 0},
|
|
205
|
+
"batch_progress": {"expected_total": 1, "complete": True},
|
|
206
|
+
"batch_complete": True,
|
|
207
|
+
"trace": [],
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
with patch(
|
|
211
|
+
"scripts.core.asr_pipeline.submit_u2_asr_batch_with_retry",
|
|
212
|
+
return_value=submit_bundle,
|
|
213
|
+
), patch(
|
|
214
|
+
"scripts.core.asr_pipeline.poll_u2_task_core",
|
|
215
|
+
return_value=poll_result,
|
|
216
|
+
):
|
|
217
|
+
bundle = run_u2_asr_batch_with_timeout_retry(
|
|
218
|
+
base_url="https://api.tikomni.com",
|
|
219
|
+
token="test-token",
|
|
220
|
+
timeout_ms=1000,
|
|
221
|
+
file_urls=[file_url],
|
|
222
|
+
submit_max_retries=0,
|
|
223
|
+
submit_backoff_ms=0,
|
|
224
|
+
poll_interval_sec=0.01,
|
|
225
|
+
max_polls=1,
|
|
226
|
+
timeout_retry_enabled=False,
|
|
227
|
+
timeout_retry_max_retries=0,
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
mapped_item = bundle["mapped_results"][file_url]
|
|
231
|
+
self.assertEqual(mapped_item["transcript_text"], "file_url 映射文本。")
|
|
232
|
+
|
|
167
233
|
|
|
168
234
|
if __name__ == "__main__":
|
|
169
235
|
unittest.main()
|