Skip to content

Commit c3edd62

Browse files
committed
fix file selection thing now showing up when accessing directly through API
1 parent a69cde3 commit c3edd62

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

src/server/ai_file_selector.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import json
66
import os
77
import re
8+
import time
89
from typing import TYPE_CHECKING
910

1011
import google.generativeai as genai
@@ -38,7 +39,7 @@ def __init__(self):
3839
raise ValueError("GEMINI_API_KEY environment variable is required")
3940

4041
genai.configure(api_key=api_key)
41-
self.model = genai.GenerativeModel("gemini-1.5-pro")
42+
self.model = genai.GenerativeModel("gemini-1.5-flash")
4243
self.encoding = tiktoken.get_encoding("o200k_base")
4344

4445
def _count_tokens(self, text: str) -> int:
@@ -207,7 +208,11 @@ async def select_files(
207208
try:
208209
# Call Gemini API
209210
logger.info("Calling Gemini API for file selection")
211+
gemini_start_time = time.time()
210212
response = await self.model.generate_content_async(prompt)
213+
gemini_end_time = time.time()
214+
gemini_duration = gemini_end_time - gemini_start_time
215+
logger.info("Gemini API call completed", extra={"duration": gemini_duration})
211216

212217
if not response.text:
213218
raise ValueError("Empty response from Gemini API")

src/server/templates/components/git_form_ai.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212

1313
<!-- Ingest Form -->
14-
<form id="ingestForm" method="post" onsubmit="handleSubmit(event, true)">
14+
<form id="ingestForm" method="post" onsubmit="handleAISubmit(event, true)">
1515
<!-- Top row: repo URL + Ingest button -->
1616
<div class="flex md:flex-row flex-col w-full h-full justify-center items-stretch space-y-5 md:space-y-0 md:space-x-5">
1717
<!-- Repository URL Input -->

src/static/js/git.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,26 @@ function waitForStars() {
1414
document.addEventListener('DOMContentLoaded', () => {
1515
const urlInput = document.getElementById('input_text');
1616
const form = document.getElementById('ingestForm');
17+
const controlsRow = document.getElementById('controlsRow');
18+
19+
// Debug logging
20+
console.log('Git.js loaded');
21+
console.log('URL Input:', urlInput ? urlInput.value : 'not found');
22+
console.log('Form:', form ? 'found' : 'not found');
23+
console.log('Controls Row:', controlsRow ? 'found' : 'not found');
24+
25+
if (controlsRow) {
26+
console.log('Controls Row visibility:', window.getComputedStyle(controlsRow).display);
27+
console.log('Controls Row classes:', controlsRow.className);
28+
// Force show controls for debugging
29+
controlsRow.style.display = 'grid';
30+
controlsRow.style.visibility = 'visible';
31+
controlsRow.style.opacity = '1';
32+
console.log('Forced controls to be visible');
33+
}
1734

1835
if (urlInput && urlInput.value.trim() && form) {
19-
// Wait for stars to be loaded before submitting
36+
// Auto-submit immediately
2037
waitForStars().then(() => {
2138
const submitEvent = new SubmitEvent('submit', {
2239
cancelable: true,
@@ -27,7 +44,12 @@ document.addEventListener('DOMContentLoaded', () => {
2744
value: form,
2845
enumerable: true
2946
});
30-
handleSubmit(submitEvent, true);
47+
// Use AI submit handler if available, otherwise fall back to regular submit
48+
if (window.handleAISubmit) {
49+
window.handleAISubmit(submitEvent, true);
50+
} else if (window.handleSubmit) {
51+
window.handleSubmit(submitEvent, true);
52+
}
3153
});
3254
}
3355
});

src/static/js/utils_ai.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ document.addEventListener('DOMContentLoaded', () => {
381381

382382
// Make functions available globally
383383
window.handleAISubmit = handleAISubmit;
384+
window.handleSubmit = handleAISubmit; // Alias for compatibility
384385
window.copyText = copyText;
385386
window.copyFullDigest = copyFullDigest;
386387
window.downloadFullDigest = downloadFullDigest;

0 commit comments

Comments
 (0)