Skip to content

Commit

Permalink
Merge branch 'feat/v2.0.0' into feat/resizable-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
leire committed Jun 12, 2024
2 parents 699345e + 694014b commit 1c549d5
Show file tree
Hide file tree
Showing 34 changed files with 305 additions and 92 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/argilla-sdk.docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,28 @@ jobs:
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Print GitHub ref info
run:
echo "${{ github.ref }}"
echo "${{ github.head_ref }}"

- run: pdm run mike deploy dev --push
if: github.ref == 'refs/heads/feat/v2.0.0'
# if: github.ref == 'refs/heads/develop'
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

- run: pdm run mike deploy ${{ github.ref_name }} latest --update-aliases --push
if: startsWith(github.ref, 'refs/tags/')
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Extract branch name
shell: bash
run: echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's/\//_/g' >> $GITHUB_OUTPUT
id: extract_branch_name

- run: pdm run mike deploy ${{ steps.extract_branch_name.outputs.branch_name }} --push
if: startsWith(github.head_ref, 'docs/')
if: startsWith(github.ref, 'refs/heads/docs') || startsWith(github.head_ref, 'docs/')
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ export default {
display: inline-flex;
gap: $base-space;
border-radius: $border-radius-rounded;
border: 1px solid #cdcdff;
background: #e0e0ff;
&:hover {
border-color: darken(palette(purple, 800), 12%);
}
}
}
.label-text {
Expand All @@ -133,7 +128,7 @@ export default {
min-width: $base-space * 4;
padding-inline: $base-space;
outline: none;
background: palette(purple, 800);
background: palette(grey, 700);
color: palette(purple, 200);
font-weight: 500;
overflow: hidden;
Expand All @@ -157,7 +152,7 @@ export default {
}
&:not(.label-active):hover {
background: darken(palette(purple, 800), 5%);
background: darken(palette(grey, 700), 5%);
transition: all 0.2s ease-in-out;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default {
</script>
<style lang="scss" scoped>
$label-color: palette(purple, 800);
$label-color: palette(grey, 700);
$label-dark-color: palette(purple, 200);
.container {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ export default {
padding: 0 $base-space * 6;
display: flex;
flex-direction: column;
@include media("<=tablet") {
padding: 0;
}
}
}
.interactions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { Response } from "../types";
import { mediumCache } from "./AxiosCache";

interface BackendAgent {
question: {
Expand All @@ -20,7 +21,7 @@ export class AgentRepository {
try {
const { data } = await this.axios.get<Response<BackendAgent[]>>(
`/v1/datasets/${datasetId}/records/search/suggestions/options`,
{ headers: { "cache-control": "max-age=120" } }
mediumCache()
);

return data.items;
Expand Down
12 changes: 12 additions & 0 deletions argilla-frontend/v1/infrastructure/repositories/AxiosCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,15 @@ export const loadCache = (axios) => {
return response;
});
};

export const largeCache = () => {
return {
headers: { "cache-control": "max-age=600" },
};
};

export const mediumCache = () => {
return {
headers: { "cache-control": "max-age=120" },
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
BackendProgress,
BackendUpdateDataset,
} from "../types/dataset";
import { revalidateCache } from "./AxiosCache";
import { largeCache, revalidateCache } from "./AxiosCache";
import { IDatasetRepository } from "@/v1/domain/services/IDatasetRepository";
import { Dataset } from "~/v1/domain/entities/dataset/Dataset";
import { Progress } from "~/v1/domain/entities/dataset/Progress";
Expand Down Expand Up @@ -104,9 +104,7 @@ export class DatasetRepository implements IDatasetRepository {
try {
const { data } = await this.axios.get<BackendProgress>(
`/v1/datasets/${datasetId}/progress`,
{
headers: { "cache-control": "max-age=600" },
}
largeCache()
);

return new Progress(
Expand All @@ -125,9 +123,10 @@ export class DatasetRepository implements IDatasetRepository {

private async getDatasetById(datasetId: string) {
try {
const { data } = await this.axios.get(`/v1/datasets/${datasetId}`, {
headers: { "cache-control": "max-age=600" },
});
const { data } = await this.axios.get(
`/v1/datasets/${datasetId}`,
largeCache()
);

return data;
} catch (err) {
Expand All @@ -141,7 +140,7 @@ export class DatasetRepository implements IDatasetRepository {
try {
const { data: responseWorkspace } = await this.axios.get(
`/v1/workspaces/${workspaceId}`,
{ headers: { "cache-control": "max-age=600" } }
largeCache()
);

const { name } = responseWorkspace || { name: null };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { BackendEnvironment } from "../types/environment";
import { largeCache } from "./AxiosCache";
import { Environment } from "~/v1/domain/entities/environment/Environment";
import { IEnvironmentRepository } from "~/v1/domain/services/IEnvironmentRepository";

Expand All @@ -17,9 +18,10 @@ export class EnvironmentRepository implements IEnvironmentRepository {

async getEnvironment(): Promise<Environment> {
try {
const { data } = await this.axios.get<BackendEnvironment>("v1/settings", {
headers: { "cache-control": "max-age=600" },
});
const { data } = await this.axios.get<BackendEnvironment>(
"v1/settings",
largeCache()
);

const { argilla, huggingface } = data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { BackendField, Response } from "../types/";
import { revalidateCache } from "./AxiosCache";
import { mediumCache, revalidateCache } from "./AxiosCache";
import { Field } from "~/v1/domain/entities/field/Field";

export const enum FIELD_API_ERRORS {
Expand All @@ -15,7 +15,7 @@ export class FieldRepository {
try {
const { data } = await this.axios.get<Response<BackendField[]>>(
`/v1/datasets/${datasetId}/fields`,
{ headers: { "cache-control": "max-age=120" } }
mediumCache()
);

return data.items;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { BackendMetadataMetric } from "../types";
import { mediumCache } from "./AxiosCache";

const RECORD_API_ERRORS = {
ERROR_FETCHING_METADATA_METRIC: "ERROR_FETCHING_METADATA_METRIC",
Expand All @@ -12,7 +13,7 @@ export class MetadataMetricsRepository {
try {
const { data } = await this.axios.get<BackendMetadataMetric>(
`/v1/metadata-properties/${metadataId}/metrics`,
{ headers: { "cache-control": "max-age=120" } }
mediumCache()
);

return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { BackendMetadata, Response } from "../types";
import { MetadataMetricsRepository } from "./MetadataMetricsRepository";
import { revalidateCache } from "./AxiosCache";
import { mediumCache, revalidateCache } from "./AxiosCache";
import { Metadata } from "~/v1/domain/entities/metadata/Metadata";

const METADATA_API_ERRORS = {
Expand Down Expand Up @@ -32,7 +32,7 @@ export class MetadataRepository {
// TODO: Review this endpoint, for admin should be /v1/datasets/${datasetId}/metadata-properties without ME.
const { data } = await this.axios.get<Response<BackendMetadata[]>>(
`/v1/me/datasets/${datasetId}/metadata-properties`,
{ headers: { "cache-control": "max-age=120" } }
mediumCache()
);

return data.items;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { largeCache } from "./AxiosCache";
import { Metrics } from "~/v1/domain/entities/dataset/Metrics";

interface BackendMetrics {
Expand All @@ -19,7 +20,8 @@ export class MetricsRepository {
async getMetrics(datasetId: string): Promise<Metrics> {
try {
const { data } = await this.axios.get<BackendMetrics>(
`/v1/me/datasets/${datasetId}/metrics`
`/v1/me/datasets/${datasetId}/metrics`,
largeCache()
);

return new Metrics(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { Auth } from "@nuxtjs/auth-next";
import { Response } from "../types";
import { useRunningEnvironment } from "../services/useRunningEnvironment";
import { largeCache } from "./AxiosCache";
import {
OAuthParams,
OAuthProvider,
Expand Down Expand Up @@ -37,7 +38,7 @@ export class OAuthRepository implements IOAuthRepository {

const { data } = await this.axios.get<Response<BackendOAuthProvider[]>>(
url,
{ headers: { "cache-control": "max-age=240" } }
largeCache()
);

return data.items.map((i) => new OAuthProvider(i.name));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { Response, BackendQuestion } from "../types";
import { revalidateCache } from "./AxiosCache";
import { mediumCache, revalidateCache } from "./AxiosCache";
import { Question } from "~/v1/domain/entities/question/Question";
import { IQuestionRepository } from "~/v1/domain/services/IQuestionRepository";

Expand All @@ -16,7 +16,7 @@ export class QuestionRepository implements IQuestionRepository {
try {
const { data } = await this.axios.get<Response<BackendQuestion[]>>(
`/v1/datasets/${datasetId}/questions`,
{ headers: { "cache-control": "max-age=120" } }
mediumCache()
);

return data.items;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export class RecordRepository {
);

revalidateCache(`/v1/datasets/${record.datasetId}/progress`);
revalidateCache(`/v1/me/datasets/${record.datasetId}/metrics`);

return new RecordAnswer(
data.id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { BackendVector } from "../types/vector";
import { Response } from "../types";
import { revalidateCache } from "./AxiosCache";
import { mediumCache, revalidateCache } from "./AxiosCache";
import { Vector } from "~/v1/domain/entities/vector/Vector";

const enum VECTOR_API_ERRORS {
Expand All @@ -16,7 +16,7 @@ export class VectorRepository {
try {
const { data } = await this.axios.get<Response<BackendVector[]>>(
`/v1/datasets/${datasetId}/vectors-settings`,
{ headers: { "cache-control": "max-age=120" } }
mediumCache()
);

return data.items;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type NuxtAxiosInstance } from "@nuxtjs/axios";
import { Response } from "../types";
import { mediumCache } from "./AxiosCache";

interface BackendWorkspace {
id: string;
Expand All @@ -16,7 +17,7 @@ export class WorkspaceRepository {
try {
const { data } = await this.axios.get<Response<BackendWorkspace[]>>(
"/v1/me/workspaces",
{ headers: { "cache-control": "max-age=120" } }
mediumCache()
);

return data.items;
Expand Down
4 changes: 2 additions & 2 deletions argilla-sdk/docs/community/contributor.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Argilla-python is the reference argilla python server SDK.
description: the Argilla Python SDK is the reference Argilla Python server SDK.
hide:
- footer
---
Expand All @@ -13,7 +13,7 @@ Thank you for investing your time in contributing to the project! Any contributi
* **Git**: This is a very useful tool to keep track of the changes in your files. Using the command-line interface (CLI), you can make your contributions easily. For that, you need to have it [installed and updated](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) on your computer.
* **GitHub**: It is a platform and cloud-based service that uses git and allows developers to collaborate on projects. To contribute to Argilla, you'll need to create an account. Check the [Contributor Workflow with Git and Github](#contributor-workflow-with-git-and-github) for more info.
* **Developer Documentation**: To collaborate, you'll need to set up an efficient environment. Check the [developer documentation](../getting_started/installation.md) to know how to do it.
* **Schedule a meeting with our developer advocate**: If you have more questions, do not hesitate to contact to our developer advocate and [schedule a meeting](https://calendly.com/argilla-office-hours/30min).
* **Schedule a meeting with our developer advocate**: If you have more questions, do not hesitate to contact our developer advocate and [schedule a meeting](https://calendly.com/argilla-office-hours/30min).

## First Contact in Slack

Expand Down
2 changes: 1 addition & 1 deletion argilla-sdk/docs/community/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Argilla-python is the reference argilla python server SDK.
description: the Argilla Python SDK is the reference Argilla Python server.
hide:
- toc
- footer
Expand Down
2 changes: 1 addition & 1 deletion argilla-sdk/docs/getting_started/faq.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Argilla-python is the reference argilla python server SDK.
description: the Argilla Python SDK is the reference Argilla Python server.
hide: toc
---

Expand Down
2 changes: 1 addition & 1 deletion argilla-sdk/docs/getting_started/installation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Installation of Argilla-python.
description: Installation of the Argilla Python SDK.
---

# Installation
Expand Down
4 changes: 2 additions & 2 deletions argilla-sdk/docs/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ Now you can add the data to your dataset. Use a `mapping` to indicate which keys

```python
dataset.records.log(records=data, mapping={"text": "review"})
```
```

🎉 You have successfully created your first dataset with Argilla. You can now access it in the Argilla UI and start annotating the records.

## More references

* [Installation guide](installation.md)
* [How-to guides](../guides/how_to_guides/index.md)
* [How-to guides](../how_to_guides/index.md)
* [API reference](../reference//argilla_sdk/client.md)
Loading

0 comments on commit 1c549d5

Please sign in to comment.