Use analyze now for images

This commit is contained in:
LittleSheep 2024-12-29 11:09:54 +08:00
parent d4fbdd397e
commit e503c3f02f
3 changed files with 6 additions and 0 deletions

View File

@ -247,6 +247,7 @@ class PostWriteController extends ChangeNotifier {
media.toFile()!,
place.$1,
place.$2,
analyzeNow: media.type == SnMediaType.image,
onProgress: (value) {
progress = value;
notifyListeners();

View File

@ -154,10 +154,12 @@ class SnAttachmentProvider {
String rid,
String cid, {
Function(double progress)? onProgress,
bool analyzeNow = false,
}) async {
final resp = await _sn.client.post(
'/cgi/uc/fragments/$rid/$cid',
data: data,
queryParameters: {'analyzeNow': analyzeNow},
options: Options(headers: {'Content-Type': 'application/octet-stream'}),
onSendProgress: (count, total) {
if (onProgress != null) {
@ -178,6 +180,7 @@ class SnAttachmentProvider {
SnAttachmentFragment place,
int chunkSize, {
Function(double progress)? onProgress,
bool analyzeNow = false,
}) async {
final Map<String, dynamic> chunks = place.fileChunks;
var completedTasks = 0;
@ -200,6 +203,7 @@ class SnAttachmentProvider {
data,
place.rid,
entry.key,
analyzeNow: analyzeNow,
onProgress: (progress) {
final overallProgress = (completedTasks + progress) / chunks.length;
onProgress?.call(overallProgress);

View File

@ -83,6 +83,7 @@ class ChatMessageInputState extends State<ChatMessageInput> {
media.toFile()!,
place.$1,
place.$2,
analyzeNow: media.type == SnMediaType.image,
onProgress: (progress) {
// Calculate overall progress for attachments
setState(() {