Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iris: Enhance student support with proactive assistance #9558

Merged
merged 76 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
c195839
chore: Reset to develop
kaancayli Sep 5, 2024
c5f2af6
Merge main
kaancayli Oct 7, 2024
f7b8ada
fix: merge related issues
kaancayli Oct 7, 2024
a2bf782
Merge branch 'develop' into 'feature/iris/event-service'
kaancayli Oct 15, 2024
3621f12
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Oct 21, 2024
2b4a287
chore: Refactor proactivity settings according to iris settings v3
kaancayli Oct 21, 2024
8f0912f
Merge main
kaancayli Nov 4, 2024
508eae1
chore: Adjust Iris event settings update component
kaancayli Nov 4, 2024
127c3ba
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 8, 2024
a9eb9b5
Merge develop to feature/iris/event-service
kaancayli Nov 11, 2024
5989347
chore: Use new signal based syntax
kaancayli Nov 11, 2024
a3df652
fix errors
kaancayli Nov 11, 2024
5bb7903
fix error while saving event settings on course level
kaancayli Nov 12, 2024
4b69766
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 12, 2024
fd4d844
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 17, 2024
a3b5b2c
fix: client tests
kaancayli Nov 17, 2024
a76ca2c
fix: architecture tests
kaancayli Nov 17, 2024
4b94af7
fix: server style
kaancayli Nov 17, 2024
ba6c6fa
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 17, 2024
48903b8
chore: add client tests for the event settings component
kaancayli Nov 18, 2024
f1a2860
fix: broken server test
kaancayli Nov 18, 2024
2dd89da
fix: add additional server tests
kaancayli Nov 18, 2024
fa4adcf
fix: architecture tests
kaancayli Nov 18, 2024
2179f74
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 18, 2024
5d0520c
chore: simple refactoring
kaancayli Nov 18, 2024
535bf9e
chore: display proactivity settings on the exercise level as well
kaancayli Nov 18, 2024
98a9c35
chore: fix failing tests
kaancayli Nov 18, 2024
724eb63
chore: Reset the branch to 'feature/iris/event-service'
kaancayli Nov 19, 2024
61a5dec
chore: refactor proactivity event settings
kaancayli Nov 19, 2024
5d8a991
fix: failing client tests
kaancayli Nov 20, 2024
09339bc
fix: address static code analysis
kaancayli Nov 20, 2024
3f7930f
chore: remove remaining artifacts after refactoring
kaancayli Nov 20, 2024
9ff7b5f
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 20, 2024
65f611a
chore: remove if check
kaancayli Nov 20, 2024
80c9a93
fix: client tests
kaancayli Nov 20, 2024
b22292b
chore: refactor event settings again
kaancayli Nov 21, 2024
2245bf1
chore: add warning icon next to option if disabled in parent settings
kaancayli Nov 21, 2024
847aa18
chore: Add additional tests and fix client tests
kaancayli Nov 21, 2024
d62b966
fix: inheritance when no parent events are enabled
kaancayli Nov 21, 2024
610db2a
fix: broken client tests
kaancayli Nov 21, 2024
20b8b73
fix: server tests
kaancayli Nov 21, 2024
d8d5346
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 21, 2024
e930369
chore: Apply Code Rabbit suggestions
kaancayli Nov 24, 2024
632b00a
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 24, 2024
b1d1944
chore: store disabled events instead of enabled events
kaancayli Nov 24, 2024
f20c122
chore: fix errors and apply code rabbit suggestions
kaancayli Nov 25, 2024
69818bd
chore: add missing translations
kaancayli Nov 25, 2024
34aed05
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 25, 2024
93c1794
fix: Server Test: updateProgrammingExerciseSettings4
kaancayli Nov 25, 2024
cae672c
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 26, 2024
314288d
Merge branch 'develop' into feature/iris/event-service
kaancayli Nov 27, 2024
fac44ab
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 27, 2024
a03648d
Merge branch 'feature/iris/event-service' of github.com:ls1intum/Arte…
kaancayli Nov 27, 2024
d6cabee
chore: revert package-lock.json
kaancayli Nov 27, 2024
aa2ccec
Merge branch 'develop' into feature/iris/event-service
bassner Nov 29, 2024
31151e3
Merge branch 'develop' into feature/iris/event-service
kaancayli Nov 29, 2024
f8952bb
chore: Address feedback and replace deprecated Result::getParticipati…
kaancayli Nov 29, 2024
6d0caeb
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 29, 2024
bfadb7e
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Nov 30, 2024
f10ac7a
fix: errors
kaancayli Nov 30, 2024
e66e0dc
chore: Simplify IrisEventType.java
kaancayli Nov 30, 2024
8054be4
Merge branch 'develop' into feature/iris/event-service
kaancayli Nov 30, 2024
526d2bc
chore: Address review feedback
kaancayli Dec 1, 2024
052aead
chore: Address translation review feedback
kaancayli Dec 1, 2024
6f087a3
Merge branch 'develop' into feature/iris/event-service
kaancayli Dec 3, 2024
b9955aa
fix: Use @MockitoSpyBean
kaancayli Dec 3, 2024
889fdf4
Merge branch 'develop' into feature/iris/event-service
kaancayli Dec 3, 2024
4bfb77b
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Dec 4, 2024
73351c7
Merge branch 'feature/iris/event-service' of github.com:ls1intum/Arte…
kaancayli Dec 4, 2024
f487375
Merge branch 'develop' into feature/iris/event-service
kaancayli Dec 5, 2024
8124770
Merge branch 'develop' into feature/iris/event-service
kaancayli Dec 6, 2024
0bf910a
Merge branch 'develop' into feature/iris/event-service
kaancayli Dec 7, 2024
b950e75
Merge branch 'develop' into feature/iris/event-service
kaancayli Dec 8, 2024
cc59856
Merge branch 'develop' into feature/iris/event-service
kaancayli Dec 9, 2024
6a36edb
Merge branch 'develop' of github.com:ls1intum/Artemis into feature/ir…
kaancayli Dec 10, 2024
f3e5728
fix: server style issues
kaancayli Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import de.tum.cit.aet.artemis.atlas.repository.CompetencyRepository;
import de.tum.cit.aet.artemis.core.exception.BadRequestAlertException;
import de.tum.cit.aet.artemis.core.repository.UserRepository;
import de.tum.cit.aet.artemis.iris.service.session.IrisCourseChatSessionService;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventService;
import de.tum.cit.aet.artemis.iris.service.pyris.event.CompetencyJolSetEvent;

