feat(chat): Add context attachment and knowledge base support

This commit is contained in:
cogwheel0
2025-11-26 22:19:19 +05:30
parent 97e882c173
commit 75ba0dc01d
11 changed files with 1052 additions and 65 deletions

View File

@@ -1483,6 +1483,52 @@ class ApiService {
return [];
}
Future<Map<String, dynamic>?> processWebpage({
required String url,
String? collectionName,
}) async {
_traceApi('Processing webpage: $url');
try {
final response = await _dio.post(
'/api/v1/retrieval/process/web',
data: {
'url': url,
if (collectionName != null) 'collection_name': collectionName,
},
);
if (response.data is Map<String, dynamic>) {
return response.data as Map<String, dynamic>;
}
return null;
} catch (e) {
_traceApi('Process webpage failed: $e');
return null;
}
}
Future<Map<String, dynamic>?> processYoutube({
required String url,
String? collectionName,
}) async {
_traceApi('Processing YouTube URL: $url');
try {
final response = await _dio.post(
'/api/v1/retrieval/process/youtube',
data: {
'url': url,
if (collectionName != null) 'collection_name': collectionName,
},
);
if (response.data is Map<String, dynamic>) {
return response.data as Map<String, dynamic>;
}
return null;
} catch (e) {
_traceApi('Process YouTube failed: $e');
return null;
}
}
// Web Search
Future<Map<String, dynamic>> performWebSearch(List<String> queries) async {
_traceApi('Performing web search for queries: $queries');