Skip to content

Commit

Permalink
Merge pull request #84 from mylxsw/develop
Browse files Browse the repository at this point in the history
增加图生视频功能,增加图片动作功能(类似于 Workflow,一键将图片发送到图生视频、图生图、高清、上色)
  • Loading branch information
mylxsw authored Jan 4, 2024
2 parents a8bcb7b + aec32ea commit 20d3c16
Show file tree
Hide file tree
Showing 40 changed files with 1,460 additions and 84 deletions.
4 changes: 4 additions & 0 deletions AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

cd "$(dirname "$0")"
exec ./askaide
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ build-macos:
codesign -f -s "Developer ID Application: YIYAO GUAN (N95437SZ2A)" build/macos/Build/Products/Release/AIdea.app
open build/macos/Build/Products/Release/

build-appimage:
flutter build linux --no-tree-shake-icons --release
mkdir -p aidea_app.AppDir
cp -r build/linux/x64/release/bundle/* aidea_app.AppDir
cp assets/app.png aidea_app.AppDir/
cp AppRun aidea_app.AppDir/
cp askaide.desktop aidea_app.AppDir/
appimagetool aidea_app.AppDir/

build-web:
flutter build web --web-renderer canvaskit --release --dart-define=FLUTTER_WEB_CANVASKIT_URL=https://resources.aicode.cc/canvaskit/
cd scripts && go run main.go ../build/web/main.dart.js && cd ..
Expand Down
11 changes: 11 additions & 0 deletions askaide.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.0
Name=Ask aide
Comment=Ask aide!
Icon=app
Exec=askaide %U
Terminal=false
Type=Application
Categories=Utility;
Keywords=Internet;
StartupNotify=false
Binary file added assets/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/text-to-video.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION=1.0.9
VERSION=1.0.10

rm -fr build/web

Expand Down
46 changes: 44 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,21 @@ PODS:
- Mantle (2.2.0):
- Mantle/extobjc (= 2.2.0)
- Mantle/extobjc (2.2.0)
- media_kit_libs_ios_video (1.0.4):
- Flutter
- media_kit_native_event_loop (1.0.0):
- Flutter
- media_kit_video (0.0.1):
- Flutter
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- record (0.0.1):
- Flutter
- screen_brightness_ios (0.1.0):
- Flutter
- SDWebImage (5.15.5):
- SDWebImage/Core (= 5.15.5)
- SDWebImage/Core (5.15.5)
Expand All @@ -100,6 +110,10 @@ PODS:
- Flutter
- url_launcher_ios (0.0.1):
- Flutter
- volume_controller (0.0.1):
- Flutter
- wakelock_plus (0.0.1):
- Flutter
- WechatOpenSDK-XCFramework (2.0.2)

DEPENDENCIES:
Expand All @@ -115,14 +129,21 @@ DEPENDENCIES:
- fluwx (from `.symlinks/plugins/fluwx/ios`)
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
- in_app_purchase_storekit (from `.symlinks/plugins/in_app_purchase_storekit/darwin`)
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
- media_kit_video (from `.symlinks/plugins/media_kit_video/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- record (from `.symlinks/plugins/record/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- tobias (from `.symlinks/plugins/tobias/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- volume_controller (from `.symlinks/plugins/volume_controller/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -161,10 +182,20 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_gallery_saver/ios"
in_app_purchase_storekit:
:path: ".symlinks/plugins/in_app_purchase_storekit/darwin"
media_kit_libs_ios_video:
:path: ".symlinks/plugins/media_kit_libs_ios_video/ios"
media_kit_native_event_loop:
:path: ".symlinks/plugins/media_kit_native_event_loop/ios"
media_kit_video:
:path: ".symlinks/plugins/media_kit_video/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
record:
:path: ".symlinks/plugins/record/ios"
screen_brightness_ios:
:path: ".symlinks/plugins/screen_brightness_ios/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
Expand All @@ -177,6 +208,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/tobias/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
volume_controller:
:path: ".symlinks/plugins/volume_controller/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"

SPEC CHECKSUMS:
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
Expand All @@ -196,19 +231,26 @@ SPEC CHECKSUMS:
in_app_purchase_storekit: 4fb7ee9e824b1f09107fbfbbce8c4b276366dc43
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
record: cae05d8dd3cdb1dea3511b20e5a5811a1ae00d0d
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
SDWebImageWebPCoder: 295a6573c512f54ad2dd58098e64e17dcf008499
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

COCOAPODS: 1.12.1
COCOAPODS: 1.14.3
1 change: 1 addition & 0 deletions lib/bloc/creative_island_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class CreativeIslandBloc
});

on<CreativeIslandHistoryItemLoadEvent>((event, emit) async {
emit(CreativeIslandHistoryItemLoading());
emit(CreativeIslandHistoryItemLoaded(
item: await APIServer().creativeHistoryItem(
hisId: event.itemId,
Expand Down
2 changes: 2 additions & 0 deletions lib/bloc/creative_island_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class CreativeIslandListLoaded extends CreativeIslandState {
get error => _error;
}

class CreativeIslandHistoryItemLoading extends CreativeIslandState {}

class CreativeIslandHistoryItemLoaded extends CreativeIslandState {
final Object? error;
final CreativeItemInServer? item;
Expand Down
2 changes: 1 addition & 1 deletion lib/helper/constant.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

// 客户端应用版本号
const clientVersion = '1.0.10';
const clientVersion = '1.0.11';
// 本地数据库版本号
const databaseVersion = 26;

Expand Down
15 changes: 15 additions & 0 deletions lib/helper/env.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io' show Platform;

/// 默认 API 服务器地址
/// 注意:当你使用自己的服务器时,请修改该地址为你自己的服务器地址
const defaultAPIServerURL = 'https://ai-api.aicode.cc';
Expand All @@ -16,3 +18,16 @@ String get apiServerURL {

return url;
}

String get getDbBasePath {
String home='';
Map<String, String> envVars = Platform.environment;
if (Platform.isMacOS) {
home = envVars['HOME']!;
} else if (Platform.isLinux) {
home = envVars['HOME']!;
} else if (Platform.isWindows) {
home = envVars['UserProfile']!;
}
return home;
}
67 changes: 58 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:path/path.dart';

import 'package:askaide/bloc/account_bloc.dart';
import 'package:askaide/bloc/background_image_bloc.dart';
import 'package:askaide/bloc/chat_chat_bloc.dart';
Expand Down Expand Up @@ -100,9 +102,13 @@ import 'page/component/theme/theme.dart';
import 'package:sizer/sizer.dart';
import 'package:askaide/helper/http.dart' as httpx;
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:media_kit/media_kit.dart';

import 'package:askaide/helper/env.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();
httpx.HttpClient.init();

// FlutterError.onError = (FlutterErrorDetails details) {
Expand All @@ -121,6 +127,8 @@ void main() async {
if (PlatformTool.isWindows() || PlatformTool.isLinux()) {
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
var path=absolute(join(getDbBasePath, '.aideal', 'databases'));
databaseFactory.setDatabasesPath(path);
}
}

Expand Down Expand Up @@ -226,7 +234,6 @@ class MyApp extends StatefulWidget {

// Bloc
late final RoomBloc chatRoomBloc;
late final CreativeIslandBloc creativeIslandBloc;
late final GalleryBloc galleryBloc;
late final AccountBloc accountBloc;
late final VersionBloc versionBloc;
Expand All @@ -248,7 +255,6 @@ class MyApp extends StatefulWidget {
}) {
chatRoomBloc =
RoomBloc(chatMsgRepo: chatMsgRepo, stateManager: messageStateManager);
creativeIslandBloc = CreativeIslandBloc(creativeIslandRepo);
accountBloc = AccountBloc(settingRepo);
versionBloc = VersionBloc();
galleryBloc = GalleryBloc();
Expand Down Expand Up @@ -527,7 +533,9 @@ class MyApp extends StatefulWidget {
MultiBlocProvider(
providers: [
BlocProvider.value(value: accountBloc),
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: UserCenterScreen(
settings: context.read<SettingRepository>()),
Expand Down Expand Up @@ -577,7 +585,9 @@ class MyApp extends StatefulWidget {
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: DrawListScreen(
setting: settingRepo,
Expand All @@ -592,13 +602,17 @@ class MyApp extends StatefulWidget {
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: ImageEditDirectScreen(
setting: settingRepo,
title: AppLocale.superResolution.getString(context),
apiEndpoint: 'upscale',
note: state.queryParameters['note'],
initWaitDuration: 15,
initImage: state.queryParameters['init_image'],
),
),
),
Expand All @@ -610,13 +624,39 @@ class MyApp extends StatefulWidget {
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: ImageEditDirectScreen(
setting: settingRepo,
title: AppLocale.colorizeImage.getString(context),
apiEndpoint: 'colorize',
note: state.queryParameters['note'],
initWaitDuration: 15,
initImage: state.queryParameters['init_image'],
),
),
),
),
GoRoute(
name: 'creative-video',
path: '/creative-draw/create-video',
parentNavigatorKey: _shellNavigatorKey,
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: ImageEditDirectScreen(
setting: settingRepo,
title: '图生视频',
apiEndpoint: 'image-to-video',
note: state.queryParameters['note'],
initWaitDuration: 60,
initImage: state.queryParameters['init_image'],
),
),
),
Expand Down Expand Up @@ -653,6 +693,8 @@ class MyApp extends StatefulWidget {
),
mode: state.queryParameters['mode']!,
id: state.queryParameters['id']!,
note: state.queryParameters['note'],
initImage: state.queryParameters['init_image'],
),
),
),
Expand All @@ -673,6 +715,7 @@ class MyApp extends StatefulWidget {
),
type: state.queryParameters['type']!,
id: state.queryParameters['id']!,
note: state.queryParameters['note'],
),
),
),
Expand All @@ -685,7 +728,9 @@ class MyApp extends StatefulWidget {
return transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: MyCreationScreen(
setting: settingRepo,
Expand All @@ -703,7 +748,9 @@ class MyApp extends StatefulWidget {
return transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: CreativeModelScreen(setting: settingRepo),
),
Expand All @@ -722,7 +769,9 @@ class MyApp extends StatefulWidget {
return transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: creativeIslandBloc),
BlocProvider(
create: (context) =>
CreativeIslandBloc(creativeIslandRepo)),
],
child: MyCreationItemPage(
setting: settingRepo,
Expand Down
Loading

0 comments on commit 20d3c16

Please sign in to comment.