@game_ryo/lsji 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  * { box-sizing: border-box; margin: 0; padding: 0; }
9
9
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0d1117; color: #e6edf3; }
10
10
  </style>
11
- <script type="module" crossorigin src="/assets/main-v74qobjz.js"></script>
11
+ <script type="module" crossorigin src="/assets/main-cTHaY04L.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/main-DNMVBaZA.css">
13
13
  </head>
14
14
  <body>
@@ -22,7 +22,7 @@ function App() {
22
22
  // Initialize socket connection
23
23
  useEffect(() => {
24
24
  const newSocket = io(window.location.origin, {
25
- transports: ['websocket', 'polling'],
25
+ transports: ['websocket'], // Use only websocket to avoid localStorage issues in private browsing
26
26
  reconnection: true,
27
27
  reconnectionAttempts: 10,
28
28
  reconnectionDelay: 1000,
@@ -33,6 +33,16 @@ function App() {
33
33
  console.log('Connected to LSJI server');
34
34
  });
35
35
 
36
+ newSocket.on('connect_error', (err) => {
37
+ console.error('Socket connection error:', err.message);
38
+ // If websocket fails, try with polling as fallback
39
+ const transports = newSocket.io.opts.transports;
40
+ if (Array.isArray(transports) && transports.length === 1 && transports[0] === 'websocket') {
41
+ console.log('Retrying with polling transport...');
42
+ newSocket.io.opts.transports = ['polling', 'websocket'];
43
+ }
44
+ });
45
+
36
46
  newSocket.on('disconnect', () => {
37
47
  setConnected(false);
38
48
  console.log('Disconnected from LSJI server');
@@ -1,33 +1,32 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
 
3
+ // Fetch available models from Ollama
4
+ async function fetchLocalModels() {
5
+ try {
6
+ const res = await fetch('http://localhost:11434/api/tags');
7
+ if (res.ok) {
8
+ const data = await res.json();
9
+ return data.models?.map(m => ({ value: m.name, label: m.name })) || [];
10
+ }
11
+ } catch (e) {
12
+ // Ollama not running
13
+ }
14
+ return [];
15
+ }
16
+
3
17
  // Model definitions per provider (as of 2024 - from official API docs)
4
18
  // Source: https://ai.google.dev/gemini-api/docs/models?hl=ja
5
19
  const MODELS_BY_PROVIDER = {
6
20
  gemini: [
7
- // Gemini 3 (Latest)
8
- { value: 'gemini-3.1-pro-preview', label: 'Gemini 3.1 Pro (Preview)' },
9
- { value: 'gemini-3.5-flash', label: 'Gemini 3.5 Flash (Stable)' },
10
- { value: 'gemini-3-flash-preview', label: 'Gemini 3 Flash (Preview)' },
21
+ // Current stable models (as of 2025)
22
+ { value: 'gemini-3.5-flash', label: 'Gemini 3.5 Flash (Stable) - Best Price/Performance' },
23
+ { value: 'gemini-3.5-pro', label: 'Gemini 3.5 Pro (Stable) - Best Reasoning' },
24
+ { value: 'gemini-3.1-flash', label: 'Gemini 3.1 Flash (Preview)' },
25
+ { value: 'gemini-3.1-pro', label: 'Gemini 3.1 Pro (Preview)' },
11
26
  { value: 'gemini-3.1-flash-lite', label: 'Gemini 3.1 Flash-Lite (Preview)' },
12
- { value: 'gemini-3.1-flash-image', label: 'Nano Banana 2 (Image Generation)' },
13
- { value: 'gemini-3.1-flash-lite-image', label: 'Nano Banana 2 Lite (Image Generation)' },
14
- { value: 'gemini-3-pro-image', label: 'Nano Banana Pro (Image Generation)' },
15
- { value: 'gemini-3.5-live-translate-preview', label: 'Gemini 3.5 Live Translate (Preview)' },
16
- { value: 'gemini-3.1-flash-live-preview', label: 'Gemini 3.1 Flash Live (Preview)' },
17
- { value: 'gemini-3.1-flash-tts-preview', label: 'Gemini 3.1 Flash TTS (Preview)' },
18
- // Gemini 2.5 Flash
19
- { value: 'gemini-2.5-flash', label: 'Gemini 2.5 Flash (Stable) - Best Price/Performance' },
20
- { value: 'gemini-2.5-flash-image', label: 'Nano Banana (Image Generation)' },
21
- { value: 'gemini-2.5-flash-native-audio-preview-12-2025', label: 'Gemini 2.5 Flash Live (Preview)' },
22
- { value: 'gemini-2.5-flash-preview-tts', label: 'Gemini 2.5 Flash TTS (Preview)' },
23
- // Gemini 2.5 Flash-Lite
24
- { value: 'gemini-2.5-flash-lite', label: 'Gemini 2.5 Flash-Lite (Preview)' },
25
- // Gemini 2.5 Pro
26
- { value: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro (Stable) - Best Reasoning' },
27
- { value: 'gemini-2.5-pro-preview-tts', label: 'Gemini 2.5 Pro TTS (Preview)' },
28
- // Legacy (Shutdown)
29
- { value: 'gemini-2.0-flash', label: 'Gemini 2.0 Flash (Shutdown)' },
30
- { value: 'gemini-2.0-flash-lite', label: 'Gemini 2.0 Flash-Lite (Shutdown)' },
27
+ // Legacy (deprecated)
28
+ { value: 'gemini-2.5-flash', label: 'Gemini 2.5 Flash (Deprecated)' },
29
+ { value: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro (Deprecated)' },
31
30
  ],
32
31
  openai: [
33
32
  { value: 'gpt-4o', label: 'GPT-4o (Latest)' },
@@ -43,19 +42,13 @@ const MODELS_BY_PROVIDER = {
43
42
  { value: 'claude-3-sonnet-20240229', label: 'Claude 3 Sonnet' },
44
43
  { value: 'claude-3-haiku-20240307', label: 'Claude 3 Haiku' },
45
44
  ],
46
- local: [
47
- { value: 'llama3.2', label: 'Llama 3.2' },
48
- { value: 'llama3.1', label: 'Llama 3.1' },
49
- { value: 'mistral', label: 'Mistral' },
50
- { value: 'codellama', label: 'Code Llama' },
51
- { value: 'qwen2.5', label: 'Qwen 2.5' },
52
- { value: 'phi3.5', label: 'Phi 3.5' },
53
- ],
45
+ // Local models are fetched dynamically from Ollama
46
+ local: [],
54
47
  };
55
48
 
56
49
  // Default models per provider
57
50
  const DEFAULT_MODELS = {
58
- gemini: 'gemini-2.5-flash', // Best price/performance for general use
51
+ gemini: 'gemini-3.5-flash', // Current stable
59
52
  openai: 'gpt-4o-mini',
60
53
  anthropic: 'claude-3-5-sonnet-20241022',
61
54
  local: 'llama3.2',
@@ -64,31 +57,49 @@ const DEFAULT_MODELS = {
64
57
  function NewRunModal({ onClose, onStart }) {
65
58
  const [task, setTask] = useState('');
66
59
  const [workflowId, setWorkflowId] = useState('');
67
- const [provider, setProvider] = useState('gemini'); // Default to Gemini
60
+ const [provider, setProvider] = useState('gemini');
68
61
  const [model, setModel] = useState(DEFAULT_MODELS.gemini);
62
+ const [apiKey, setApiKey] = useState('');
63
+ const [localModels, setLocalModels] = useState([]);
69
64
  const [maxCost, setMaxCost] = useState(10);
70
65
  const [maxTokens, setMaxTokens] = useState(100000);
71
66
  const [hitlEnabled, setHitlEnabled] = useState(true);
72
67
  const [submitting, setSubmitting] = useState(false);
68
+ const [error, setError] = useState('');
73
69
 
74
70
  // Update model when provider changes
75
71
  useEffect(() => {
76
72
  setModel(DEFAULT_MODELS[provider] || DEFAULT_MODELS.gemini);
77
73
  }, [provider]);
78
74
 
75
+ // Fetch local models when provider is 'local'
76
+ useEffect(() => {
77
+ if (provider === 'local') {
78
+ fetchLocalModels().then(models => {
79
+ if (models.length > 0) {
80
+ setLocalModels(models);
81
+ setModel(models[0].value);
82
+ }
83
+ });
84
+ }
85
+ }, [provider]);
86
+
79
87
  const handleSubmit = async (e) => {
80
88
  e.preventDefault();
81
89
  if (!task.trim()) return;
82
90
 
83
91
  setSubmitting(true);
92
+ setError('');
84
93
  try {
85
94
  await onStart({
86
95
  task: task.trim(),
87
96
  workflowId: workflowId.trim() || undefined,
88
- llm: { provider, model },
97
+ llm: { provider, model, apiKey: apiKey || undefined },
89
98
  budget: { maxCostPerRun: maxCost, maxTokensPerRun: maxTokens },
90
99
  hitl: { enabled: hitlEnabled },
91
100
  });
101
+ } catch (err) {
102
+ setError(err.message || 'Failed to start run');
92
103
  } finally {
93
104
  setSubmitting(false);
94
105
  }
@@ -101,6 +112,11 @@ function NewRunModal({ onClose, onStart }) {
101
112
  <div className="modal" onClick={e => e.stopPropagation()}>
102
113
  <h2 className="modal-title">Create New Agent Run</h2>
103
114
  <form onSubmit={handleSubmit}>
115
+ {error && (
116
+ <div className="form-error" style={{color: 'var(--danger)', marginBottom: '12px', padding: '8px', background: 'rgba(255,0,0,0.1)', borderRadius: '4px', fontSize: '13px'}}>
117
+ {error}
118
+ </div>
119
+ )}
104
120
  <div className="form-group">
105
121
  <label className="form-label">Task Description *</label>
106
122
  <textarea
@@ -133,15 +149,34 @@ function NewRunModal({ onClose, onStart }) {
133
149
  <option value="local">Local (Ollama)</option>
134
150
  </select>
135
151
  </div>
152
+
153
+ {provider !== 'local' && (
154
+ <div className="form-group">
155
+ <label className="form-label">API Key (or set env var)</label>
156
+ <input
157
+ type="password"
158
+ className="form-input"
159
+ placeholder={provider === 'gemini' ? 'GEMINI_API_KEY' : provider === 'openai' ? 'OPENAI_API_KEY' : 'ANTHROPIC_API_KEY'}
160
+ value={apiKey}
161
+ onChange={(e) => setApiKey(e.target.value)}
162
+ />
163
+ <span className="form-hint">Leave empty to use environment variable</span>
164
+ </div>
165
+ )}
136
166
  <div className="form-group">
137
167
  <label className="form-label">Model</label>
138
168
  <select className="form-select" value={model} onChange={(e) => setModel(e.target.value)}>
139
- {currentModels.map(m => (
169
+ {(provider === 'local' ? localModels : currentModels).map(m => (
140
170
  <option key={m.value} value={m.value}>
141
171
  {m.label}
142
172
  </option>
143
173
  ))}
144
174
  </select>
175
+ {provider === 'local' && localModels.length === 0 && (
176
+ <span className="form-hint" style={{color: 'var(--warning)'}}>
177
+ No local models found. Make sure Ollama is running at http://localhost:11434
178
+ </span>
179
+ )}
145
180
  </div>
146
181
  </div>
147
182