waveterm/pkg
Copilot 0d04b99b46
Add Google AI file summarization package (#2455)
- [x] Create new directory pkg/aiusechat/google
- [x] Implement SummarizeFile function with:
  - Context parameter for timeout
  - File validation (images, PDFs, text files only)
  - Use gemini-2.5-flash-lite model
  - Configurable API URL and prompt as constants
  - Return (string, usage, error)
- [x] Define Google-specific usage struct
- [x] Test the implementation (all tests pass)
- [x] Verify with existing linting and build
- [x] Run CodeQL security check (no issues found)
- [x] Revert unintended tsunami demo dependency changes

## Summary

Successfully implemented a new Google AI package at
`pkg/aiusechat/google` with:

1. **SummarizeFile function** - A simple request-response API (not
streaming, not SSE)
   - Takes context for timeout
   - Validates file types (images, PDFs, text only) 
   - Enforces file size limits matching wshcmd-ai.go
   - Uses gemini-2.5-flash-lite model
   - Returns (summary string, usage stats, error)

2. **GoogleUsage struct** - Tracks token consumption:
   - PromptTokenCount
   - CachedContentTokenCount  
   - CandidatesTokenCount
   - TotalTokenCount

3. **Configurable constants**:
   - GoogleAPIURL (for reference)
   - SummarizePrompt (customizable prompt)
   - SummarizeModel (gemini-2.5-flash-lite)

4. **Comprehensive tests** - 41.7% coverage with all tests passing
5. **Security verified** - No CodeQL alerts
6. **Package documentation** - doc.go with usage examples

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
2025-10-17 17:24:06 -07:00
..
aiusechat Add Google AI file summarization package (#2455) 2025-10-17 17:24:06 -07:00
authkey Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
blockcontroller working on more terminal context (#2444) 2025-10-17 12:19:40 -07:00
blocklogger conn updates 3 (#1711) 2025-01-10 14:09:32 -08:00
docsite Add license identifiers to missing files (#1806) 2025-01-22 20:06:36 -08:00
eventbus Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
faviconcache web bookmarks (#1930) 2025-02-07 16:11:40 -08:00
filestore Fix windows path for wsh url (#1798) 2025-01-22 17:28:59 -08:00
genconn WSL Updates for New Architecture (#1756) 2025-01-16 15:54:58 -08:00
gogen Embedded Structs in Code Generation (#1909) 2025-02-07 13:13:47 -08:00
ijson Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
panichandler new tevents analytics framework (#1894) 2025-02-03 15:32:44 -08:00
remote Not found paths in prefix fs always treated as dir (#2002) 2025-02-21 16:32:14 -08:00
schema settings schema.json (#1874) 2025-02-03 14:20:50 -08:00
service add tsunami view in wave (#2350) 2025-09-15 12:58:59 -07:00
shellexec implement cmd:jwt and fix remote execution of commands (#2292) 2025-08-26 16:23:48 -07:00
suggestion remove wsh s3 dependency (#1994) 2025-02-18 18:52:32 -08:00
telemetry Add AI Response Feedback + Copy Buttons (#2457) 2025-10-17 14:18:30 -07:00
trimquotes Add license identifiers to missing files (#1806) 2025-01-22 20:06:36 -08:00
tsgen New AIPanel (#2370) 2025-10-07 13:32:10 -07:00
userinput Known Hosts User Input Fix (#1778) 2025-01-20 14:38:40 -08:00
util Add OSC 7 support for Fish and PowerShell shells (#2456) 2025-10-17 17:23:08 -07:00
utilds add tsunami view in wave (#2350) 2025-09-15 12:58:59 -07:00
vdom Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
waveai New AIPanel (#2370) 2025-10-07 13:32:10 -07:00
waveapp fail any rpc call which blocks the runServer loop for more than 1s (#1861) 2025-01-27 22:38:19 -08:00
wavebase working on more terminal context (#2444) 2025-10-17 12:19:40 -07:00
waveobj working on more terminal context (#2444) 2025-10-17 12:19:40 -07:00
wcloud working on more terminal context (#2444) 2025-10-17 12:19:40 -07:00
wconfig exclude autoupdate channel in custom settings (#2438) 2025-10-15 21:20:58 -07:00
wcore Updates to prepare for v0.12 launch (#2434) 2025-10-15 16:10:37 -07:00
web Reimplement wsh ai, fix text file attaching format (#2435) 2025-10-15 17:28:56 -07:00
wps New AIPanel (#2370) 2025-10-07 13:32:10 -07:00
wshrpc handle reasoning deltas and display them in the UI (#2443) 2025-10-16 11:17:24 -07:00
wshutil s3 suggestions + widget cache (#1987) 2025-02-18 15:15:12 -08:00
wsl WSL Updates for New Architecture (#1756) 2025-01-16 15:54:58 -08:00
wslconn new tevents analytics framework (#1894) 2025-02-03 15:32:44 -08:00
wstore working on more terminal context (#2444) 2025-10-17 12:19:40 -07:00