Giter Site home page Giter Site logo

gotrays.app's Introduction

GotraysApp

介绍

gotrays-app 一款基于Maui Blazor实现的App,支持ChatGPT聊天,支持图形AI,支持角色定义 支持检查更新。 打造Gotrays生态开源免费。 后续长期开源维护支持

  • Maui Blazor
  • Masa Blazor

功能

支持ChatGPT3.5 支持ChatGPT3.5-16K 支持图片AI模型

支持

贡献

如果您想参与贡献,请按照一下步骤

  1. 对于项目进行Fork,拉取代码
git clone https://github.com/239573049/Gotrays.App.git
  1. 新建分支,如果是新功能请使用feature/xxx,使用feature作为前缀,增加/在创建分支的时候git会创建目录层级

  2. 对于项目进行修改,并且对于修改的部分存在复杂逻辑请对于代码块进行注释,参考下例

/// <summary>
/// Android 更新App实现
/// </summary>
public class UpgradeService : IUpgradeService
{
    private readonly HttpClient _client;

    public UpgradeService(IHttpClientFactory httpClientFactory)
    {
        _client = httpClientFactory.CreateClient(nameof(UpgradeService));
    }

    public void InstallNewVersion()
    {
        var file = $"{FileSystem.AppDataDirectory}/{"com.token.gotraysapp.apk"}";

        var apkFile = new Java.IO.File(file);

        var intent = new Intent(Intent.ActionView);
        // 判断Android版本
        if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
        {
            //给临时读取权限
            intent.SetFlags(ActivityFlags.GrantReadUriPermission);
            var uri = FileProvider.GetUriForFile(Application.Context, "com.token.gotraysapp.fileprovider", apkFile);
            // 设置显式 MIME 数据类型
            intent.SetDataAndType(uri, "application/vnd.android.package-archive");
        }
        else
        {
            intent.SetDataAndType(Uri.FromFile(new Java.IO.File(file)), "application/vnd.android.package-archive");
        }
        //指定以新任务的方式启动Activity
        intent.AddFlags(ActivityFlags.NewTask);

        //激活一个新的Activity
        Application.Context.StartActivity(intent);
    }

    public async Task DownloadFileAsync(string url, Action<long, long> action)
    {
        var req = new HttpRequestMessage(new HttpMethod("GET"), url);
        var response = _client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead).Result;
        var allLength = response.Content.Headers.ContentLength;
        await using var stream = await response.Content.ReadAsStreamAsync();
        var file = $"{FileSystem.AppDataDirectory}/{"com.token.gotraysapp.apk"}";
        await using var fileStream = new FileStream(file, FileMode.Create);
        var buffer = new byte[1024 * 500];
        var readLength = 0;
        int length;
        while ((length = await stream.ReadAsync(buffer)) != 0)
        {
            readLength += length;
            action(readLength, allLength!.Value);
            // 写入到文件
            fileStream.Write(buffer, 0, length);
        }
    }
}
  1. 新建PR。

捐赠

支持微信捐赠,感谢支持

zs

交流

qq技术交流群: 737776595 wx请联系wk28u9123456789

gotrays.app's People

Contributors

239573049 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.