/**
* Service Implementation for managing CompetencyJol.
Expand All @@ -44,15 +45,15 @@ public class CompetencyJolService {

private final UserRepository userRepository;

private final Optional<IrisCourseChatSessionService> irisCourseChatSessionService;
private final Optional<PyrisEventService> pyrisEventService;

public CompetencyJolService(CompetencyJolRepository competencyJolRepository, CompetencyRepository competencyRepository,
CompetencyProgressRepository competencyProgressRepository, UserRepository userRepository, Optional<IrisCourseChatSessionService> irisCourseChatSessionService) {
CompetencyProgressRepository competencyProgressRepository, UserRepository userRepository, Optional<PyrisEventService> pyrisEventService) {
this.competencyJolRepository = competencyJolRepository;
this.competencyRepository = competencyRepository;
this.competencyProgressRepository = competencyProgressRepository;
this.userRepository = userRepository;
this.irisCourseChatSessionService = irisCourseChatSessionService;
this.pyrisEventService = pyrisEventService;
}

/**
Expand Down Expand Up @@ -83,10 +84,10 @@ public void setJudgementOfLearning(long competencyId, long userId, short jolValu
final var jol = createCompetencyJol(competencyId, userId, jolValue, ZonedDateTime.now(), competencyProgress);
competencyJolRepository.save(jol);

irisCourseChatSessionService.ifPresent(service -> {
pyrisEventService.ifPresent(service -> {
// Inform Iris so it can send a message to the user
try {
service.onJudgementOfLearningSet(jol);
service.trigger(new CompetencyJolSetEvent(jol));
}
catch (Exception e) {
log.warn("Something went wrong while sending the judgement of learning to Iris", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public interface SubmissionRepository extends ArtemisJpaRepository<Submission, L
@EntityGraph(type = LOAD, attributePaths = { "results", "results.assessor" })
List<Submission> findAllWithResultsAndAssessorByParticipationId(Long participationId);

/**
* Get all submissions of a participation and eagerly load results ordered by submission date in ascending order
*
* @param participationId the id of the participation
* @return a list of the participation's submissions
*/
@EntityGraph(type = LOAD, attributePaths = { "results" })
List<Submission> findAllWithResultsByParticipationIdOrderBySubmissionDateAsc(Long participationId);

