-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathContextChatSearchTaskType.php
More file actions
99 lines (88 loc) · 2.22 KB
/
Copy pathContextChatSearchTaskType.php
File metadata and controls
99 lines (88 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\ContextChat\TaskProcessing;
use OCA\ContextChat\AppInfo\Application;
use OCP\IL10N;
use OCP\TaskProcessing\EShapeType;
use OCP\TaskProcessing\ITaskType;
use OCP\TaskProcessing\ShapeDescriptor;
class ContextChatSearchTaskType implements ITaskType {
public const ID = Application::APP_ID . ':context_chat_search';
public function __construct(
private IL10N $l,
) {
}
/**
* @inheritDoc
* @since 2.3.0
*/
public function getName(): string {
return $this->l->t('Context Chat search');
}
/**
* @inheritDoc
* @since 2.3.0
*/
public function getDescription(): string {
return $this->l->t('Search with Context Chat.');
}
/**
* @return string
* @since 2.3.0
*/
public function getId(): string {
return self::ID;
}
/**
* @return ShapeDescriptor[]
* @since 2.3.0
*/
public function getInputShape(): array {
return [
'prompt' => new ShapeDescriptor(
$this->l->t('Prompt'),
$this->l->t('Search your documents, files and more'),
EShapeType::Text,
),
'scopeType' => new ShapeDescriptor(
$this->l->t('Scope type'),
'Any of the following values: "none", "provider".', // not translated as these are fixed values
EShapeType::Text,
),
'scopeList' => new ShapeDescriptor(
$this->l->t('Scope list'),
$this->l->t('list of providers'),
EShapeType::ListOfTexts,
),
'scopeListMeta' => new ShapeDescriptor(
$this->l->t('Scope list metadata'),
$this->l->t('Required to nicely render the scope list in assistant'),
EShapeType::Text,
),
'limit' => new ShapeDescriptor(
$this->l->t('Max result number'),
$this->l->t('Maximum number of results returned by Context Chat'),
EShapeType::Number,
),
];
}
/**
* @return ShapeDescriptor[]
* @since 2.3.0
*/
public function getOutputShape(): array {
return [
// each string is a json encoded object
// { id: string, label: string, icon: string, url: string }
'sources' => new ShapeDescriptor(
$this->l->t('Sources'),
$this->l->t('The sources that were found'),
EShapeType::ListOfTexts,
),
];
}
}