<commit_before>import { Action } from 'redux';
import { handleAuthError, urlifyProjectName } from '../constants/utils';
import { BASE_URL } from '../constants/api';

export enum actionTypes {
  RECEIVE_LOGS = 'RECEIVE_LOGS',
  REQUEST_LOGS = 'REQUEST_LOGS',
}

export interface RequestLogsAction extends Action {
  type: actionTypes.REQUEST_LOGS;
  logs: string;
}

export interface ReceiveLogsAction extends Action {
  type: actionTypes.RECEIVE_LOGS;
  logs: string;
}

export function requestLogsActionCreator(): RequestLogsAction {
  return {
    type: actionTypes.REQUEST_LOGS,
    logs: ''
  };
}

export function receiveLogsActionCreator(logs: string): ReceiveLogsAction {
  return {
    type: actionTypes.RECEIVE_LOGS,
    logs
  };
}

export type LogsAction =
  RequestLogsAction
  | ReceiveLogsAction;

export function fetchLogs(projectUniqueName: string, experimentSequence: number): any {
  return (dispatch: any, getState: any) => {
    dispatch(requestLogsActionCreator());

    let logsUrl =
      BASE_URL + `/${urlifyProjectName(projectUniqueName)}` + '/experiments/' + experimentSequence + '/logs';

    return fetch(logsUrl, {
      headers: {
        'Content-Type': 'text/plain;charset=UTF-8',<commit_msg>Use base api url for logs fetching<commit_after>import { Action } from 'redux';
import { handleAuthError, urlifyProjectName } from '../constants/utils';
import { BASE_API_URL } from '../constants/api';

export enum actionTypes {
  RECEIVE_LOGS = 'RECEIVE_LOGS',
  REQUEST_LOGS = 'REQUEST_LOGS',
}

export interface RequestLogsAction extends Action {
  type: actionTypes.REQUEST_LOGS;
  logs: string;
}

export interface ReceiveLogsAction extends Action {
  type: actionTypes.RECEIVE_LOGS;
  logs: string;
}

export function requestLogsActionCreator(): RequestLogsAction {
  return {
    type: actionTypes.REQUEST_LOGS,
    logs: ''
  };
}

export function receiveLogsActionCreator(logs: string): ReceiveLogsAction {
  return {
    type: actionTypes.RECEIVE_LOGS,
    logs
  };
}

export type LogsAction =
  RequestLogsAction
  | ReceiveLogsAction;

export function fetchLogs(projectUniqueName: string, experimentSequence: number): any {
  return (dispatch: any, getState: any) => {
    dispatch(requestLogsActionCreator());

    let logsUrl =
      BASE_API_URL + `/${urlifyProjectName(projectUniqueName)}` + '/experiments/' + experimentSequence + '/logs';

    return fetch(logsUrl, {
      headers: {
        'Content-Type': 'text/plain;charset=UTF-8',
{'fraction_non_alphanumeric': 0.11052843888664785, 'fraction_numerical': 0.0008067769261799112, 'mean_word_length': 4.523385300668151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7027347', 'n_tokens_mistral': 784, 'n_tokens_neox': 777, 'n_words': 175}