Skip to content

Commit

Permalink
Merge pull request #41 from pixlie/feature/onboard-user-continued
Browse files Browse the repository at this point in the history
Pending changes for user onboard
  • Loading branch information
brainless authored Jan 7, 2025
2 parents 43d5dfc + d4f7e24 commit ae8c4a9
Show file tree
Hide file tree
Showing 16 changed files with 332 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
working-directory: "./admin"
run: pnpm run build

- name: Gzip the admin build directory
run: tar -czvf admin.tar.gz ./admin/dist
- name: Tar Gzip the admin build directory
run: tar -czvf admin.tar.gz -C admin/dist .

- name: Upload admin to release
uses: svenstaro/upload-release-action@v2
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release_gliner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
tags:
- "v*"

jobs:
release_admin:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Tar Gzip the gliner directory
run: tar -czvf gliner.tar.gz -C gliner .

- name: Upload gliner to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: gliner.tar.gz
tag: ${{ github.ref }}
2 changes: 1 addition & 1 deletion admin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "admin",
"private": true,
"version": "0.0.0",
"version": "0.1.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
1 change: 1 addition & 0 deletions admin/src/api_types/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type Settings = {
anthropicApiKey: string | null;
ollamaHosts: Array<string> | null;
ollamaPort: number | null;
gpuHosts: Array<string> | null;
mqttBrokerHost: string | null;
pathToStorageDir: string | null;
currentProject: string | null;
Expand Down
20 changes: 11 additions & 9 deletions admin/src/routes/settings/Setup.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component } from "solid-js";
import Heading from "../../widgets/typography/Heading";
import PythonEnv from "../../widgets/settings/Python";
import Gliner from "../../widgets/settings/Gliner";
import MQTTBroker from "../../widgets/settings/MQTTBroker";
import Ollama from "../../widgets/settings/Ollama";
// import Ollama from "../../widgets/settings/Ollama";
import Markdown from "../../widgets/typography/Markdown";
import StorageDir from "../../widgets/settings/StorageDir";
import { useWorkspace } from "../../stores/Workspace";
Expand All @@ -23,22 +23,24 @@ const Setup: Component = () => {

{!!workspace.isReady ? (
<>
<div class="mb-12" />
<div class="mb-16" />
<StorageDir />

{!!workspace.settings?.pathToStorageDir ? (
<>
<div class="mb-12" />
<PythonEnv />
<div class="mb-16" />
<Gliner />

<div class="mb-12" />
<div class="mb-16" />
<MQTTBroker />

<div class="mb-12" />
<Ollama />
{/* <div class="mb-16" />
<Ollama /> */}

<div class="mb-12" />
<div class="mb-16" />
<Anthropic />

<div class="mb-16" />
</>
) : (
<div class="my-12">
Expand Down
45 changes: 44 additions & 1 deletion admin/src/widgets/settings/Anthropic.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,57 @@
import { Component } from "solid-js";
import Heading from "../../widgets/typography/Heading";
import Markdown from "../typography/Markdown";
import TextInput from "../interactable/TextInput";
import { createStore } from "solid-js/store";
import { useWorkspace } from "../../stores/Workspace";
import { IFormFieldValue } from "../../utils/types";
import Button from "../interactable/Button";

const help = `If you want to use Anthropic, you will need to set up an account and get your API key.`;
const help = `Right now Pixlie AI only supports using Anthropic Claude. Please copy and paste your API key.
We are working on supporting Ollama so that you can use open source AI models.`;

interface IFormData {
anthropicApiKey: string;
}

const Anthropic: Component = () => {
const [workspace, { fetchSettings, saveSettings }] = useWorkspace();
const [formData, setFormData] = createStore<IFormData>({
anthropicApiKey: workspace.settings?.anthropicApiKey || "",
});

const handleChange = (name: string, value: IFormFieldValue) => {
if (!!value && typeof value === "string") {
setFormData((existing) => ({
...existing,
[name]: value,
}));
}
};

const handleSubmit = async () => {
await saveSettings({
...formData,
});
await fetchSettings();
};

return (
<>
<Heading size={3}>Anthropic</Heading>
<Markdown text={help} />

<div class="flex flex-col gap-y-2">
<TextInput
name="anthropic_api_key"
isEditable
onChange={handleChange}
value={formData.anthropicApiKey}
/>
<div>
<Button label="Set Anthropic API key" onClick={handleSubmit} />
</div>
</div>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Component, createResource } from "solid-js";
import Heading from "../../widgets/typography/Heading";
import Heading from "../typography/Heading";
import { useWorkspace } from "../../stores/Workspace";
import Markdown from "../typography/Markdown";
import Button from "../interactable/Button";
import { getPixlieAIAPIRoot } from "../../utils/api";
import { onMount } from "solid-js";

const help = `
Pixlie AI needs a Python environment to run some of the AI/ML tools.
Gliner is a Python library that we use to extract semantics from the data.
Pixlie AI needs a Python environment and Gliner installed on your computer.
`;

const PythonEnv: Component = () => {
const Gliner: Component = () => {
// We need a local Python virtual environment. We are our API if it can detect system Python and venv.
const [workspace, { fetchSettingsStatus }] = useWorkspace();
const [_settings, { refetch }] = createResource(async () => {
Expand All @@ -31,7 +32,7 @@ const PythonEnv: Component = () => {

return (
<>
<Heading size={3}>Python</Heading>
<Heading size={3}>Python and Gliner</Heading>
<Markdown text={help} />

<div class="mt-4">
Expand Down Expand Up @@ -86,7 +87,8 @@ const PythonEnv: Component = () => {
)}
{workspace.settingsStatus?.data.includes("GlinerNotSetup") && (
<>
We need GLiNER installed on this computer.{" "}
We can install Gliner on this computer, this will take a
while.{" "}
<Button label="Setup Gliner" onClick={handleSetupGliner} />
</>
)}
Expand All @@ -99,4 +101,4 @@ const PythonEnv: Component = () => {
);
};

export default PythonEnv;
export default Gliner;
4 changes: 2 additions & 2 deletions admin/src/widgets/settings/StorageDir.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ The storage directory is where we store the graph data, some AI/ML model data, e
Please copy and paste the path to the directory where you want to store the data.
`;

interface IStorageDirFormData {
interface IFormData {
pathToStorageDir: string;
}

const StorageDir: Component = () => {
const [workspace, { fetchSettings, saveSettings }] = useWorkspace();
const [formData, setFormData] = createStore<IStorageDirFormData>({
const [formData, setFormData] = createStore<IFormData>({
pathToStorageDir: workspace.settings?.pathToStorageDir || "",
});

Expand Down
36 changes: 31 additions & 5 deletions pixlieai_rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions pixlieai_rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[package]
name = "pixlieai"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
actix-cors = { version = "0.7.0", default-features = false }
actix-files = { version = "0.6.6", default-features = false }
actix-web = { version = "4.9.0", default-features = false }
bytes = { version = "1.9.0", default-features = false, features = ["std"] }
chrono = { version = "0.4.38", features = ["serde"] }
config = { version = "0.14.0", default-features = false, features = ["toml"] }
csv = "1.3.0"
dirs = { version = "5.0.1", default-features = false }
env_logger = { version = "0.11.5", default-features = false }
flate2 = { version = "1.0.35", default-features = false }
log = "0.4.22"
postcard = { version = "1.0.10", default-features = false, features = [
"alloc",
Expand All @@ -37,11 +39,14 @@ spider = { version = "2.10.6", default-features = false, features = [
"default",
] }
strum = { version = "0.26.3", features = ["derive"] }
tar = { version = "0.4.43", default-features = false }
test-log = { version = "0.2.16", default-features = false, features = ["log"] }
thiserror = { version = "1.0.64", default-features = false }
tokio = { version = "1.41.0", default-features = false }
toml = { version = "0.8.19", default-features = false }
ts-rs = { version = "10.1.0", default-features = false, features = ["serde-compat"] }
ts-rs = { version = "10.1.0", default-features = false, features = [
"serde-compat",
] }
url = { version = "2.5.3", default-features = false }

[[bin]]
Expand Down
19 changes: 0 additions & 19 deletions pixlieai_rs/src/admin/mod.rs

This file was deleted.

Loading

0 comments on commit ae8c4a9

Please sign in to comment.