1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Entity; |
8
|
|
|
|
9
|
|
|
use Doctrine\ORM\Mapping as ORM; |
10
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
11
|
|
|
use Chamilo\CoreBundle\Repository\AiRequestsRepository; |
12
|
|
|
|
13
|
|
|
#[ORM\Table(name: 'ai_requests')] |
14
|
|
|
#[ORM\Entity(repositoryClass: AiRequestsRepository::class)] |
15
|
|
|
class AiRequests |
16
|
|
|
{ |
17
|
|
|
#[ORM\Id] |
18
|
|
|
#[ORM\GeneratedValue] |
19
|
|
|
#[ORM\Column(type: 'integer')] |
20
|
|
|
private ?int $id = null; |
21
|
|
|
|
22
|
|
|
#[Assert\NotBlank] |
23
|
|
|
#[ORM\Column(type: 'integer')] |
24
|
|
|
private int $userId; |
25
|
|
|
|
26
|
|
|
#[Assert\NotBlank] |
27
|
|
|
#[ORM\Column(type: 'string', length: 255)] |
28
|
|
|
private string $toolName; |
29
|
|
|
|
30
|
|
|
#[Assert\NotBlank] |
31
|
|
|
#[ORM\Column(type: 'datetime')] |
32
|
|
|
private \DateTimeInterface $requestedAt; |
33
|
|
|
|
34
|
|
|
#[Assert\NotBlank] |
35
|
|
|
#[ORM\Column(type: 'text')] |
36
|
|
|
private string $requestText; |
37
|
|
|
|
38
|
|
|
#[ORM\Column(type: 'integer', nullable: true)] |
39
|
|
|
private ?int $promptTokens = null; |
40
|
|
|
|
41
|
|
|
#[ORM\Column(type: 'integer', nullable: true)] |
42
|
|
|
private ?int $completionTokens = null; |
43
|
|
|
|
44
|
|
|
#[ORM\Column(type: 'integer', nullable: true)] |
45
|
|
|
private ?int $totalTokens = null; |
46
|
|
|
|
47
|
|
|
#[Assert\NotBlank] |
48
|
|
|
#[ORM\Column(type: 'string', length: 50)] |
49
|
|
|
private string $aiProvider; |
50
|
|
|
|
51
|
|
|
public function __construct() |
52
|
|
|
{ |
53
|
|
|
$this->requestedAt = new \DateTime(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function getId(): ?int |
57
|
|
|
{ |
58
|
|
|
return $this->id; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getUserId(): int |
62
|
|
|
{ |
63
|
|
|
return $this->userId; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function setUserId(int $userId): self |
67
|
|
|
{ |
68
|
|
|
$this->userId = $userId; |
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function getToolName(): string |
73
|
|
|
{ |
74
|
|
|
return $this->toolName; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function setToolName(string $toolName): self |
78
|
|
|
{ |
79
|
|
|
$this->toolName = $toolName; |
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getRequestedAt(): \DateTimeInterface |
84
|
|
|
{ |
85
|
|
|
return $this->requestedAt; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getRequestText(): string |
89
|
|
|
{ |
90
|
|
|
return $this->requestText; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function setRequestText(string $requestText): self |
94
|
|
|
{ |
95
|
|
|
$this->requestText = $requestText; |
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function getPromptTokens(): ?int |
100
|
|
|
{ |
101
|
|
|
return $this->promptTokens; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function setPromptTokens(?int $promptTokens): self |
105
|
|
|
{ |
106
|
|
|
$this->promptTokens = $promptTokens; |
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function getCompletionTokens(): ?int |
111
|
|
|
{ |
112
|
|
|
return $this->completionTokens; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function setCompletionTokens(?int $completionTokens): self |
116
|
|
|
{ |
117
|
|
|
$this->completionTokens = $completionTokens; |
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function getTotalTokens(): ?int |
122
|
|
|
{ |
123
|
|
|
return $this->totalTokens; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public function setTotalTokens(?int $totalTokens): self |
127
|
|
|
{ |
128
|
|
|
$this->totalTokens = $totalTokens; |
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function getAiProvider(): string |
133
|
|
|
{ |
134
|
|
|
return $this->aiProvider; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function setAiProvider(string $aiProvider): self |
138
|
|
|
{ |
139
|
|
|
$this->aiProvider = $aiProvider; |
140
|
|
|
return $this; |
141
|
|
|
} |
142
|
|
|
} |
143
|
|
|
|