Spaces:
Running
Running
Update config_provider.py
Browse files- config_provider.py +35 -3
config_provider.py
CHANGED
@@ -261,7 +261,7 @@ class ConfigProvider:
|
|
261 |
|
262 |
@classmethod
|
263 |
def create_project(cls, project_data: dict, username: str) -> ProjectConfig:
|
264 |
-
"""Create new project with
|
265 |
with cls._lock:
|
266 |
config = cls.get()
|
267 |
|
@@ -274,9 +274,40 @@ class ConfigProvider:
|
|
274 |
id=config.project_id_counter,
|
275 |
created_date=get_current_timestamp(),
|
276 |
created_by=username,
|
|
|
|
|
277 |
**project_data
|
278 |
)
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
# Update config
|
281 |
config.projects.append(project)
|
282 |
config.project_id_counter += 1
|
@@ -284,14 +315,15 @@ class ConfigProvider:
|
|
284 |
# Log activity
|
285 |
cls._add_activity(
|
286 |
config, username, "CREATE_PROJECT",
|
287 |
-
"project", project.id, project.name
|
|
|
288 |
)
|
289 |
|
290 |
# Save
|
291 |
cls.save(config, username)
|
292 |
|
293 |
log_info(
|
294 |
-
"Project created",
|
295 |
project_id=project.id,
|
296 |
name=project.name,
|
297 |
user=username
|
|
|
261 |
|
262 |
@classmethod
|
263 |
def create_project(cls, project_data: dict, username: str) -> ProjectConfig:
|
264 |
+
"""Create new project with initial version"""
|
265 |
with cls._lock:
|
266 |
config = cls.get()
|
267 |
|
|
|
274 |
id=config.project_id_counter,
|
275 |
created_date=get_current_timestamp(),
|
276 |
created_by=username,
|
277 |
+
version_id_counter=1, # Başlangıç değeri
|
278 |
+
versions=[], # Boş başla
|
279 |
**project_data
|
280 |
)
|
281 |
|
282 |
+
# Create initial version
|
283 |
+
initial_version = VersionConfig(
|
284 |
+
no=1,
|
285 |
+
caption="Initial version",
|
286 |
+
description="Auto-generated initial version",
|
287 |
+
published=False,
|
288 |
+
deleted=False,
|
289 |
+
general_prompt="You are a helpful assistant.",
|
290 |
+
welcome_prompt=None,
|
291 |
+
llm=LLMConfiguration(
|
292 |
+
repo_id="ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1",
|
293 |
+
generation_config={
|
294 |
+
"max_new_tokens": 256,
|
295 |
+
"temperature": 0.7,
|
296 |
+
"top_p": 0.9,
|
297 |
+
"repetition_penalty": 1.1
|
298 |
+
},
|
299 |
+
use_fine_tune=False,
|
300 |
+
fine_tune_zip=""
|
301 |
+
),
|
302 |
+
intents=[],
|
303 |
+
created_date=get_current_timestamp(),
|
304 |
+
created_by=username
|
305 |
+
)
|
306 |
+
|
307 |
+
# Add initial version to project
|
308 |
+
project.versions.append(initial_version)
|
309 |
+
project.version_id_counter = 2 # Next version will be 2
|
310 |
+
|
311 |
# Update config
|
312 |
config.projects.append(project)
|
313 |
config.project_id_counter += 1
|
|
|
315 |
# Log activity
|
316 |
cls._add_activity(
|
317 |
config, username, "CREATE_PROJECT",
|
318 |
+
"project", project.id, project.name,
|
319 |
+
f"Created with initial version"
|
320 |
)
|
321 |
|
322 |
# Save
|
323 |
cls.save(config, username)
|
324 |
|
325 |
log_info(
|
326 |
+
"Project created with initial version",
|
327 |
project_id=project.id,
|
328 |
name=project.name,
|
329 |
user=username
|