Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
8ab4638
1
Parent(s):
7dadc22
starting to take shape
Browse files- build/web/assets/assets/config/default.yaml +4 -3
- build/web/assets/assets/config/tikslop.yaml +3 -4
- build/web/assets/fonts/MaterialIcons-Regular.otf +0 -0
- build/web/flutter_bootstrap.js +1 -1
- build/web/flutter_service_worker.js +5 -5
- build/web/index.html +1 -1
- build/web/main.dart.js +0 -0
- lib/screens/settings_screen.dart +37 -20
- lib/screens/video_screen.dart +2 -2
- lib/services/clip_queue/clip_queue_manager.dart +5 -5
- lib/services/websocket_api_service.dart +2 -2
- lib/widgets/video_player/video_player_widget.dart +1 -1
- server/api_config.py +9 -0
- server/api_core.py +5 -4
- server/api_session.py +1 -0
- server/config_utils.py +23 -1
- server/llm_utils.py +1 -1
build/web/assets/assets/config/default.yaml
CHANGED
@@ -21,9 +21,10 @@ advertising:
|
|
21 |
link: https://huggingface.co/docs/smolagents/index
|
22 |
|
23 |
simulation:
|
24 |
-
#
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
video:
|
29 |
# default negative prompt to filter harmful content
|
|
|
21 |
link: https://huggingface.co/docs/smolagents/index
|
22 |
|
23 |
simulation:
|
24 |
+
# delay to wait after each simulation loop (in seconds)
|
25 |
+
sim_loop_delay_in_sec: 8
|
26 |
+
|
27 |
+
enable_sim_loop: false
|
28 |
|
29 |
video:
|
30 |
# default negative prompt to filter harmful content
|
build/web/assets/assets/config/tikslop.yaml
CHANGED
@@ -25,11 +25,10 @@ advertising:
|
|
25 |
|
26 |
simulation:
|
27 |
# whether to enable simulation loop to evolve descriptions over time
|
28 |
-
enable_sim_loop:
|
29 |
|
30 |
-
#
|
31 |
-
|
32 |
-
sim_loop_frequency_in_sec: 8
|
33 |
|
34 |
# it's OK to use high values here,
|
35 |
# because some of those values are limited by the backend config,
|
|
|
25 |
|
26 |
simulation:
|
27 |
# whether to enable simulation loop to evolve descriptions over time
|
28 |
+
enable_sim_loop: true
|
29 |
|
30 |
+
# delay to wait after each simulation loop (in seconds)
|
31 |
+
sim_loop_delay_in_sec: 8
|
|
|
32 |
|
33 |
# it's OK to use high values here,
|
34 |
# because some of those values are limited by the backend config,
|
build/web/assets/fonts/MaterialIcons-Regular.otf
CHANGED
Binary files a/build/web/assets/fonts/MaterialIcons-Regular.otf and b/build/web/assets/fonts/MaterialIcons-Regular.otf differ
|
|
build/web/flutter_bootstrap.js
CHANGED
@@ -38,6 +38,6 @@ _flutter.buildConfig = {"engineRevision":"1c9c20e7c3dd48c66f400a24d48ea806b4ab31
|
|
38 |
|
39 |
_flutter.loader.load({
|
40 |
serviceWorkerSettings: {
|
41 |
-
serviceWorkerVersion: "
|
42 |
}
|
43 |
});
|
|
|
38 |
|
39 |
_flutter.loader.load({
|
40 |
serviceWorkerSettings: {
|
41 |
+
serviceWorkerVersion: "1482266090"
|
42 |
}
|
43 |
});
|
build/web/flutter_service_worker.js
CHANGED
@@ -3,12 +3,12 @@ const MANIFEST = 'flutter-app-manifest';
|
|
3 |
const TEMP = 'flutter-temp-cache';
|
4 |
const CACHE_NAME = 'flutter-app-cache';
|
5 |
|
6 |
-
const RESOURCES = {"flutter_bootstrap.js": "
|
7 |
"version.json": "68350cac7987de2728345c72918dd067",
|
8 |
"tikslop.png": "570e1db759046e2d224fef729983634e",
|
9 |
"index.html": "3a7029b3672560e7938aab6fa4d30a46",
|
10 |
"/": "3a7029b3672560e7938aab6fa4d30a46",
|
11 |
-
"main.dart.js": "
|
12 |
"tikslop.svg": "26140ba0d153b213b122bc6ebcc17f6c",
|
13 |
"flutter.js": "888483df48293866f9f41d3d9274a779",
|
14 |
"favicon.png": "c8a183c516004e648a7bac7497c89b97",
|
@@ -24,15 +24,15 @@ const RESOURCES = {"flutter_bootstrap.js": "b92f2a2de5eedfe76230ecb6dfa2b1fe",
|
|
24 |
"assets/packages/cupertino_icons/assets/CupertinoIcons.ttf": "33b7d9392238c04c131b6ce224e13711",
|
25 |
"assets/shaders/ink_sparkle.frag": "ecc85a2e95f5e9f53123dcaf8cb9b6ce",
|
26 |
"assets/AssetManifest.bin": "3311f7126492dcfa7fb84733f178441e",
|
27 |
-
"assets/fonts/MaterialIcons-Regular.otf": "
|
28 |
"assets/assets/ads/smolagents.gif": "45338af5a4d440b707d02f364be8195c",
|
29 |
"assets/assets/ads/README.md": "1959fb6b85a966348396f2f0f9c3f32a",
|
30 |
"assets/assets/ads/lerobot.gif": "0f90b2fc4d15eefb5572363724d6d925",
|
31 |
"assets/assets/config/curated_models.yaml": "d196fd3efc99169e1855088153af48c8",
|
32 |
"assets/assets/config/README.md": "07a87720dd00dd1ca98c9d6884440e31",
|
33 |
"assets/assets/config/custom.yaml": "52bd30aa4d8b980626a5eb02d0871c01",
|
34 |
-
"assets/assets/config/default.yaml": "
|
35 |
-
"assets/assets/config/tikslop.yaml": "
|
36 |
"canvaskit/skwasm.js": "1ef3ea3a0fec4569e5d531da25f34095",
|
37 |
"canvaskit/skwasm_heavy.js": "413f5b2b2d9345f37de148e2544f584f",
|
38 |
"canvaskit/skwasm.js.symbols": "0088242d10d7e7d6d2649d1fe1bda7c1",
|
|
|
3 |
const TEMP = 'flutter-temp-cache';
|
4 |
const CACHE_NAME = 'flutter-app-cache';
|
5 |
|
6 |
+
const RESOURCES = {"flutter_bootstrap.js": "5d1d9aeb5eb1455669456c16a0c4661f",
|
7 |
"version.json": "68350cac7987de2728345c72918dd067",
|
8 |
"tikslop.png": "570e1db759046e2d224fef729983634e",
|
9 |
"index.html": "3a7029b3672560e7938aab6fa4d30a46",
|
10 |
"/": "3a7029b3672560e7938aab6fa4d30a46",
|
11 |
+
"main.dart.js": "c5ec8782587da7ce1f1f8e2953c0008f",
|
12 |
"tikslop.svg": "26140ba0d153b213b122bc6ebcc17f6c",
|
13 |
"flutter.js": "888483df48293866f9f41d3d9274a779",
|
14 |
"favicon.png": "c8a183c516004e648a7bac7497c89b97",
|
|
|
24 |
"assets/packages/cupertino_icons/assets/CupertinoIcons.ttf": "33b7d9392238c04c131b6ce224e13711",
|
25 |
"assets/shaders/ink_sparkle.frag": "ecc85a2e95f5e9f53123dcaf8cb9b6ce",
|
26 |
"assets/AssetManifest.bin": "3311f7126492dcfa7fb84733f178441e",
|
27 |
+
"assets/fonts/MaterialIcons-Regular.otf": "517270ba64bed67a18cfa8813780fbca",
|
28 |
"assets/assets/ads/smolagents.gif": "45338af5a4d440b707d02f364be8195c",
|
29 |
"assets/assets/ads/README.md": "1959fb6b85a966348396f2f0f9c3f32a",
|
30 |
"assets/assets/ads/lerobot.gif": "0f90b2fc4d15eefb5572363724d6d925",
|
31 |
"assets/assets/config/curated_models.yaml": "d196fd3efc99169e1855088153af48c8",
|
32 |
"assets/assets/config/README.md": "07a87720dd00dd1ca98c9d6884440e31",
|
33 |
"assets/assets/config/custom.yaml": "52bd30aa4d8b980626a5eb02d0871c01",
|
34 |
+
"assets/assets/config/default.yaml": "0d0fafca32f9ef9470834ff031667194",
|
35 |
+
"assets/assets/config/tikslop.yaml": "1effb8fab54875e4771c56dbd1165b50",
|
36 |
"canvaskit/skwasm.js": "1ef3ea3a0fec4569e5d531da25f34095",
|
37 |
"canvaskit/skwasm_heavy.js": "413f5b2b2d9345f37de148e2544f584f",
|
38 |
"canvaskit/skwasm.js.symbols": "0088242d10d7e7d6d2649d1fe1bda7c1",
|
build/web/index.html
CHANGED
@@ -156,7 +156,7 @@
|
|
156 |
</script>
|
157 |
|
158 |
<!-- Add version parameter for cache busting -->
|
159 |
-
<script src="flutter_bootstrap.js?v=
|
160 |
|
161 |
<!-- Add cache busting script -->
|
162 |
<script>
|
|
|
156 |
</script>
|
157 |
|
158 |
<!-- Add version parameter for cache busting -->
|
159 |
+
<script src="flutter_bootstrap.js?v=1753445682" async></script>
|
160 |
|
161 |
<!-- Add cache busting script -->
|
162 |
<script>
|
build/web/main.dart.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
lib/screens/settings_screen.dart
CHANGED
@@ -24,7 +24,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|
24 |
final _availabilityService = ModelAvailabilityService();
|
25 |
bool _showSceneDebugInfo = false;
|
26 |
bool _enableSimulation = true;
|
27 |
-
int _simLoopDelayInSec =
|
28 |
String _selectedLlmProvider = 'built-in';
|
29 |
String _selectedLlmModel = 'meta-llama/Llama-3.2-3B-Instruct';
|
30 |
LLMProvider? _currentProvider;
|
@@ -185,7 +185,40 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|
185 |
body: ListView(
|
186 |
padding: const EdgeInsets.all(16),
|
187 |
children: [
|
188 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
Card(
|
190 |
child: Padding(
|
191 |
padding: const EdgeInsets.all(16),
|
@@ -290,20 +323,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|
290 |
},
|
291 |
),
|
292 |
const SizedBox(height: 16),
|
293 |
-
TextField(
|
294 |
-
controller: _gameMasterPromptController,
|
295 |
-
decoration: const InputDecoration(
|
296 |
-
labelText: 'Game Master Prompt',
|
297 |
-
hintText: 'Keep things fun and kid-friendly.',
|
298 |
-
helperText: 'Additional instructions applied to all LLM requests (search, captions, simulations)',
|
299 |
-
helperMaxLines: 2,
|
300 |
-
),
|
301 |
-
maxLines: 3,
|
302 |
-
onChanged: (value) {
|
303 |
-
_settingsService.setGameMasterPrompt(value);
|
304 |
-
},
|
305 |
-
),
|
306 |
-
const SizedBox(height: 16),
|
307 |
// Model selection dropdown
|
308 |
DropdownButtonFormField<String>(
|
309 |
decoration: InputDecoration(
|
@@ -619,7 +638,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|
619 |
),
|
620 |
),
|
621 |
),
|
622 |
-
const SizedBox(height: 16),
|
623 |
// Video Prompt Prefix Card
|
624 |
Card(
|
625 |
child: Padding(
|
@@ -704,7 +722,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|
704 |
),
|
705 |
),
|
706 |
),
|
707 |
-
const SizedBox(height: 16),
|
708 |
// Display Options Card
|
709 |
Card(
|
710 |
child: Padding(
|
@@ -733,8 +750,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|
733 |
},
|
734 |
),
|
735 |
SwitchListTile(
|
736 |
-
title: const Text('Enable world simulator
|
737 |
-
subtitle: const Text('
|
738 |
value: _enableSimulation,
|
739 |
onChanged: (value) {
|
740 |
setState(() {
|
|
|
24 |
final _availabilityService = ModelAvailabilityService();
|
25 |
bool _showSceneDebugInfo = false;
|
26 |
bool _enableSimulation = true;
|
27 |
+
int _simLoopDelayInSec = 1;
|
28 |
String _selectedLlmProvider = 'built-in';
|
29 |
String _selectedLlmModel = 'meta-llama/Llama-3.2-3B-Instruct';
|
30 |
LLMProvider? _currentProvider;
|
|
|
185 |
body: ListView(
|
186 |
padding: const EdgeInsets.all(16),
|
187 |
children: [
|
188 |
+
// Game Preferences Card (moved to top)
|
189 |
+
Card(
|
190 |
+
child: Padding(
|
191 |
+
padding: const EdgeInsets.all(16),
|
192 |
+
child: Column(
|
193 |
+
crossAxisAlignment: CrossAxisAlignment.start,
|
194 |
+
children: [
|
195 |
+
const Text(
|
196 |
+
'Game Preferences',
|
197 |
+
style: TextStyle(
|
198 |
+
color: TikSlopColors.onBackground,
|
199 |
+
fontSize: 20,
|
200 |
+
fontWeight: FontWeight.bold,
|
201 |
+
),
|
202 |
+
),
|
203 |
+
const SizedBox(height: 2),
|
204 |
+
TextField(
|
205 |
+
controller: _gameMasterPromptController,
|
206 |
+
decoration: const InputDecoration(
|
207 |
+
labelText: 'Game Master Prompt',
|
208 |
+
hintText: 'Keep things fun and kid-friendly.',
|
209 |
+
helperText: 'These are additional instructions you can give to the #tikslop AI agent.',
|
210 |
+
helperMaxLines: 2,
|
211 |
+
),
|
212 |
+
maxLines: 1,
|
213 |
+
onChanged: (value) {
|
214 |
+
_settingsService.setGameMasterPrompt(value);
|
215 |
+
},
|
216 |
+
),
|
217 |
+
],
|
218 |
+
),
|
219 |
+
),
|
220 |
+
),
|
221 |
+
// LLM Configuration Card
|
222 |
Card(
|
223 |
child: Padding(
|
224 |
padding: const EdgeInsets.all(16),
|
|
|
323 |
},
|
324 |
),
|
325 |
const SizedBox(height: 16),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
// Model selection dropdown
|
327 |
DropdownButtonFormField<String>(
|
328 |
decoration: InputDecoration(
|
|
|
638 |
),
|
639 |
),
|
640 |
),
|
|
|
641 |
// Video Prompt Prefix Card
|
642 |
Card(
|
643 |
child: Padding(
|
|
|
722 |
),
|
723 |
),
|
724 |
),
|
|
|
725 |
// Display Options Card
|
726 |
Card(
|
727 |
child: Padding(
|
|
|
750 |
},
|
751 |
),
|
752 |
SwitchListTile(
|
753 |
+
title: const Text('Enable world simulator during playback (dangerous, can drain your account quickly 💸)'),
|
754 |
+
subtitle: const Text('⚠️ This calls a LLM in a loop (creates a lot of API calls billed to your HF account).'),
|
755 |
value: _enableSimulation,
|
756 |
onChanged: (value) {
|
757 |
setState(() {
|
lib/screens/video_screen.dart
CHANGED
@@ -489,9 +489,9 @@ class _VideoScreenState extends State<VideoScreen> {
|
|
489 |
initialThumbnailUrl: _videoData.thumbnailUrl,
|
490 |
autoPlay: true,
|
491 |
onVideoUpdated: (updatedVideo) {
|
492 |
-
debugPrint('VIDEO_SCREEN: Received updated video data');
|
493 |
if (updatedVideo.evolvedDescription.isNotEmpty) {
|
494 |
-
debugPrint('VIDEO_SCREEN: Evolved description (${updatedVideo.evolvedDescription.length} chars)');
|
495 |
debugPrint('VIDEO_SCREEN: First 100 chars: ${updatedVideo.evolvedDescription.substring(0, math.min(100, updatedVideo.evolvedDescription.length))}...');
|
496 |
} else {
|
497 |
debugPrint('VIDEO_SCREEN: No evolved description received');
|
|
|
489 |
initialThumbnailUrl: _videoData.thumbnailUrl,
|
490 |
autoPlay: true,
|
491 |
onVideoUpdated: (updatedVideo) {
|
492 |
+
// debugPrint('VIDEO_SCREEN: Received updated video data');
|
493 |
if (updatedVideo.evolvedDescription.isNotEmpty) {
|
494 |
+
// debugPrint('VIDEO_SCREEN: Evolved description (${updatedVideo.evolvedDescription.length} chars)');
|
495 |
debugPrint('VIDEO_SCREEN: First 100 chars: ${updatedVideo.evolvedDescription.substring(0, math.min(100, updatedVideo.evolvedDescription.length))}...');
|
496 |
} else {
|
497 |
debugPrint('VIDEO_SCREEN: No evolved description received');
|
lib/services/clip_queue/clip_queue_manager.dart
CHANGED
@@ -246,7 +246,7 @@ class ClipQueueManager {
|
|
246 |
|
247 |
/// Simulate the video by evolving the description using the LLM
|
248 |
Future<void> _evolveDescription() async {
|
249 |
-
debugPrint('SIMULATION: Starting description evolution');
|
250 |
if (!_websocketService.isConnected) {
|
251 |
debugPrint('SIMULATION: Cannot simulate video - websocket not connected');
|
252 |
ClipQueueConstants.logEvent('Cannot simulate video: websocket not connected');
|
@@ -255,11 +255,11 @@ class ClipQueueManager {
|
|
255 |
|
256 |
int retryCount = 0;
|
257 |
const maxRetries = 2;
|
258 |
-
debugPrint('SIMULATION: Current video state: title="${video.title}", evolvedDescription length=${video.evolvedDescription.length}, original description length=${video.description.length}');
|
259 |
|
260 |
// Function to get chat message string
|
261 |
String getChatMessagesString() {
|
262 |
-
debugPrint('CHAT_DEBUG: Getting chat messages for simulation - count: ${_recentChatMessages.length}');
|
263 |
|
264 |
if (_recentChatMessages.isEmpty) {
|
265 |
debugPrint('CHAT_DEBUG: No chat messages available for simulation');
|
@@ -270,7 +270,7 @@ class ClipQueueManager {
|
|
270 |
"${msg.username}: ${msg.content}"
|
271 |
).join("\n");
|
272 |
|
273 |
-
debugPrint('CHAT_DEBUG: Chat messages for simulation: $messagesString');
|
274 |
return messagesString;
|
275 |
}
|
276 |
|
@@ -281,7 +281,7 @@ class ClipQueueManager {
|
|
281 |
|
282 |
if (chatMessagesString.isNotEmpty) {
|
283 |
ClipQueueConstants.logEvent('Including ${_recentChatMessages.length} chat messages in simulation');
|
284 |
-
debugPrint('SIMULATION: Including chat messages: $chatMessagesString');
|
285 |
}
|
286 |
|
287 |
// Use the WebSocketService to simulate the video
|
|
|
246 |
|
247 |
/// Simulate the video by evolving the description using the LLM
|
248 |
Future<void> _evolveDescription() async {
|
249 |
+
// debugPrint('SIMULATION: Starting description evolution');
|
250 |
if (!_websocketService.isConnected) {
|
251 |
debugPrint('SIMULATION: Cannot simulate video - websocket not connected');
|
252 |
ClipQueueConstants.logEvent('Cannot simulate video: websocket not connected');
|
|
|
255 |
|
256 |
int retryCount = 0;
|
257 |
const maxRetries = 2;
|
258 |
+
// debugPrint('SIMULATION: Current video state: title="${video.title}", evolvedDescription length=${video.evolvedDescription.length}, original description length=${video.description.length}');
|
259 |
|
260 |
// Function to get chat message string
|
261 |
String getChatMessagesString() {
|
262 |
+
// debugPrint('CHAT_DEBUG: Getting chat messages for simulation - count: ${_recentChatMessages.length}');
|
263 |
|
264 |
if (_recentChatMessages.isEmpty) {
|
265 |
debugPrint('CHAT_DEBUG: No chat messages available for simulation');
|
|
|
270 |
"${msg.username}: ${msg.content}"
|
271 |
).join("\n");
|
272 |
|
273 |
+
// debugPrint('CHAT_DEBUG: Chat messages for simulation: $messagesString');
|
274 |
return messagesString;
|
275 |
}
|
276 |
|
|
|
281 |
|
282 |
if (chatMessagesString.isNotEmpty) {
|
283 |
ClipQueueConstants.logEvent('Including ${_recentChatMessages.length} chat messages in simulation');
|
284 |
+
// debugPrint('SIMULATION: Including chat messages: $chatMessagesString');
|
285 |
}
|
286 |
|
287 |
// Use the WebSocketService to simulate the video
|
lib/services/websocket_api_service.dart
CHANGED
@@ -1433,7 +1433,7 @@ class WebSocketApiService {
|
|
1433 |
}
|
1434 |
}
|
1435 |
|
1436 |
-
debugPrint('WebSocketApiService: Chat messages included: ${formattedChatMessages.isNotEmpty ? 'Yes' : 'No'}');
|
1437 |
|
1438 |
// Get LLM settings
|
1439 |
final settings = SettingsService();
|
@@ -1472,7 +1472,7 @@ class WebSocketApiService {
|
|
1472 |
final evolvedDescription = response['evolved_description'] as String? ?? currentDescription;
|
1473 |
final newHistory = response['condensed_history'] as String? ?? condensedHistory;
|
1474 |
|
1475 |
-
debugPrint('WebSocketApiService: Simulation successful, received ${evolvedDescription.length} chars for evolved description');
|
1476 |
|
1477 |
return {
|
1478 |
'evolved_description': evolvedDescription,
|
|
|
1433 |
}
|
1434 |
}
|
1435 |
|
1436 |
+
// debugPrint('WebSocketApiService: Chat messages included: ${formattedChatMessages.isNotEmpty ? 'Yes' : 'No'}');
|
1437 |
|
1438 |
// Get LLM settings
|
1439 |
final settings = SettingsService();
|
|
|
1472 |
final evolvedDescription = response['evolved_description'] as String? ?? currentDescription;
|
1473 |
final newHistory = response['condensed_history'] as String? ?? condensedHistory;
|
1474 |
|
1475 |
+
// debugPrint('WebSocketApiService: Simulation successful, received ${evolvedDescription.length} chars for evolved description');
|
1476 |
|
1477 |
return {
|
1478 |
'evolved_description': evolvedDescription,
|
lib/widgets/video_player/video_player_widget.dart
CHANGED
@@ -223,7 +223,7 @@ class _VideoPlayerWidgetState extends State<VideoPlayerWidget> with WidgetsBindi
|
|
223 |
// that comes from the stream, not create a new one
|
224 |
// The parent widget should receive this via the onVideoUpdated callback
|
225 |
if (widget.onVideoUpdated != null) {
|
226 |
-
debugPrint('PLAYER: Received video update, evolvedDescription length: ${updatedVideo.evolvedDescription.length}');
|
227 |
|
228 |
if (updatedVideo.evolvedDescription.isNotEmpty) {
|
229 |
debugPrint('PLAYER: First 100 chars: ${updatedVideo.evolvedDescription.substring(0, min(100, updatedVideo.evolvedDescription.length))}...');
|
|
|
223 |
// that comes from the stream, not create a new one
|
224 |
// The parent widget should receive this via the onVideoUpdated callback
|
225 |
if (widget.onVideoUpdated != null) {
|
226 |
+
// debugPrint('PLAYER: Received video update, evolvedDescription length: ${updatedVideo.evolvedDescription.length}');
|
227 |
|
228 |
if (updatedVideo.evolvedDescription.isNotEmpty) {
|
229 |
debugPrint('PLAYER: First 100 chars: ${updatedVideo.evolvedDescription.substring(0, min(100, updatedVideo.evolvedDescription.length))}...');
|
server/api_config.py
CHANGED
@@ -50,6 +50,8 @@ THUMBNAIL_FRAMES = 65
|
|
50 |
# anonymous users are people browing TikSlop without being connected
|
51 |
# this category suffers from regular abuse so we need to enforce strict limitations
|
52 |
CONFIG_FOR_ANONYMOUS_USERS = {
|
|
|
|
|
53 |
|
54 |
# anons can only watch 2 minutes per video
|
55 |
"max_rendering_time_per_client_per_video_in_sec": 2 * 60,
|
@@ -85,6 +87,8 @@ CONFIG_FOR_ANONYMOUS_USERS = {
|
|
85 |
|
86 |
# Hugging Face users enjoy a more normal and calibrated experience
|
87 |
CONFIG_FOR_STANDARD_HF_USERS = {
|
|
|
|
|
88 |
"max_rendering_time_per_client_per_video_in_sec": 15 * 60,
|
89 |
|
90 |
"min_num_inference_steps": 2,
|
@@ -118,6 +122,8 @@ CONFIG_FOR_STANDARD_HF_USERS = {
|
|
118 |
|
119 |
# Hugging Face users with a Pro may enjoy an improved experience
|
120 |
CONFIG_FOR_PRO_HF_USERS = {
|
|
|
|
|
121 |
"max_rendering_time_per_client_per_video_in_sec": 20 * 60,
|
122 |
|
123 |
"min_num_inference_steps": 2,
|
@@ -150,6 +156,9 @@ CONFIG_FOR_PRO_HF_USERS = {
|
|
150 |
}
|
151 |
|
152 |
CONFIG_FOR_ADMIN_HF_USERS = {
|
|
|
|
|
|
|
153 |
"max_rendering_time_per_client_per_video_in_sec": 60 * 60,
|
154 |
|
155 |
"min_num_inference_steps": 2,
|
|
|
50 |
# anonymous users are people browing TikSlop without being connected
|
51 |
# this category suffers from regular abuse so we need to enforce strict limitations
|
52 |
CONFIG_FOR_ANONYMOUS_USERS = {
|
53 |
+
# Story settings
|
54 |
+
"default_game_master_prompt": "",
|
55 |
|
56 |
# anons can only watch 2 minutes per video
|
57 |
"max_rendering_time_per_client_per_video_in_sec": 2 * 60,
|
|
|
87 |
|
88 |
# Hugging Face users enjoy a more normal and calibrated experience
|
89 |
CONFIG_FOR_STANDARD_HF_USERS = {
|
90 |
+
# Story settings
|
91 |
+
"default_game_master_prompt": "",
|
92 |
"max_rendering_time_per_client_per_video_in_sec": 15 * 60,
|
93 |
|
94 |
"min_num_inference_steps": 2,
|
|
|
122 |
|
123 |
# Hugging Face users with a Pro may enjoy an improved experience
|
124 |
CONFIG_FOR_PRO_HF_USERS = {
|
125 |
+
# Story settings
|
126 |
+
"default_game_master_prompt": "",
|
127 |
"max_rendering_time_per_client_per_video_in_sec": 20 * 60,
|
128 |
|
129 |
"min_num_inference_steps": 2,
|
|
|
156 |
}
|
157 |
|
158 |
CONFIG_FOR_ADMIN_HF_USERS = {
|
159 |
+
# Story settings
|
160 |
+
"default_game_master_prompt": "",
|
161 |
+
|
162 |
"max_rendering_time_per_client_per_video_in_sec": 60 * 60,
|
163 |
|
164 |
"min_num_inference_steps": 2,
|
server/api_core.py
CHANGED
@@ -300,14 +300,15 @@ class VideoGenerationAPI:
|
|
300 |
# Create an appropriate prompt based on whether this is the first simulation
|
301 |
chat_section = ""
|
302 |
if chat_messages:
|
303 |
-
logger.info(f"CHAT_DEBUG: Server received chat messages for simulation: {chat_messages}")
|
304 |
chat_section = f"""
|
305 |
-
People are watching this content right now and have shared their thoughts. Like a game master, please take their
|
306 |
|
307 |
{chat_messages}
|
308 |
"""
|
309 |
-
else:
|
310 |
-
|
|
|
311 |
|
312 |
if is_first_simulation:
|
313 |
prompt = SIMULATE_VIDEO_FIRST_PROMPT_TEMPLATE.format(
|
|
|
300 |
# Create an appropriate prompt based on whether this is the first simulation
|
301 |
chat_section = ""
|
302 |
if chat_messages:
|
303 |
+
#logger.info(f"CHAT_DEBUG: Server received chat messages for simulation: {chat_messages}")
|
304 |
chat_section = f"""
|
305 |
+
People are watching this content right now and have shared their thoughts. Like a game master, please take their feedbacks as input to adjust the story and/or the scene (eg if they as you to make the character in the story move somplace, do things.. you MUST change the story and scene description accordingly, but also keep previous elements consistant, eg if a new character, location, clothing item.. is introduced then keep it etc). Here are their messages:
|
306 |
|
307 |
{chat_messages}
|
308 |
"""
|
309 |
+
#else:
|
310 |
+
# logger.info("CHAT_DEBUG: Server simulation called with no chat messages")
|
311 |
+
|
312 |
|
313 |
if is_first_simulation:
|
314 |
prompt = SIMULATE_VIDEO_FIRST_PROMPT_TEMPLATE.format(
|
server/api_session.py
CHANGED
@@ -7,6 +7,7 @@ import time
|
|
7 |
import datetime
|
8 |
from .api_core import VideoGenerationAPI
|
9 |
from .logging_utils import get_logger
|
|
|
10 |
|
11 |
logger = get_logger(__name__)
|
12 |
|
|
|
7 |
import datetime
|
8 |
from .api_core import VideoGenerationAPI
|
9 |
from .logging_utils import get_logger
|
10 |
+
from .config_utils import get_game_master_prompt
|
11 |
|
12 |
logger = get_logger(__name__)
|
13 |
|
server/config_utils.py
CHANGED
@@ -66,4 +66,26 @@ def get_config_value(role: UserRole, field: str, options: Optional[Dict[str, Any
|
|
66 |
return user_value
|
67 |
|
68 |
# If no user value, return the default
|
69 |
-
return default_value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
return user_value
|
67 |
|
68 |
# If no user value, return the default
|
69 |
+
return default_value
|
70 |
+
|
71 |
+
|
72 |
+
def get_game_master_prompt(role: UserRole, options: Optional[Dict[str, Any]] = None) -> str:
|
73 |
+
"""
|
74 |
+
Get the game master prompt for the given user role and options.
|
75 |
+
|
76 |
+
Args:
|
77 |
+
role: The user role ('anon', 'normal', 'pro', 'admin')
|
78 |
+
options: Optional user-provided options that may contain game_master_prompt
|
79 |
+
|
80 |
+
Returns:
|
81 |
+
The game master prompt string, or empty string if not set
|
82 |
+
"""
|
83 |
+
# Check if user provided a custom game master prompt
|
84 |
+
if options and 'game_master_prompt' in options:
|
85 |
+
user_prompt = options['game_master_prompt']
|
86 |
+
if user_prompt and user_prompt.strip():
|
87 |
+
return user_prompt.strip()
|
88 |
+
|
89 |
+
# Fall back to role-based default
|
90 |
+
default_value = get_config_value(role, 'game_master_prompt', options)
|
91 |
+
return default_value or ""
|
server/llm_utils.py
CHANGED
@@ -213,7 +213,7 @@ async def generate_text(prompt: str, llm_config: Optional[dict] = None,
|
|
213 |
if llm_config and llm_config.get('game_master_prompt'):
|
214 |
game_master_prompt = llm_config['game_master_prompt'].strip()
|
215 |
if game_master_prompt:
|
216 |
-
prompt = f"{game_master_prompt}\n\n{prompt}"
|
217 |
|
218 |
# Get the appropriate client
|
219 |
client = get_inference_client(llm_config)
|
|
|
213 |
if llm_config and llm_config.get('game_master_prompt'):
|
214 |
game_master_prompt = llm_config['game_master_prompt'].strip()
|
215 |
if game_master_prompt:
|
216 |
+
prompt = f"Important contextual rules: {game_master_prompt}\n\n{prompt}"
|
217 |
|
218 |
# Get the appropriate client
|
219 |
client = get_inference_client(llm_config)
|