/**
* Get all submissions with their results by the submission ids
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class IrisChatSubSettings extends IrisSubSettings {
@Convert(converter = IrisListConverter.class)
private SortedSet<String> enabledForCategories = new TreeSet<>();

@Column(name = "disabled_proactive_events", nullable = false)
@Convert(converter = IrisListConverter.class)
private SortedSet<String> disabledProactiveEvents = new TreeSet<>();

@Nullable
public Integer getRateLimit() {
return rateLimit;
Expand All @@ -57,4 +61,12 @@ public SortedSet<String> getEnabledForCategories() {
public void setEnabledForCategories(SortedSet<String> enabledForCategories) {
this.enabledForCategories = enabledForCategories;
}

public SortedSet<String> getDisabledProactiveEvents() {
return disabledProactiveEvents;
}

public void setDisabledProactiveEvents(SortedSet<String> disabledProactiveEvents) {
this.disabledProactiveEvents = disabledProactiveEvents;
}
kaancayli marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package de.tum.cit.aet.artemis.iris.domain.settings.event;

/**
* The type of event that can be triggered by the Iris system.
*/
public enum IrisEventType {

BUILD_FAILED, PROGRESS_STALLED, JOL
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record IrisCombinedChatSubSettingsDTO(boolean enabled, Integer rateLimit, Integer rateLimitTimeframeHours, @Nullable SortedSet<String> allowedVariants,
@Nullable String selectedVariant, @Nullable SortedSet<String> enabledForCategories) {
@Nullable String selectedVariant, @Nullable SortedSet<String> enabledForCategories, @Nullable SortedSet<String> disabledProactiveEvents) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_IRIS;

import java.util.Optional;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -62,6 +64,7 @@ public void executeCompetencyExtractionPipeline(User user, Course course, String
pyrisPipelineService.executePipeline(
"competency-extraction",
"default",
Optional.empty(),
pyrisJobService.createTokenForJob(token -> new CompetencyExtractionJob(token, course.getId(), user.getId())),
executionDto -> new PyrisCompetencyExtractionPipelineExecutionDTO(executionDto, courseDescription, currentCompetencies, CompetencyTaxonomy.values(), 5),
stages -> websocketService.send(user.getLogin(), websocketTopic(course.getId()), new PyrisCompetencyStatusUpdateDTO(stages, null, null))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -73,13 +74,13 @@ public List<PyrisVariantDTO> getOfferedVariants(IrisSubSettingsType feature) thr
try {
var response = restTemplate.getForEntity(pyrisUrl + "/api/v1/pipelines/" + feature.name() + "/variants", PyrisVariantDTO[].class);
if (!response.getStatusCode().is2xxSuccessful() || !response.hasBody()) {
throw new PyrisConnectorException("Could not fetch offered models");
throw new PyrisConnectorException("Could not fetch offered variants");
}
return Arrays.asList(response.getBody());
}
catch (HttpStatusCodeException e) {
log.error("Failed to fetch offered models from Pyris", e);
throw new PyrisConnectorException("Could not fetch offered models");
log.error("Failed to fetch offered variants from Pyris", e);
throw new PyrisConnectorException("Could not fetch offered variants");
}
}

Expand All @@ -89,9 +90,12 @@ public List<PyrisVariantDTO> getOfferedVariants(IrisSubSettingsType feature) thr
* @param feature The feature name of the pipeline to execute
* @param variant The variant of the feature to execute
* @param executionDTO The DTO sent as a body for the execution
* @param event The event to be sent as a query parameter, if the pipeline is getting executed due to an event
*/
public void executePipeline(String feature, String variant, Object executionDTO) {
public void executePipeline(String feature, String variant, Object executionDTO, Optional<String> event) {
var endpoint = "/api/v1/pipelines/" + feature + "/" + variant + "/run";
// Add event query parameter if present
endpoint += event.map(e -> "?event=" + e).orElse("");
kaancayli marked this conversation as resolved.
Show resolved Hide resolved
try {
restTemplate.postForEntity(pyrisUrl + endpoint, objectMapper.valueToTree(executionDTO), Void.class);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package de.tum.cit.aet.artemis.iris.service.pyris;

/**
* Exception thrown when an error occurs during Pyris event processing.
*/
public class PyrisEventProcessingException extends RuntimeException {

public PyrisEventProcessingException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package de.tum.cit.aet.artemis.iris.service.pyris;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_IRIS;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

import de.tum.cit.aet.artemis.iris.domain.session.IrisChatSession;
import de.tum.cit.aet.artemis.iris.service.pyris.event.CompetencyJolSetEvent;
import de.tum.cit.aet.artemis.iris.service.pyris.event.NewResultEvent;
import de.tum.cit.aet.artemis.iris.service.pyris.event.PyrisEvent;
import de.tum.cit.aet.artemis.iris.service.session.AbstractIrisChatSessionService;
import de.tum.cit.aet.artemis.iris.service.session.IrisCourseChatSessionService;
import de.tum.cit.aet.artemis.iris.service.session.IrisExerciseChatSessionService;

/**
* Service to handle Pyris events.
*/
@Service
@Profile(PROFILE_IRIS)
public class PyrisEventService {

private static final Logger log = LoggerFactory.getLogger(PyrisEventService.class);

private final IrisCourseChatSessionService irisCourseChatSessionService;

private final IrisExerciseChatSessionService irisExerciseChatSessionService;

public PyrisEventService(IrisCourseChatSessionService irisCourseChatSessionService, IrisExerciseChatSessionService irisExerciseChatSessionService) {
this.irisCourseChatSessionService = irisCourseChatSessionService;
this.irisExerciseChatSessionService = irisExerciseChatSessionService;
}

/**
* Triggers a Pyris pipeline based on the received {@link PyrisEvent}.
*
* @param event The event object received to trigger the matching pipeline
* @throws UnsupportedPyrisEventException if the event is not supported
*
* @see PyrisEvent
*/
public void trigger(PyrisEvent<? extends AbstractIrisChatSessionService<? extends IrisChatSession>, ?> event) {
log.debug("Starting to process event of type: {}", event.getClass().getSimpleName());
try {
switch (event) {
case CompetencyJolSetEvent competencyJolSetEvent -> {
log.info("Processing CompetencyJolSetEvent: {}", competencyJolSetEvent);
competencyJolSetEvent.handleEvent(irisCourseChatSessionService);
log.debug("Successfully processed CompetencyJolSetEvent");
}
case NewResultEvent newResultEvent -> {
log.info("Processing NewResultEvent: {}", newResultEvent);
newResultEvent.handleEvent(irisExerciseChatSessionService);
log.debug("Successfully processed NewResultEvent");
}
default -> throw new UnsupportedPyrisEventException("Unsupported event type: " + event.getClass().getSimpleName());
}
}
catch (Exception e) {
log.error("Failed to process event: {}", event, e);
throw e;
}
}
}
Loading
Loading