Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 17, 2025

  • Create new directory pkg/aiusechat/google
  • 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)
  • Define Google-specific usage struct
  • Test the implementation (all tests pass)
  • Verify with existing linting and build
  • Run CodeQL security check (no issues found)
  • 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

Original prompt

i'd like to add a new go pkg... pkg/aiusechat/google

i dont want to implement a full SSE impl like the other providers so do NOT attempt that.

instead I'd like to implement a single function. it also does NOT need to be streaming... using the regular just request-response API is preferred for this function.

it is a SummarizeFile function. we give it a filename... we open the file, send the contents to google however it wants it... only allow images, pdfs, and text files (see the file limits we have in wshcmd-ai.go)... and then write a sensible prompt (as a const so we can modify it).

also have the API url be a const as well so we can modify it.

lets use gemini-2.5-flash-lite to do the summarization.

it should just return (string, [usage], error) ... i dont know what google's usage looks like, but probably some struct so we can see how many tokens etc were used.

ah, and it should take a context for timeout.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI self-assigned this Oct 17, 2025
@Copilot Copilot AI assigned sawka Oct 17, 2025
@CLAassistant
Copy link

CLAassistant commented Oct 17, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ sawka
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 2 commits October 17, 2025 19:26
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Add SummarizeFile function for Google API Add Google AI file summarization package Oct 17, 2025
@Copilot Copilot AI requested a review from sawka October 17, 2025 19:32
Copilot finished work on behalf of sawka October 17, 2025 19:32
@sawka
Copy link
Member

sawka commented Oct 17, 2025

@copilot whoa, undo the changes to the go.mod and go.sum files in the tsunami directory

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 17, 2025

@copilot whoa, undo the changes to the go.mod and go.sum files in the tsunami directory

Reverted all go.mod and go.sum changes in tsunami/demo directories in commit 3d0f3eb.

Copilot finished work on behalf of sawka October 17, 2025 20:06
Copy link
Contributor

coderabbitai bot commented Oct 17, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@sawka sawka marked this pull request as ready for review October 18, 2025 00:20
@sawka sawka merged commit 0d04b99 into main Oct 18, 2025
8 of 11 checks passed
@sawka sawka deleted the copilot/add-summarize-file-function branch October 18, 2025 00:24
a5af pushed a commit to a5af/waveterm that referenced this pull request Oct 18, 2025
Merges 59 commits from wavetermdev/waveterm v0.12.0 release into a5af fork.
Resolves 49 merge conflicts across frontend, backend, and configuration files.

## Major Upstream Features Integrated

### AI Enhancements (v0.12.0)
- AI Response Feedback + Copy Buttons (wavetermdev#2457)
- Reasoning Deltas Display (wavetermdev#2443)
- Google AI File Summarization (wavetermdev#2455)
- `wsh ai` Command Reimplementation (wavetermdev#2435)
- Terminal Context Improvements (wavetermdev#2444)
- Batch Tool Approval System
- Enhanced AI Panel with welcome message
- Context menu support for AI messages

### Infrastructure Updates
- Mobile User Agent Emulation for web widgets (wavetermdev#2454)
- OSC 7 Support for Fish & PowerShell shells (wavetermdev#2456)
- Log Rotation System (wavetermdev#2432)
- Onboarding improvements
- React 19 compatibility updates
- Tailwind v4 migration progress
- Dependency updates (50+ commits)

## Fork Features Preserved

✅ **Horizontal Widget Bar** (tabbar.tsx)
   - Widgets remain in horizontal tab bar (not reverted to sidebar)
   - Fork-specific layout maintained

✅ **Optional Pane Title Labels** (blockframe.tsx)
   - Auto-generated pane titles preserved
   - Custom block rendering logic intact

✅ **Layout Model Modifications** (layoutModel.ts)
   - Fork's widget positioning logic maintained
   - Horizontal layout integration preserved

## Conflict Resolution Summary

**Configuration (8 files):**
- Accepted upstream: .golangci.yml, Taskfile.yml, package.json, go.mod, etc.
- All dependencies updated to v0.12.0 levels

**Backend AI (13 files):**
- Accepted upstream: All pkg/aiusechat/ files
- New AI tools: read_dir, screenshot, terminal context
- Enhanced OpenAI backend with reasoning support

**Frontend AI Panel (12 files):**
- Accepted upstream: All frontend/app/aipanel/ files
- New features: reasoning display, feedback buttons, welcome message
- Enhanced message handling and UX

**Backend Infrastructure (7 files):**
- Accepted upstream: emain, pkg/telemetry, pkg/wcore, pkg/wshrpc
- Updated RPC types and telemetry data structures

**Frontend Fork Features (8 files):**
- Preserved fork: blockframe.tsx, tabbar.tsx, layoutModel.ts
- Accepted upstream: keymodel.ts, wshclientapi.ts, termwrap.ts, etc.

**Deleted Files (1 file):**
- Removed: frontend/app/modals/tos.tsx (deleted upstream)

## Files Changed

- Configuration: 8 files
- Backend: 20+ files
- Frontend: 25+ files
- Total staged: 135 files

## Testing Required

1. Verify AI panel functionality (reasoning, feedback, tools)
2. Test horizontal widget bar (fork feature)
3. Test pane title labels (fork feature)
4. Build verification: `npm install && npm run build:dev`
5. Backend build: `go build ./...`
6. Full test suite: `npm test`

## Known Issues

⚠️ Widget bar integration may need review - upstream removed widget sidebar
⚠️ Layout changes may conflict with horizontal widget positioning
⚠️ React 19 compatibility should be tested thoroughly

## Rollback

If issues arise, rollback available at:
- Tag: fork-v0.11.6-pre-v0.12-merge
- Branch: backup-pre-v0.12-merge

## Next Steps

1. Test all functionality thoroughly
2. Fix any runtime errors from merge
3. Review fork feature integration points
4. Update documentation if needed
5. Create PR to main after validation

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants