text:
[WIP] Add Docker environment for easy setup of the project

Issue: https://github.com/grumpyp/aixplora/issues/42

The idea is that someone who needs to set up the project initially they can just run docker compose up which should build everything for them
Since some of us are facing issues installing the front-end, I am trying to move the node_modules folder from the container to the local machine. This way it will help with the IDE/LSP suggestions.
Doing so actually installs the packages every time when we spin up our container which is clumsy. But the subsequent installations take less time because they're already installed the first time.

Issues:
The application runs but there are some errors in the log

after running docker compose up  aix-fe  | > start:preload
  aix-fe  | > cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts
  aix-fe  |
  aix-fe  |
  aix-fe  | > start:main
  aix-fe  | > cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .
  aix-fe  |
  aix-fe  | Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
  aix-fe  | [electronmon] waiting for a change to restart it
  aix-fe  | [electronmon] app exited with code null, waiting for change to restart it
  aix-fe  | [131:0100/000000.895638:ERROR:zygote_linux.cc(661)] write: Broken pipe (32)
  a

Navigating to the UI

Todo

[ ] modify readme files

The following error show's up here:
(venv) patrickgerard ~/Documents/GitHub/aixplora [docker1] $ docker compose build
[+] Building 32.1s (23/27)
 => [aixplora-frontend internal] load build definition from Dockerfile                                                                                0.1s
 => => transferring dockerfile: 32B                                                                                0.0s
 => [aixplora-backend internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 32B                                                                                0.0s
 => [aixplora-frontend internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [aixplora-backend internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [aixplora-frontend internal] load metadata for docker.io/library/node:18                                                                                1.6s
 => [aixplora-backend internal] load metadata for docker.io/library/python:3.8.12-slim-buster                                                                          1.5s
 => [auth] library/python:pull token for registry-1.docker.io                                                                                0.0s
 => [auth] library/node:pull token for registry-1.docker.io                                                                                0.0s
 => [aixplora-frontend internal] load build context                                                                                8.1s
 => => transferring context: 6.83MB                                                                                7.7s
 => [aixplora-frontend 1/9] FROM docker.io/library/node:18@sha256:8cdf7234449f35e579f7491137807ddb3a089f028862f7ab69af437cc9f47ff1                                     0.0s
 => [aixplora-backend 1/8] FROM docker.io/library/python:3.8.12-slim-buster@sha256:26ab58f6b8936fe59303b0ca0e915d5f9e071ef8b9bf7b3d716b4068f11443dc                    0.0s
 => [aixplora-backend internal] load build context                                                                                0.1s
 => => transferring context: 9.57kB                                                                                0.1s
 => CACHED [aixplora-backend 2/8] WORKDIR /usr/src/app                                                                                0.0s
 => CACHED [aixplora-backend 3/8] RUN apt-get update && apt-get install -y build-essential                                                                             0.0s
 => CACHED [aixplora-backend 4/8] COPY backend/requirements.txt .                                                                                0.0s
 => CANCELED [aixplora-backend 5/8] RUN pip install --no-cache-dir -r requirements.txt                                                                                30.0s
 => CACHED [aixplora-frontend 2/9] WORKDIR /usr/src/app                                                                                0.0s
 => CACHED [aixplora-frontend 3/9] RUN apt-get update && apt-get install -y build-essential python                                                                     0.0s
 => CACHED [aixplora-frontend 4/9] RUN apt-get update && apt-get install     git libx11-xcb1 libxcb-dri3-0 libxtst6 libnss3 libatk-bridge2.0-0 libgtk-3-0 libxss1 lib  0.0s
 => CACHED [aixplora-frontend 5/9] COPY . .                                                                                0.0s
 => CACHED [aixplora-frontend 6/9] RUN chown -R node /usr/src/app                                                                                0.0s
 => [aixplora-frontend 7/9] RUN npm install                                                                                21.3s
 => ERROR [aixplora-frontend 8/9] RUN chown root /usr/src/app/node_modules/electron/dist/chrome-sandbox                                                                0.3s
------
 > [aixplora-frontend 8/9] RUN chown root /usr/src/app/node_modules/electron/dist/chrome-sandbox:
#0 0.297 chown: cannot access '/usr/src/app/node_modules/electron/dist/chrome-sandbox': No such file or directory
------
failed to solve: executor failed running [/bin/sh -c chown root /usr/src/app/node_modules/electron/dist/chrome-sandbox]: exit code: 1

repo: grumpyp/aixplora


text:
Pr 1711588498

Description
Fixes #000.

TODOs
Read the Gruntwork contribution guidelines.

[ ] Update the docs.
[ ] Run the relevant tests successfully, including pre-commit checks.
[ ] Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
[ ] Include release notes. If this PR is backward incompatible, include a migration guide.
[ ] Attention Grunts - if this PR adds support for a new resource, ensure the nuke_sandbox and nuke_phxdevops jobs in .circleci/config.yml have been updated with appropriate exclusions (either directly in the job or via the .circleci/nuke_config.yml file) to prevent nuking IAM roles, groups, resources, etc that are important for the test accounts.

Release Notes (draft)

Added / Removed / Updated [X].
Migration Guide

sorry, wrong repo

source: gharchive/pull-request

repo: gruntwork-io/cloud-nuke

license: MIT

license_type: permissive

license_source: github-api


text:
Added an retry pattern for when terraform cloud private registry returns a 429 and needs throttling

Full message given when this happens, information redacted
Error: Error accessing remote module registry

Failed to retrieve a download URL for
app.terraform.io/company-x/module-y/provider-z 0.0.0 from app.terraform.io:
error getting download location for
"app.terraform.io/company-x/module-y/provider-z": 429 Too Many Requests
resp:{"errors":[{"status":"429","title":"Too many requests","detail":"You have
exceeded the API's rate limit of 30 requests per second."}]}

Tests passed! Merging now.

https://github.com/gruntwork-io/terragrunt/releases/tag/v0.24.1

repo: gruntwork-io/terragrunt

license: mit

license_source: bigquery


text:
Clarify dependency settings.

I'd like some help with wording here...

Thanks for the review! Merging nao. 🐱


text:
🛑 volkstanzwannwo.at is down

In 5e114fb, volkstanzwannwo.at (https://volkstanzwannwo.at) was down:

HTTP code: 0
Response time: 0 ms

Resolved: volkstanzwannwo.at is back up in 9b08f55.

source: gharchive/issue


text:
🛑 kinderundjugendtanz.at is down

In 7dee03d, kinderundjugendtanz.at (https://kinderundjugendtanz.at) was down:

HTTP code: 0
Response time: 0 ms

Resolved: kinderundjugendtanz.at is back up in e64e920.


text:
🛑 volkstanz.st is down

In a1d90b4, volkstanz.st (https://volkstanz.st) was down:

HTTP code: 0
Response time: 0 ms

Resolved: volkstanz.st is back up in de880e1.


text:
MP4 files not loaded!

I use your amazing code, but there is a problem with that, mp4 files not loaded, i added the mime type but mp4 files not loaded yet.
please help me.

Sorry that problem is because of my video details and the NanoHTTPd works like a charm!

repo: gseguin/NanoHTTPd


text:
关于上传封面的问题

我使用豆瓣获取图书信息后，在封面那一览会自动填入封面网址信息，但是每次都会出现错误提示：
“You are not allowed to access localhost or the local network for cover uploads”
但同时也提示：已成功更新元数据
如果把封面那一栏留空，就不会出现这个。
请问这是什么问题？是我哪里没有设置好吗？

补充一下，上传电脑中的图片就没有这样的问题。


text:
Data type was missing in an example in README

Tiny change

Type but appreciated, @nayanshah. I love accuracy.
Thank you :)

authors: gsscoder nayanshah

repo: gsscoder/commandline


text:
flutter_unionad is not init, please check., null, java.lang.RuntimeException: flutter_unionad is not init, please check.

E/flutter ( 5511): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, flutter_unionad is not init, please check., null, java.lang.RuntimeException: flutter_unionad is not init, please check.
Create initializer failed: com.bytedance.sdk.openadsdk.api.plugin.c: dlopen failed: library "libpangleflipped.so" not found
E/初始化( 6006): 失败 4201  No initializer

加载任何广告前 必须完成初始化

更新最新插件试试 @lude1994


text:
Change oauth2.NoContext to context.TODO()

This is the new recommendation: https://godoc.org/golang.org/x/oauth2#pkg-variables
Note: tested with the Slides quickstart.

thanks!

repo: gsuitedevs/go-samples


text:
Use https for all links

Hi all
This is a followup to https://github.com/gtk-rs/gtk/pull/1054
Cheers,
Stefan

Fixed

Thanks!


text:
What about pangocairo crate?

Is it planned? Or is it already exist and I didn't found it?
Or not even as a crate, but as a feature.

I know pango (which has a binding), I know cairo (which also has a binding), I didn't know pangocairo was a thing.

I'm speaking about this: https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html
As far as I understand, it's part of pango. On Gentoo I have /usr/include/pango-1.0/pango/pangocairo.h as part of pango package.
Looks like pango crate doesn't have such bindings. Probably title is a bit misleading.

Hum strange. Have you check the master branch or the crate one?

Yes. I didn't found anything about cairo here: https://github.com/gtk-rs/sys/blob/master/pango-sys/src/lib.rs

Then we haven't done it yet. Motivated to add it? :)

All I can found is: https://github.com/gtk-rs/gir-files/blob/master/PangoCairo-1.0.gir
Yes, why not. Any readme about how to do this? As far as I understand you are using codegen for this.

Yes, take a look at gir's README (which is a bit short...). Normally you should be ok with it but don't hesitate to ask if you can't find out.

Well... I didn't really understand what I need to do.
As far as I understand, I should create gir-pangocairo.toml in gtk-rs/sys/conf/, because gir-files contains it as separate file. So it's really should be a create. Also there are an actual library called libpangocairo, which is part of the pango package.
Then I should hit make, but I get an error:
% make
gir/target/release/gir -c conf/gir-pangocairo.toml -o /media/data/Programming/Sources/gtk/sys/pangocairo-sys -d gir-files
thread 'main' panicked at 'src/parser.rs:659 Missing alias target's c:type in gir-files/freetype2-2.0.gir:12:7', src/parser.rs:53
note: Run with `RUST_BACKTRACE=1` for a backtrace.
make: *** [Makefile:9: pangocairo-sys/src/lib.rs] Error 10

Looks like it didn't like this line: https://github.com/gtk-rs/gir-files/blob/master/freetype2-2.0.gir#L12

And that's the moment when we summon @EPashkin to say: there is a panic! 😨

Looks like freetype2-2.0.gir is invalid. It should look like this:
<type name="int32" c:type="int"/>

but it's
<type name="int32"/>

Then I have to fix PangoCairo-1.0.gir
-        <type c:type="PangoFcFontMap"/>
+        <type name="FontMap" c:type="PangoFcFontMap"/>

Now I'm getting:
% make
gir/target/release/gir -c conf/gir-pangocairo.toml -o /media/data/Programming/Sources/gtk/sys/pangocairo-sys -d gir-files
thread 'main' panicked at 'Incomplete library, unresolved: ["freetype2.int32"]', src/library_postprocessing.rs:41
note: Run with `RUST_BACKTRACE=1` for a backtrace.
make: *** [Makefile:9: pangocairo-sys/src/lib.rs] Error 101

After patching freetype2-2.0.gir:
-      <type name="int32"/>
+      <type name="Int32" c:type="gint"/>

I got it working and I get a pangocairo-sys dir.
What next? I should send a pull request with it and then manually create bindings in a new git repo, like pango itself?

And I still can build it, because it depend on: cairo-sys, freetype2-sys.

Currently I against patching gir-files crate, so better not include pangocairo-sys to sys crate.
int32 IMHO better fixed on gir side by adding its type (gint as can be 64bits)
Don't know how to fix PangoFcFontMap issue as no such type in Pango-1.0.gir (only found PangoFontMap).

Seems PangoCairo-sys will be written manually (maybe with using generated code as template).
I also found https://github.com/jpernst/pangocairo-sys on crates.

I see. Then I will try to write it manually.
Yes, I saw this crate, but it has binding not only for pangocairo and I don't think it can be mixed with existing cairo and pango crates. And I want a crate, which will depend on gtk-rs libs.

So:

I have created pangocairo-sys crate, which works fine.
Then I have created pangocairo crate, which depend on pangocairo-sys, cairo and pango. Empty library has been build without errors.
Now I have to create an actual wrapper, to pangocairo-sys methods.

And there are problems. The root function looks like this:
pub fn pango_cairo_create_layout(cr: *mut cairo::cairo_t) -> *mut pango::PangoLayout;

so I have to write something like this:
pub fn create_layout(content: &cairo::Content) -> pango::Layout {
    unsafe { from_glib_full(ffi::pango_cairo_create_layout(content.to_glib_none().0)) }
}

but:

I get an error:the method `to_glib_none` exists but the following trait bounds were not satisfied: `cairo::Content : glib::translate::ToGlibPtr<_>`

There are no pango::Layout in pango crate.

Sorry for stupid questions, it's my first bindings.

Content is enum
May be you mean Context.
And yes, no PangoLayout

Yes, my mistake. So I should implement/wait for PangoLayout?

I added generation of layout in https://github.com/EPashkin/pango/tree/add_generation
Commit not full due my git error (It can't init submodules).
Makefile copied from working project so IMHO it run normally.
For generating I used fixed gir from https://github.com/EPashkin/gir/tree/fix_for_pango

So I should wait until it will be merged to the main tree?

I prefer leave this branch to you :wink:
Feel free to use it in your PR to pango.
At minimum better deignore Layout::get_alignment by adding "Pango.Alignment", to generate=[

I did not think that adding a simple wrapper like pangocairo will be such pain.
Yours branch contain an auto folder which should be manually ported to the widget folder. Am I correct?

Not, auto folder is primary, widget in pango crates or files in src in other gir-connected crates used only for part that can't properly generated by gir.
In your case I think you need add generation pango classes that needed for pangocairo crate and try minimize commented functions in generated code (if it works without problem, ex. "Pango.Rectangle" currently can't be used/generated).

Well, from on side I still have no idea what to do, but from another, I really need this crate...
Is there are any plans for making it or it not even planned?

Is I remember, no certain plans about applying gir to pango crate, mostly due gir deficiencies.
I don't use pango, so I don't sure what classes needed first, that why I propose that you add PR with classes or other definition that needed for pangocairo.
If you don't want or don't have time do it, then I add PR on weekend with minimal changes from current add_generation branch

The problem is that I didn't know what I need too. I have C code that I should port to Rust. It uses pangocairo. As far as I can see it uses almost all pangocairo methods.
I can write, I hope so, a wrapper around ffi, like pango and cairo itself, but all this generator stuff are beyond my understanding.

I mean if your pangocairo method will use some pango definition (as with Layout) you can add it (or try) with gir just by adding it definition to generate array in Gir.toml and run gir on it.

minimize commented functions in generated code

Manually?

I have finally figure out how to build your repo.
So I've added Pango.Alignment and got this error:
error[E0432]: unresolved import `glib_ffi`
 --> src/auto/enums.rs:5:5
  |
5 | use glib_ffi;
  |     ^^^^^^^^ no `glib_ffi` in the root

As I understand it's also should be fixed via gir?

I've added
[dependencies.glib-sys]
git = "https://github.com/gtk-rs/sys"
version = "0.3.2"

and not it saying that it's useless:
warning: unused import: `glib_ffi`, #[warn(unused_imports)] on by default
 --> src/auto/enums.rs:5:5
  |
5 | use glib_ffi;
  |     ^^^^^^^^

warning: unused import: `glib::error::ErrorDomain`, #[warn(unused_imports)] on by default
 --> src/auto/enums.rs:6:5
  |
6 | use glib::error::ErrorDomain;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^

So it's shouldn't be generated at first place?

Finally I made my create_layout method from pangocairo working.
Then what? I should add all methods from pangocairo while adding missing types to pango's Gir.toml? And if it will work - I'll have to create a pull request to yours pango fork?

Seems you solved extern crate glib_sys as glib_ffi; problem.
About adding PR: you need add it to https://github.com/gtk-rs/pango
If you can, remove lines in lib.rs like pub use ffi::PangoGravity as Gravity; and add generate these enums and flags. After that you need add many to_glib`from_glibto files inwidgets` dir.

Ok.
Next problem:
I've added "Pango.FontMap" to the Gir.toml, because I need this struct, and it generates all the data, but under #[cfg(feature = "v1_4")]. And the problem is that there is no v1_4 in pango_sys.
pango crate itself has v1_38 and v1_42.
I've added v1_4 = ["v1_38", "pango-sys/v1_38"] manually to pango's Cargo.toml and it's works for now.
How it should be solved?

Change\add min_cfg_version = "1.30" in pango\Gir.toml
I forgot to do that.

Ok. Fixed.
Where should I implement ToGlibPtr/FromGlibPtr traits? Not in the auto dir, presumably. In lib.rs?

For what class?

Yeap. Looks like it already implemented in by glib_wrapper!, because I'm getting
conflicting implementations of trait `glib::translate::ToGlibPtr<'_, *mut ffi::PangoLayout>` for type `&auto::layout::Layout`:

But if I remove it - I'm getting:
error[E0277]: the trait bound `pango::Layout: glib::translate::ToGlibPtr<'_, *mut pango_sys::PangoContext>` is not satisfied
  --> src/lib.rs:35:74
   |
35 |     unsafe { ffi::pango_cairo_update_context(cr.to_glib_none().0, layout.to_glib_none().0); };
   |                                                                          ^^^^^^^^^^^^ the trait `glib::translate::ToGlibPtr<'_, *mut pango_sys::PangoContext>` is not implemented for `pango::Layout`
   |
   = help: the following implementations were found:
   = help:   <pango::Layout as glib::translate::ToGlibPtr<'a, *mut glib::object::GObject>>
   = help:   <pango::Layout as glib::translate::ToGlibPtr<'a, *const pango_sys::PangoLayout>>
   = help:   <pango::Layout as glib::translate::ToGlibPtr<'a, *mut pango_sys::PangoLayout>>

The method itself:
pub fn show_layout(cr: &cairo::Context, layout: &pango::Layout) {
    unsafe { ffi::pango_cairo_update_context(cr.to_glib_none().0, layout.to_glib_none().0); };
}

Wait. I've misspelled the method... Forget about it.

Now I'm getting:
error: linking with `cc` failed: exit code: 1
  |

... a lot of text
 "-l" "pango-1.0" "-l" "gobject-2.0" "-l" "glib-2.0" "-l" "cairo" "-l" "pango-1.0" "-l" "gobject-2.0" "-l" "glib-2.0" "-l" "gobject-2.0" "-l" "glib-2.0" "-l" "glib-2.0" "-l" "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /media/data/Programming/Projects/rust/resvg/tools/rendersvg/target/debug/deps/libpangocairo-a39c28cc6685b440.rlib(pangocairo-a39c28cc6685b440.0.o): In function `pangocairo::create_layout':
/media/data/Programming/Projects/rust/pangocairo/src/lib.rs:27: undefined reference to `pango_cairo_create_layout'
collect2: error: ld returned 1 exit status

I understand that some libraries are missing during linking, but I've selected them in build.rs.
Here is pangocairo-sys/build.rs:
extern crate pkg_config;

use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::process;

fn main() {
    if let Err(s) = find() {
        let _ = writeln!(io::stderr(), "{}", s);
        process::exit(1);
    }
}

fn find() -> Result<(), Error> {
    let package_name = "pango";
    let shared_libs = ["pango-1.0", "pangocairo-1.0", "pango-1.0", "pangoft2-1.0"];
    let version = "1.38";
    // let version = if cfg!(feature = "v1_42") {
    //     "1.42"
    // } else if cfg!(feature = "v1_38") {
    //     "1.38"
    // } else if cfg!(feature = "v1_36_7") {
    //     "1.36.7"
    // } else if cfg!(feature = "v1_34") {
    //     "1.34"
    // } else if cfg!(feature = "v1_32_4") {
    //     "1.32.4"
    // } else if cfg!(feature = "v1_32") {
    //     "1.32"
    // } else if cfg!(feature = "v1_31") {
    //     "1.31"
    // } else {
    //     "1.30"
    // };

    if let Ok(lib_dir) = env::var("GTK_LIB_DIR") {
        for lib_ in shared_libs.iter() {
            println!("cargo:rustc-link-lib=dylib={}", lib_);
        }
        println!("cargo:rustc-link-search=native={}", lib_dir);
        return Ok(())
    }

    let target = env::var("TARGET").unwrap();
    let hardcode_shared_libs = target.contains("windows");

    let mut config = Config::new();
    config.atleast_version(version);
    if hardcode_shared_libs {
        config.cargo_metadata(false);
    }
    match config.probe(package_name) {
        Ok(library) => {
            if hardcode_shared_libs {
                for lib_ in shared_libs.iter() {
                    println!("cargo:rustc-link-lib=dylib={}", lib_);
                }
                for path in library.link_paths.iter() {
                    println!("cargo:rustc-link-search=native={}", path.to_str().unwrap());
                }
            }
            Ok(())
        }
        Err(Error::EnvNoPkgConfig(_)) | Err(Error::Command { .. }) => {
            for lib_ in shared_libs.iter() {
                println!("cargo:rustc-link-lib=dylib={}", lib_);
            }
            Ok(())
        }
        Err(err) => Err(err),
    }
}

and Here is pangocairo-sys/Cargo.toml:
[package]
name = "pangocairo-sys"
version = "0.1.0"
authors = ["Reizner Evgeniy <razrfalcon@gmail.com>"]
build = "build.rs"
license = "MIT"
description = "Rust bindings for the PangoCairo library"
repository = "https://github.com/razrfalcon/pangocairo-sys"
keywords = ["pango", "cairo", "ffi"]

[dependencies]
libc = "0.2"
cairo-sys-rs = { git = "https://github.com/gtk-rs/cairo" }
pango-sys = { git = "https://github.com/gtk-rs/sys" }

[dependencies.glib-sys]
git = "https://github.com/gtk-rs/sys"

[dependencies.gobject-sys]
git = "https://github.com/gtk-rs/sys"

[build-dependencies]
pkg-config = "0.3.7"

[lib]
name = "pangocairo_sys"

In build, package_name = "pangocairo"; ?
I don't see -l "pangocairo" in command line, may be you need minimize shared_libs

D'oh. Fixed by a proper package_name.

And again.
I've added "Pango.FontDescription" to the Gir.toml and removed one from widgets.
Now pango is failed to build:
error[E0277]: the trait bound `auto::font_description::FontDescription: glib::translate::FromGlibPtr<*const ffi::PangoFontDescription>` is not satisfied
  --> src/auto/layout.rs:86:13
   |
86 |             from_glib_none(ffi::pango_layout_get_font_description(self.to_glib_none().0))
   |             ^^^^^^^^^^^^^^ the trait `glib::translate::FromGlibPtr<*const ffi::PangoFontDescription>` is not implemented for `auto::font_description::FontDescription`
   |
   = help: the following implementations were found:
   = help:   <auto::font_description::FontDescription as glib::translate::FromGlibPtr<*mut ffi::PangoFontDescription>>
   = note: required because of the requirements on the impl of `glib::translate::FromGlibPtr<*const ffi::PangoFontDescription>` for `std::option::Option<auto::font_description::FontDescription>`
   = note: required by `glib::translate::from_glib_none`

error: aborting due to previous error

Method itself:
    pub fn get_font_description(&self) -> Option<FontDescription> {
        unsafe {
            from_glib_none(ffi::pango_layout_get_font_description(self.to_glib_none().0))
        }
    }

Problem in that sys says that pango_layout_get_font_description return *const ffi::PangoFontDescription, and generated defined only for *mut ffi::PangoFontDescription.
You need change in sys or add impl FromGlibPtr<*const ffi::PangoFontDescription> for FontDescription {.
Also I don't sure that you need generate classes in widgets if it work without it.

So I should add it to auto/layout.rs? But it will be overwritten.

Also I don't sure that you need generate classes in widgets if it work without it.
Not really understand it. I do not generate anything in widgets. I have removed font_description.rs from widgets, because it was generated in auto.

I mean that maybe you don't need generating any of widgets as it already present in crate.
But if it really need add something to generated crate, you can add module font_description.rs near lib.rs (or in case of pango in widgets) where be only impl FromGlibPtr for generated FontDescription

The problem is that in this case I will have to edit layout.rs, because it uses FontDescription. So in either cases I have to do manual corrections after each gen.

Seems there some misunderstanding. As I see call pango_layout_get_font_description don't compiled due FontDescription don't implement FromGlibPtr<*const ffi::PangoFontDescription> (only implement *mut ...) and you need add it somewhere. This can be added in separate module with  same name  font_description.rs but not in auto dir

Don't see reason to change generated layout.rs.

Also I missed your reason for generating "Pango.FontDescription".
If you need uncomment generated pango_layout_get_font_description, you can add "pango_layout_get_font_description" to manual array, without removing widgets\font_description.rs

Don't see reason to change generated layout.rs.

Because all changes will be missed after next gen.
How exactly should I implement this trait?
impl FromGlibPtr<*const ffi::PangoFontDescription> for FontDescription {
    unsafe fn from_glib_none(ptr: *const ffi::PangoFontDescription) -> Self {
        let tmp = ffi::pango_font_description_copy(ptr);
        assert!(!tmp.is_null());
        FontDescription(tmp)
    }

    unsafe fn from_glib_full(ptr: *const ffi::PangoFontDescription) -> Self {
        assert!(!ptr.is_null());
        FontDescription(ptr)
    }
}

error[E0308]: mismatched types
  --> src/lib.rs:29:25
   |
29 |         FontDescription(tmp)
   |                         ^^^ expected struct `glib::boxed::Boxed`, found *-ptr
   |
   = note: expected type `glib::boxed::Boxed<ffi::PangoFontDescription, auto::font_description::MemoryManager>`
   = note:    found type `*mut ffi::PangoFontDescription`

error[E0308]: mismatched types
  --> src/lib.rs:34:25
   |
34 |         FontDescription(ptr)
   |                         ^^^ expected struct `glib::boxed::Boxed`, found *-ptr
   |
   = note: expected type `glib::boxed::Boxed<ffi::PangoFontDescription, auto::font_description::MemoryManager>`
   = note:    found type `*const ffi::PangoFontDescription`

I've tried using widgets/font_description.rs, but I still got the same error. There is no particular motivation, I'm just trying to make it work.

Strange, I added to manual, added impl for const * with only notable changes in from_glib_full and it works fine.
No changes in auto\layout.rs.
    unsafe fn from_glib_full(ptr: *const ffi::PangoFontDescription) -> Self {
        assert!(!ptr.is_null());
        FontDescription(ptr as *mut _)
    }

*no changes other that generated

manual is in Gir.toml? Doesn't seems like it changed anything.
It's works for now. In the end I removed FontDescription from Gir.toml and edited auto/layout.rs manually.

Yes,
manual = [
    "Pango.FontDescription",
]

with removing it from generate, add impl to widgets/fond_description.rs and remove auto/font_description.rs.
I have no idea what you changed in auto/layout.rs

Cool. It works.
You sad:

you can add "pango_layout_get_font_description" to manual array

So I put pango_layout_get_font_description in manual. Which was wrong. Now everything works fine, without any changes in auto.

Sorry, I was copied wrong text, fixed it, but don't say about it.

Finally! I drew some text. Mission accomplished.
Will try to prepare a pull request tomorrow.

@RazrFalcon, I merged gir's PR with pango-related fixes.
Please, upgrade gir submodule to it. First line of generated file look // This file was generated by gir (aacfc92) from gir-files (71d73f0)

Done?.. It's my first pull request, so I could easily mess it up.

pango is done for now (I'll probably add new structs when I need them). But what to do with pangocairo-sys and pangocairo?
Should I publish them as two separate repos in my profile or in gtk project? Should I publish them oi n crates?

I prefer that it published in your profile (may be even only one crate as https://crates.io/crates/cairo-rs).
@GuillaumeGomez, what you think?

Ok. By one crate you mean that sys will be inside?

Yes.

Only problem with publishing your crate that we don't have planned date to publish pango, so at first it may depends not on crate but on git.

It's not a problem. I'm not planning to release my main project in crates any time soon.

How to reexport "defines" from sys? I need this define: https://github.com/gtk-rs/sys/blob/master/pango-sys/src/lib.rs#L573
Currently done by adding pub use ffi::PANGO_SCALE as SCALE; to the libs.rs.

Second problem. I need Rectangle. But adding "Pango.Rectangle",to manual doesn't work, because currently Rectangle is a trait. The object itself is ffi::PangoRectangle.
How is this should be solved?
PS: maybe we should create another issue for this tasks, because it's strictly pango crate problems.

Constant really can just reexported, but name better rustified like Scale.
As gir currently don't support direct record, you can only rewrite rectangle same as https://github.com/gtk-rs/gdk/blob/master/src/rectangle.rs

About new issue, it depend of you need of fast merging https://github.com/gtk-rs/pango/pull/54.
We can just move there and mark it as WIP.

I was wrong about constant name, SCALE is fine.

Ok. I will use this Rectangle implementations as a reference.

it depend of you need of fast merging
I'm not in rush. I'm using a local copy for now.

I'm fine with @RazrFalcon publishing the crate on his own, it's his code after all. We're just very glad to have his support for the gtk-rs project. ;)

@RazrFalcon, can you add link to your pangocairo git and close this Issue?

I do not publish it yet. I will do it later today.
But should it be closed? My crate will depend on git crates, and I can't release it on creates.io like this. Only when pango with my changes will be released to creates too.

Done: https://github.com/RazrFalcon/pangocairo-rs
Suggestions are welcome.
All the commented code in src/lib.rs can't be implemented now, because there are no such types in pango/cairo yet. But it's already supported all I need.

Done https://crates.io/crates/pangocairo !

authors: EPashkin GuillaumeGomez RazrFalcon

repo: gtk-rs/gtk


text:
Fix invalid cargo key for docs.rs

Part of gtk-rs/gir#845
cc @sdroege @EPashkin

👍

authors: EPashkin GuillaumeGomez

repo: gtk-rs/sourceview


text:
feat: Handle Ad Targeting

What does this change?
Brings frontend’s build-page-targeting to @guardian/commercial-core, and fully type it, with extensive JSDoc comment.
Most of these are now pure functions, except for document.referrer in SessionTargeting and local storage access in PersonalisedTargeting.
Subsets of targeting have been created based on their requirements:

getAdFreeTargeting: used only in ad-free contexts.
getContentTargeting: based on CAPI content. Takes an optional videoLength parameter.
getPersonalisedTargeting: requires a ConsentState to be passed to it.
getSessionTargeting: requires A/B test participations.
getViewportTargeting: requires to know if a privacy banner will be shown.
getUnsureTargeting: these can/should probably be removed.

Why?
Centralise knowledge, enforce types, link Ad Manager with source code.

Next steps
Start using these helpers inside frontend
Figure out a way to handle the asynchronous nature of ad targeting. Callbacks, maybe?

This has become quite unwieldy, so I’ll simply split it out in separate PRs:

Content Targeting: https://github.com/guardian/commercial-core/pull/421
…

repo: guardian/commercial-core


text:
Keep token counts

Transplanted from https://github.com/ShreyaR/guardrails/pull/287
This PR refactors the LLM callable wrappers to subclasses instead of function wrappers, and defines an LLMResponse object that allows returning tracking for the number of tokens used (implemented in openai).

Codecov Report
Patch coverage: 51.00% and project coverage change: -0.22% :warning:

Comparison is base (e3cdc10) 75.83% compared to head (ab372ff) 75.62%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
- Coverage   75.83%   75.62%   -0.22%
==========================================
  Files          31       31
  Lines        3526     3569      +43
==========================================
+ Hits         2674     2699      +25
- Misses        852      870      +18

Flag
Coverage Δ

unittests
75.62% <51.00%> (-0.22%)
:arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed
Coverage Δ

guardrails/applications/text2sql.py
73.13% <ø> (-0.40%)
:arrow_down:

guardrails/llm_providers.py
44.73% <37.86%> (-4.42%)
:arrow_down:

guardrails/run.py
92.37% <73.33%> (+0.24%)
:arrow_up:

guardrails/utils/logs_utils.py
78.57% <90.00%> (+0.79%)
:arrow_up:

guardrails/__init__.py
100.00% <100.00%> (ø)

guardrails/schema.py
83.10% <100.00%> (+1.34%)
:arrow_up:

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Can we get additional test coverage on this?

The changes that fell out of coverage are the LLM callable subclasses, which we're mocking (so they never get run). I think it's lower coverage because the function wrappers (also mocked and not run) were written with less lines of code.

The changes that fell out of coverage are the LLM callable subclasses, which we're mocking (so they never get run). I think it's lower coverage because the function wrappers (also mocked and not run) were written with less lines of code.

Can we add some unit tests on the LLM callable subclasses then?  We need unit tests on llm_providers.py in general so testing the changes here would be a good start.  We just shouldn't have decreasing coverage going forward.

Was working on tweaking our exception handling in the PromptCallable classes to allow tenacity to perform retries for us and based off of your branch for that to avoid merge conflicts.  Found a couple places where asyncs weren't being awaited and added some tests around the ArbitraryCallable and AsyncArbitraryCallable classes which should also hit their base classes where the exception handling happens.  I'm going to PR against this branch and that should put us in a good spot for test coverage.

If I'm reading this right, the outputs to the user from call and parse all stay the same, we're just now adding extra properties to the state via the guard logs to track token counts in and out when applicable?

That's correct.

Can we add some unit tests on the LLM callable subclasses then?

You're right, I agree they're necessary here. Thanks for the PR!

authors: CalebCourier codecov-commenter irgolic

repo: guardrails-ai/guardrails


text:
[Feature] Expand JSON $ref resolution

Refs are now resolved in full generality, allowing anchors, relative refs, and absolute refs.
Rather than pre-computing the grammars for schemas that happen to live in $defs, we now lazily compute grammars upon first reference.
Existing ref tests are replaced with the full set of tests from the JSON Schema test suite. Some are xfailed if they depend on other features that we do not (yet) support.
Keys in objects are now properly escaped in order to guarantee json.loads-ability (discovered this issue when running the new tests)

NOTE: this introduces a new dependency: referencing, which handles ref lookup for us (a fairly non-trivial task).

:warning: Please install the  to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 61.30%. Comparing base (855ce5b) to head (de08f44).
Report is 1 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1061      +/-   ##
==========================================
- Coverage   65.33%   61.30%   -4.03%
==========================================
  Files          63       63
  Lines        4795     4810      +15
==========================================
- Hits         3133     2949     -184
- Misses       1662     1861     +199

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

A couple of thoughts:

Should we have an option to prevent remote references? That is a (small) potential security boundary
Not for this PR, but does test_json.py need to become a json/ directory with multiple subfiles? It's getting to be quite a sizeable beast

Should we have an option to prevent remote references? That is a (small) potential security boundary

referencing doesn't seem to support remote references by default (although if the security concern is that this behavior will change in the future... fair enough). The API is such that you can do a bit of dependency injection to add this functionality if you desire. It might actually be nice to either expose this or to provide our own implementation for resolving remote refs (which would be turned off by default). See their docs here.

Not for this PR, but does test_json.py need to become a json/ directory with multiple subfiles? It's getting to be quite a sizeable beast

Yes, absolutely agreed.

@riedgar-ms they actually note the security concern in their docs

In the case of JSON Schema, the specifications generally discourage implementations from automatically retrieving these sorts of external resources over the network due to potential security implications. See schema-references in particular.
referencing will of course therefore not do any such thing automatically, and this section generally assumes that you have personally considered the security implications for your own use case.

authors: codecov-commenter hudson-ai riedgar-ms

repo: guidance-ai/guidance


text:
Unable to generate word document from template. Can't read the data of 'the loaded zip file'

I'm following the simple steps to replace a value in the attached word document. However, I get the below error. Also see the code snippet below. Please let me know what could be causing this issue. I'm running this code on Node version 10.18.0 on Ubuntu 18.04. I'm on the latest version of docx-templates 4.1.0
Error
(node:1728) UnhandledPromiseRejectionWarning: Error: Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?
Code snippet
const transactionTemplate = fs.readFileSync(
__dirname + '/../../data/transactionTemplates/DATE.docx'
);
const transactionDocument = await docxTemplate.createReport({
transactionTemplate,
data: {
date: '1/1/2020',
},
});
DATE.docx

You sould add the template to the template Option:
const transactionTemplate = fs.readFileSync(
  __dirname + '/../../data/transactionTemplates/DATE.docx'
);

const transactionDocument = await docxTemplate.createReport({
  template: transactionTemplate,
  data: {
    date: '1/1/2020',
  },
});

const transactionTemplate = fs.readFileSync(
    __dirname + '/../../data/transactionTemplates/DATE.docx'
);

const transactionDocument = await docxTemplate.createReport({
    template: transactionTemplate, <---- !
    data: {
        date: '1/1/2020',
    },
});

See above. You seem to be using ES6 object property value shorthand to initialise the object. Note that transactionTemplate should map to the template property.
Feel free to reopen if this doesn't work for you.

Thanks guys.. I swear I was staring at it and could not spot the difference.

repo: guigrpa/docx-templates


text:
Adding notes about pip upgrade

Following our discussion on Discord, I have added a note about upgrading pip, at both locations where that made sense.
I could have put a single big note on top of the page but I am afraid that some people only read the specific instructions they need. Please tell me if you think the duplicate note is not pretty.

Thank you!

authors: bgolinvaux gumyr


text:
[Docs] Add reference to locked Angular issue

Try to inject a reference to locked Angular issue https://github.com/angular/angular/issues/24824 that is solved by this library.

Seems that locks are not allowing even direct references.

repo: gund/ngx-element-boundary


text:
DynamicLabels for adapter supporting none-fixed labels

Reminder for.
https://github.com/gushphp/gush-jira-adapter/pull/4/files#r14504451

OK, so we should try to fix this in Gush application instead of marking this as not possible. For now we can keep this exception, but for future we properly want to get this fixed.

The first thing I can think of is adding a 'feature' interface like, DynamicLabelsAware or something like that, the issue commands can then detect if this interface is implemented and skip the validation of existence.

Not all adapters/issue-tracker work with fixed labels and we should provide support for this.
Allowing the end-user to just fill-in labels as he wants.

@sstok i think @jacobkiers is also in NL :baby: just was thinking if you have met him
basically let's close this ticket if there is no interest? I think @jucobkiers uses it with jira but i am not sure if there is a need for this.

Well if Jira needs it we can still support it :) its not to complicated but I need to find some time.
I'm currently working on the completion of RollerworksSearch and is its a bit hectic in my personal life :anger:.

@cordoval No, we haven't met yet.
Thank you for thinking of me in this ticket. We're not currently using labels, but we're going to introduce them somewhere in this quarter. I want to start using them to track custom properties that are just a bit too dynamic to deal with in custom fields or components.
@sstok I might be able to find some time for this also. Could you give me some pointers as to where I should start?

First we we need a marker interface to indicate an issue-tracker/repository supports Dynamic labeling.
Then LabelIssuesCommand needs to be updated that when an issue-tracker with dynamic labeling support is given the user can just type labels and is not required to choose from a list.

I will get working on this (I actually I'm already :) )

He thats cool, GitHub accepts dynamic labels :) it will automatically create a new label if it doesn't existent.

interesting

should we close this one now that it got merged?

@sstok ?

authors: cordoval jacobkiers sstok

repo: gushphp/gush


text:
Wallet balance 0

Describe the bug
On the wallet screen my Wallet Balance shows as 0 and my Cold Wallet Balance is correct.  I suspect it is because my balance is only 1599029 mojo but if you have less than say 0.001 XCH it should not show 0.  It shows further down on wallet details as
-Total Balance:         1.599029e-06 xch (1599029 mojo)
To Reproduce
THis is not confirmed but this is what i suspect
Steps to reproduce the behavior, e.g.:

have a balance of less than 0.001 XCH

Expected behavior
DIsplay the wallet balance instead of 0.  This can be important as you need to have some mojo to change pool contracts and it was a little confusing when it said 0 at the top of the screen and 1599029 mojo further down the screen.  It would also be nice to have an option to see the balance in 0.0000001599029 as well as 1.599029e-06 xch (1599029 mojo).  If you need to add fees to something it is the long form that is needed and it can be confusing to convert mojo to long form.
System setup:

OS: Ubuntu
Docker version number (output of docker info)
Machinaris branch: develop
Machinaris version number Machinaris 0.7.2

Additional context & screenshots

wanted to say this looks good in the dev branch now

This fix is now available in the Machinaris v0.7.2 release today. Thanks!

authors: guydavis seertenedos

repo: guydavis/machinaris


text:
Update comments about DB on ARM

The top level readme is out of date regarding availability of Oracle DB on ARM - this is now available from container-registry.oracle.com/database/enterprise:19.19.0.0

Thanks, Chris, but unfortunately Oracle Database Free is still not available on ARM, and as this repository only concerns itself with Oracle Database Free, pointing users to a different edition (with a different license requirement) would be misleading.
I do spot that I omitted one "Free" in:

Oracle Database Free on Apple M chips
Currently, there is no Oracle Database port for ARM chips, hence Oracle Database Free images cannot run on the new Apple M chips via Docker Desktop.

I will correct that.

Good point about free, but it would still be worth pointing people at the ARM image since it may fit their purposes better.

Added clarification for the Oracle Database Free missing port for ARM.

authors: cjbj gvenzl

repo: gvenzl/oci-oracle-free


text:
Container Failed to Start

i run container by this command
docker run -d -p 1521:1521 -e ORACLE_PASSWORD=root -v [MY_ACTUAL_PATH]:/u01/app/oracle/oradata gvenzl/oracle-xe:11

i got error on log like this

when i start container without linking volume it running well, im using zorin os 16 with SELinux disabled

Hi @BagasNS,
The oracle user inside the container needs to have write permissions on the external volume directory. Please verify the permissions of the directory under [MY_ACTUAL_PATH].

authors: BagasNS gvenzl

repo: gvenzl/oci-oracle-xe


text:
Error when deleting all selected files

main.lua:67: bad argument #1 to SetOnlyTrackSelected (MediaTrack expected)
This error does not happen when deleting all tracks via "d,i,g". Only with "V,i,g" + bkspc, or "V, G" from 1st track + bkspc.

Just tested this from the develop branch and it is a non-issue there.
Returning to master(no merge) caused errors for me though. Is switching branches for testing seamless or are other actions required?

Oh I just saw your commit that fixes this. Teehee!!!

Yep! I'll make a new release on master soon, there's just some other bugs right now.

authors: elgiovanno gwatcha

repo: gwatcha/reaper-keys


text:
请问如何在一个activity取消沉浸式效果

比如我有20个activity都继承baseactivity，我在baseactivity使用了沉浸效果，则20个activity都有这效果，现在我想这20个中的2个没有这效果，请问如何设置(除了18都去设置沉浸效果，2个不设置这种笨办法)。

@kinghom 现在没法取消，如果你这两个和别的沉浸式效果不一样，请重写base里的设置

authors: gyf-dev kinghom

repo: gyf-dev/ImmersionBar


text:
有关subhd获取字幕失败

Hi, 一直正常使用，十分感谢！最近出现个bug，下载subhd字幕失败，zimuzu的没问题，有空帮忙看一下是哪儿出问题了。
xxx:~ xxx$ getsub '/Users/xxx/Downloads/Along.with.the.Gods_The.Last.49.Days.2017.1080p.FHDRip.H264.AAC-NonDRM.mp4' --debug
├  Along.with.the.Gods_The.Last.49.Days.2017.1080p.FHDRip.H264.AAC-NonDRM.mp4
├  /Users/shaogongyu/Downloads
├
├  error:Expecting value: line 2 column 1 (char 1).
===============================FAILED LIST===============================

name: Along.with.the.Gods_The.Last.49.Days.2017.1080p.FHDRip.H264.AAC-NonDRM.mp4
path: /Users/xxx/Downloads
info: Expecting value: line 2 column 1 (char 1).
TRACE_BACK: Traceback (most recent call last):
File "/Users/xxx/anaconda3/lib/python3.6/site-packages/main.py", line 590, in start
sub_choice, link, info_dict)
File "/Users/xxx/anaconda3/lib/python3.6/site-packages/main.py", line 484, in process_archive
download_file(sub_choice, link)
File "/Users/xxx/anaconda3/lib/python3.6/site-packages/subhd.py", line 120, in download_file
if json.loads(content)['success'] is False:
File "/Users/xxx/anaconda3/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/Users/xxx/anaconda3/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/xxx/anaconda3/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

total: 1  success: 0  fail: 1

subhd最近下载要滑动验证了，之前是短时间下载多条才会出现滑动验证，如果一直都是这样，那就只能取消subhd下载器了。可能后面会重新使用zimuku的下载器。


text:
RuntimeError: Cannot return the results in a contigious 2D array. Probably ef or M is too small

Thank you for adding collection management features. It's really great! I created a couple of new collections and added PDF's and text files without a problem. However when I started chatting I got the error below. It looks like it's related to chromaDB:
AttributeError: module 'chromadb.errors' has no attribute 'NotEnoughElementsException'
I also loaded the h2ogpt on another browser from my LAN and didn't see the new collections. How do I make them persistent across sessions? Thank you!
`Traceback (most recent call last):
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\langchain\vectorstores\chroma.py", line 121, in __query_collection
    return self._collection.query(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\chromadb\api\models\Collection.py", line 230, in query
    return self._client._query(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\chromadb\api\local.py", line 439, in _query
    uuids, distances = self._db.get_nearest_neighbors(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\chromadb\db\clickhouse.py", line 591, in get_nearest_neighbors
    uuids, distances = index.get_nearest_neighbors(embeddings, n_results, ids)
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\chromadb\db\index\hnswlib.py", line 296, in get_nearest_neighbors
    database_labels, distances = self._index.knn_query(
RuntimeError: Cannot return the results in a contigious 2D array. Probably ef or M is too small

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\gradio\routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\gradio\blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\gradio\blocks.py", line 1093, in call_function
    prediction = await utils.async_iteration(iterator)
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\gradio\utils.py", line 341, in async_iteration
    return await iterator.__anext__()
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\gradio\utils.py", line 334, in __anext__
    return await anyio.to_thread.run_sync(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\gradio\utils.py", line 317, in run_sync_iterator_async
    return next(iterator)
  File "C:\Users\basem\Dev\h2ogpt\src\gradio_runner.py", line 1648, in bot
    for res in get_response(fun1, history):
  File "C:\Users\basem\Dev\h2ogpt\src\gradio_runner.py", line 1603, in get_response
    for output_fun in fun1():
  File "C:\Users\basem\Dev\h2ogpt\src\gen.py", line 1572, in evaluate
    for r in run_qa_db(query=instruction,
  File "C:\Users\basem\Dev\h2ogpt\src\gpt_langchain.py", line 1987, in _run_qa_db
    docs, chain, scores, use_context, have_any_docs = get_chain(**sim_kwargs)
  File "C:\Users\basem\Dev\h2ogpt\src\gpt_langchain.py", line 2254, in get_chain
    docs_with_score = db.similarity_search_with_score(query, k=k_db, **filter_kwargs)[
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\langchain\vectorstores\chroma.py", line 230, in similarity_search_with_score
    results = self.__query_collection(
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\langchain\utils.py", line 53, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\basem\miniconda3\envs\h2ogpt\lib\site-packages\langchain\vectorstores\chroma.py", line 128, in __query_collection
    except chromadb.errors.NotEnoughElementsException:
AttributeError: module 'chromadb.errors' has no attribute 'NotEnoughElementsException'`

Yes, the RuntimeError: Cannot return the results in a contigious 2D array. Probably ef or M is too small is annoying.
https://github.com/hwchase17/langchain/issues/3665

I also get this error with 200 Documents uploaded. Does anyone know what to do?

A possible work-around is to set k_db to much smaller number than 100-1000, i.e. maybe 10 in src/gpt_langchain.py.

I'm on the same boat, however, this behaviour only started with the last commit.

@enriquedecote which commit(s)?  Do you think something got worse?  I updated langchain a few days ago, but otherwise nothing should be causing this directly in h2oGPT AFAIK.
If anyone finds a reproducible example, would be good.  So far it seems to be not reproducible, and happens or not for exactly same steps/PDF.  The one time I hit it a few days ago I did exact same steps, and it didn't do it.

@pseudotensor The last pull that I know worked on my local docs was 0fec9b83. Today I only pulled and did not add/remove any doc nor made any code changes.

With k_db set to 10 it worked for me, but will try again tomorrow.

@ba2710 I added a work-around for that issue, but you have the wrong langchain version.

Great, Thank you!

authors: Cupiii ba2710 enriquedecote pseudotensor