wh
d34f703523
简化依赖
2026-04-16 11:10:38 +08:00
wh
7b07f764a7
膝盖requirement依赖
2026-04-16 10:40:02 +08:00
wh
3a3841313f
Merge branch 'main' of https://fun-md.com/whfh/label_ai_service
2026-04-16 10:18:07 +08:00
wh
bfbd7f3bb9
修改ai service配置和依赖
2026-04-16 10:17:54 +08:00
15adab5897
修改端口
2026-04-16 10:02:13 +08:00
58802d40fe
增加镜像源
2026-04-16 09:53:27 +08:00
e753609249
启动脚本
2026-04-16 09:50:13 +08:00
wh
7adc88bab7
提交ignore文件
2026-04-15 11:13:40 +08:00
wh
68567b98b3
停止跟踪文档和单元测试
2026-04-15 11:12:50 +08:00
wh
1e327ea92f
停止追踪pycache
2026-04-15 11:09:09 +08:00
wh
a0ec71d877
停止追踪pycache
2026-04-15 11:07:59 +08:00
wh
65842b5e8b
gitignore 文件修改
2026-04-10 17:15:21 +08:00
wh
ec279262a7
chore: Phase 8 polish — gitignore, full test verification, Swagger and dependency check
2026-04-10 16:46:02 +08:00
wh
0880e1018c
refactor: finetune through LLMClient interface + get_running_loop
...
- Add submit_finetune and get_finetune_status abstract methods to LLMClient base
- Implement both methods in ZhipuAIClient using asyncio.get_running_loop()
- Rewrite finetune_service to call llm.submit_finetune / llm.get_finetune_status
instead of accessing llm._client directly, restoring interface encapsulation
- Replace asyncio.get_event_loop() with get_running_loop() in ZhipuAIClient._call
and all four methods in RustFSClient (deprecated in Python 3.10+)
- Update test_finetune_service to mock the LLMClient interface methods as AsyncMocks
- Add two new tests in test_llm_client for submit_finetune and get_finetune_status
2026-04-10 16:43:28 +08:00
wh
603382d1fa
feat(US7+US8): finetune management and health check test
...
- app/models/finetune_models.py: FinetuneStartRequest, FinetuneStartResponse, FinetuneStatusResponse
- app/services/finetune_service.py: submit_finetune + get_finetune_status via run_in_executor; status map running→RUNNING, succeeded→SUCCESS, failed→FAILED, unknown→RUNNING; LLMCallError on SDK failure
- app/routers/finetune.py: POST /finetune/start + GET /finetune/status/{job_id} with get_llm_client dependency
- tests/test_finetune_service.py: 12 unit tests (TDD, written before implementation)
- tests/test_finetune_router.py: 6 integration tests
- tests/test_health.py: GET /health → 200 {"status":"ok"}
Full suite: 72/72 passing (was 53)
2026-04-10 16:27:51 +08:00
wh
00f092e728
fix(qa_service): fix log placement and add KeyError→LLMParseError handling
2026-04-10 16:11:17 +08:00
wh
4211e587ee
feat(US5+6): QA generation — POST /api/v1/qa/gen-text and /gen-image
...
- Add qa_models.py with TextQAItem, GenTextQARequest, QAPair, ImageQAItem,
GenImageQARequest, ImageQAPair, TextQAResponse, ImageQAResponse
- Implement gen_text_qa(): batch-formats triples into a single prompt, calls
llm.chat(), parses JSON array via extract_json()
- Implement gen_image_qa(): downloads cropped image from source-data bucket,
base64-encodes inline (data URI), builds multimodal message, calls
llm.chat_vision(), parses JSON; image_path preserved on ImageQAPair
- Replace qa.py stub with full router: POST /qa/gen-text and /qa/gen-image
using Depends(get_llm_client) and Depends(get_storage_client)
- 15 new tests (8 service + 7 router), 53/53 total passing
2026-04-10 16:05:49 +08:00
wh
0274bb470a
feat(US3+4): video frame extraction + video-to-text — POST /api/v1/video/*
...
- app/models/video_models.py: ExtractFramesRequest, VideoToTextRequest,
FrameInfo, VideoJobCallback, VideoAcceptedResponse
- app/services/video_service.py: interval+keyframe frame extraction,
uniform-sample video-to-text, HTTP callback, temp file cleanup
- app/routers/video.py: size check helper (_check_video_size via head_object),
BackgroundTasks enqueue for both endpoints
- tests: 6 service + 4 router tests, 10/10 passing
2026-04-10 16:00:08 +08:00
wh
2876c179ac
feat(US2): image quad extraction — POST /api/v1/image/extract
...
- app/models/image_models.py: BBox, QuadrupleItem, ImageExtract{Request,Response}
- app/services/image_service.py: download → base64 LLM → bbox clamp → crop upload
- app/routers/image.py: POST /image/extract handler
- tests: 4 service + 3 router tests, 7/7 passing
2026-04-10 15:40:56 +08:00
wh
dd8da386f4
feat(US1): text triple extraction — POST /api/v1/text/extract
...
- app/models/text_models.py: TripleItem, SourceOffset, TextExtract{Request,Response}
- app/services/text_service.py: TXT/PDF/DOCX parsing + LLM call + JSON parse
- app/routers/text.py: POST /text/extract handler with Depends injection
- tests/test_text_service.py: 6 unit tests (formats, errors)
- tests/test_text_router.py: 4 router tests (200, 400, 502×2)
- 10/10 tests passing
2026-04-10 15:27:27 +08:00
wh
e1eb5e47b1
feat: Phase 1+2 — project setup and core infrastructure
...
- requirements.txt, config.yaml, .env, Dockerfile, docker-compose.yml
- app/core: config (YAML+env override), logging (JSON structured),
exceptions (typed hierarchy), json_utils (Markdown fence stripping)
- app/clients: LLMClient ABC + ZhipuAIClient (run_in_executor),
StorageClient ABC + RustFSClient (boto3 head_object for size check)
- app/main.py: FastAPI app with health endpoint and router registration
- app/core/dependencies.py: lru_cache singleton factories
- tests/conftest.py: mock_llm, mock_storage, test_app, client fixtures
- pytest.ini: asyncio_mode=auto
- 11 unit tests passing
2026-04-10 15:22:45 +08:00
wh
4162d9f4e6
docs: add speckit tasks breakdown for 001-ai-service-requirements
...
55 tasks across 8 phases, organized by 8 user stories (US1-US8).
TDD order: tests first → models → services → routers per story.
Includes parallel execution guide and incremental delivery strategy.
2026-04-10 15:05:02 +08:00
wh
092f9dbfc5
docs: add speckit planning artifacts for 001-ai-service-requirements
...
Generated plan.md, research.md, data-model.md, contracts/api.md,
quickstart.md, and CLAUDE.md agent context via /speckit-plan.
2026-04-10 14:58:13 +08:00
wh
e0d080ceea
feat: add AI service requirements spec (001-ai-service-requirements)
...
- 8 user stories (P1-P3): text triple extraction, image quadruple extraction,
video frame extraction, video-to-text, QA generation (text/image),
finetune management, health check
- 18 functional requirements covering all 8 API endpoints
- 9 success criteria with measurable metrics
- Technical environment section: Python 3.12.13, FastAPI, conda label env
- Quality checklist: all items pass
2026-04-10 14:51:34 +08:00
wh
10887da4ab
docs: add GSTACK eng review report to impl plan
2026-04-10 14:35:15 +08:00
wh
3892c6e60f
docs: apply eng review findings to design doc and impl plan
...
Architecture fixes:
- Image QA: presigned URL → base64 (RustFS is internal, GLM-4V is cloud)
- Add GET /health endpoint + Docker healthcheck
- Video size limit: add get_object_size() to StorageClient ABC, check before background task
- Video size configurable via MAX_VIDEO_SIZE_MB env var (no image rebuild needed)
- Fix image_service.py except clause redundancy (Exception absorbs KeyError/TypeError)
Config additions:
- video.max_file_size_mb: 200 in config.yaml
- MAX_VIDEO_SIZE_MB env override in _ENV_OVERRIDES
2026-04-10 14:34:41 +08:00
wh
f9f84937db
docs: add AI service implementation plan
...
22 tasks covering all 8 endpoints with TDD. Each task includes
test code, implementation code, run commands, and commit step.
2026-04-10 14:15:38 +08:00
wh
f5a43a4bbc
docs: add AI service design document v1.0
...
Covers architecture, adapter layer (LLMClient/StorageClient ABC),
all 8 API endpoints with request/response schemas, service layer logic,
config strategy (config.yaml + .env), logging, exception handling,
RustFS path conventions, and Docker deployment.
2026-04-10 14:02:26 +08:00
wh
54d7a8bf55
first commit
2026-04-08 17:18:43 +08:00