feat: distinguish model vendors and reuse playground keys
This commit is contained in:
1 parent
0a44a0802b
commit
281849ceb8
13 files changed
+222
-46
No files matched your search
@@ -49,7 +49,11 @@ public class AsyncTaskService {
|
||||
|
||||
@Transactional
|
||||
public Map<String, Object> create(String authorization, String taskType, Map<String, Object> input) {
|
||||
Map<String, Object> key = requireKey(authorization);
|
||||
return createForKey(requireKey(authorization), taskType, input);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Map<String, Object> createForKey(Map<String, Object> key, String taskType, Map<String, Object> input) {
|
||||
gatewayGuard.checkRate(UUID.fromString(String.valueOf(key.get("id"))), false);
|
||||
String modelId = String.valueOf(input.getOrDefault("model", ""));
|
||||
Map<String, Object> model = catalogService.activeModel(modelId);
|
||||
@@ -77,7 +81,10 @@ public class AsyncTaskService {
|
||||
}
|
||||
|
||||
public Map<String, Object> get(String authorization, String taskId) {
|
||||
Map<String, Object> key = requireKey(authorization);
|
||||
return getForKey(requireKey(authorization), taskId);
|
||||
}
|
||||
|
||||
public Map<String, Object> getForKey(Map<String, Object> key, String taskId) {
|
||||
UUID userId = catalogService.keyOwnerId(UUID.fromString(String.valueOf(key.get("id"))));
|
||||
try {
|
||||
return jdbc.queryForObject("SELECT * FROM model_tasks WHERE id = ? AND user_id = ?", this::mapTask, taskId, userId);
|
||||
|
||||
Reference in new issue
Block a user