Spaces:
Running
Running
Deploy 4bde754e
Browse files- frontend/src/review-client.js +2 -1
- frontend/src/review-client.test.js +2 -1
- llm_factory.py +4 -0
frontend/src/review-client.js
CHANGED
|
@@ -38,7 +38,8 @@ export function upsertProvider(entries, item, previousName = null) {
|
|
| 38 |
}
|
| 39 |
|
| 40 |
export function reviewPayload(repo, pr, endpoint, savedProviders, reviewMode, baselineSha = "") {
|
| 41 |
-
const
|
|
|
|
| 42 |
if (baselineSha.trim()) {
|
| 43 |
if (!/^[a-fA-F0-9]{40}$/.test(baselineSha.trim())) throw new Error("Enter the full 40-character baseline commit SHA.");
|
| 44 |
payload.baseline_sha = baselineSha.trim().toLowerCase();
|
|
|
|
| 38 |
}
|
| 39 |
|
| 40 |
export function reviewPayload(repo, pr, endpoint, savedProviders, reviewMode, baselineSha = "") {
|
| 41 |
+
const builtinEndpoint = {gemini: 'Gemini', groq: 'Grok'}[endpoint] || endpoint;
|
| 42 |
+
const payload = { repo: repo.trim(), pr_number: Number(pr), endpoint: builtinEndpoint, review_mode: reviewMode };
|
| 43 |
if (baselineSha.trim()) {
|
| 44 |
if (!/^[a-fA-F0-9]{40}$/.test(baselineSha.trim())) throw new Error("Enter the full 40-character baseline commit SHA.");
|
| 45 |
payload.baseline_sha = baselineSha.trim().toLowerCase();
|
frontend/src/review-client.test.js
CHANGED
|
@@ -9,7 +9,8 @@ test('saved model supplies its own credentials even when provider draft differs'
|
|
| 9 |
});
|
| 10 |
|
| 11 |
test('built-in selection does not accidentally send custom credentials', () => {
|
| 12 |
-
assert.deepEqual(reviewPayload('owner/repo', 1, 'groq', [], 'thorough'), {repo:'owner/repo',pr_number:1,endpoint:'
|
|
|
|
| 13 |
});
|
| 14 |
|
| 15 |
test('missing saved selection fails rather than falling back to operator keys', () => {
|
|
|
|
| 9 |
});
|
| 10 |
|
| 11 |
test('built-in selection does not accidentally send custom credentials', () => {
|
| 12 |
+
assert.deepEqual(reviewPayload('owner/repo', 1, 'groq', [], 'thorough'), {repo:'owner/repo',pr_number:1,endpoint:'Grok',review_mode:'thorough'});
|
| 13 |
+
assert.equal(reviewPayload('owner/repo', 1, 'gemini', [], 'thorough').endpoint, 'Gemini');
|
| 14 |
});
|
| 15 |
|
| 16 |
test('missing saved selection fails rather than falling back to operator keys', () => {
|
llm_factory.py
CHANGED
|
@@ -212,6 +212,10 @@ def create_llm(endpoint=None, **kwargs: Any) -> Any:
|
|
| 212 |
if endpoint:
|
| 213 |
from endpoints import EndpointConfig, get_endpoint
|
| 214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
ep = endpoint if isinstance(endpoint, EndpointConfig) else get_endpoint(endpoint)
|
| 216 |
if ep is not None:
|
| 217 |
if getattr(ep, "builtin", False):
|
|
|
|
| 212 |
if endpoint:
|
| 213 |
from endpoints import EndpointConfig, get_endpoint
|
| 214 |
|
| 215 |
+
# The browser historically sent lowercase builtin ids while the
|
| 216 |
+
# endpoint registry uses display names. Accept both for API clients.
|
| 217 |
+
if isinstance(endpoint, str):
|
| 218 |
+
endpoint = {"gemini": "Gemini", "groq": "Grok"}.get(endpoint.lower(), endpoint)
|
| 219 |
ep = endpoint if isinstance(endpoint, EndpointConfig) else get_endpoint(endpoint)
|
| 220 |
if ep is not None:
|
| 221 |
if getattr(ep, "builtin", False):
|