Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wrochow authored Dec 18, 2024
2 parents 3b1b038 + 1ce5bd4 commit 95f0c95
Show file tree
Hide file tree
Showing 233 changed files with 21,619 additions and 518 deletions.
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
}
}
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gitignore
.env
README.md
docker-compose.yml
Dockerfile
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
watch_file shell.nix
use flake
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ body:
id: screens
attributes:
label: Relevant screenshots (optional)
description: Please upload any screenshots that may help us reproduce and/or understand the issue.
description: Please upload any screenshots that may help us reproduce and/or understand the issue.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ name: Go Build
on:
push:
branches: ["main"]
paths-ignore:
- 'patterns/**'
- '**/*.md'
pull_request:
branches: ["main"]
paths-ignore:
- 'patterns/**'
- '**/*.md'

jobs:
test:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/patterns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Patterns Artifact

on:
push:
paths:
- "patterns/**" # Trigger only on changes to files in the patterns folder

jobs:
zip-and-upload:
name: Zip and Upload Patterns Folder
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Verify Changes in Patterns Folder
run: |
git fetch origin
if git diff --quiet HEAD~1 -- patterns; then
echo "No changes detected in patterns folder."
exit 1
fi
- name: Zip the Patterns Folder
run: zip -r patterns.zip patterns/

- name: Upload Patterns Artifact
uses: actions/upload-artifact@v3
with:
name: patterns
path: patterns.zip
29 changes: 28 additions & 1 deletion .github/workflows/update-version-and-create-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main # Monitor the main branch
paths-ignore:
- 'patterns/**'
- '**/*.md'

permissions:
contents: write # Ensure the workflow has write permissions
Expand All @@ -18,6 +21,12 @@ jobs:
with:
fetch-depth: 0

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Setup Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Set up Git
run: |
git config user.name "github-actions[bot]"
Expand All @@ -38,7 +47,10 @@ jobs:
minor=$(echo "$latest_tag" | cut -d. -f2)
patch=$(echo "$latest_tag" | cut -d. -f3)
new_patch=$((patch + 1))
new_tag="v${major}.${minor}.${new_patch}"
new_version="${major}.${minor}.${new_patch}"
new_tag="v${new_version}"
echo "New version is: $new_version"
echo "new_version=$new_version" >> $GITHUB_ENV # Save the new version to environment file
echo "New tag is: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_ENV # Save the new tag to environment file
Expand All @@ -48,9 +60,24 @@ jobs:
echo "" >> version.go
echo "var version = \"${{ env.new_tag }}\"" >> version.go
- name: Update version.nix file
run: |
echo "\"${{ env.new_version }}\"" > pkgs/fabric/version.nix
- name: Format source codes
run: |
go fmt ./...
- name: Update gomod2nix.toml file
run: |
nix run .#gomod2nix
- name: Commit changes
run: |
git add version.go
git add pkgs/fabric/version.nix
git add gomod2nix.toml
git add .
if ! git diff --staged --quiet; then
git commit -m "Update version to ${{ env.new_tag }} and commit $commit_hash"
else
Expand Down
174 changes: 173 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Nix
.direnv
result

# macOS local stores
.DS_Store

Expand All @@ -18,7 +22,7 @@ dist/
downloads/
eggs/
.eggs/
lib/

lib64/
parts/
sdist/
Expand Down Expand Up @@ -162,6 +166,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

patterns/dialog_with_socrates/Apology by Plato.txt
patterns/dialog_with_socrates/Phaedrus by Plato.txt
patterns/dialog_with_socrates/Symposium by Plato.txt
Expand All @@ -170,3 +175,170 @@ patterns/dialog_with_socrates/The Memorabilia by Xenophon.txt
patterns/dialog_with_socrates/The Memorable Thoughts of Socrates by Xenophon.txt
patterns/dialog_with_socrates/The Republic by Plato.txt
patterns/dialog_with_socrates/The Symposium by Xenophon.txt

web/node_modules

# Output
web/.output
web/.vercel
web/.svelte-kit
web/build

# OS
web/.DS_Store
web/Thumbs.db

# Env
web/.env
web/.env.*
web/!.env.example
web/!.env.test

# Vite
web/vite.config.js.timestamp-*
web/vite.config.ts.timestamp-*
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
web/logs
web/*.log
web/npm-debug.log*
web/yarn-debug.log*
web/yarn-error.log*
web/lerna-debug.log*
web/.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
web/report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
web/pids
web/*.pid
web/*.seed
web/*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
web/lib-cov

# Coverage directory used by tools like istanbul
web/coverage
web/*.lcov

# nyc test coverage
web/.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
web/.grunt

# Bower dependency directory (https://bower.io/)
web/bower_components

# node-waf configuration
web/.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
web/node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web/web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
web/.npm

# Optional eslint cache
web/.eslintcache

# Optional stylelint cache
web/.stylelintcache

# Microbundle cache
web/.rpt2_cache/
web/.rts2_cache_cjs/
web/.rts2_cache_es/
web/.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
web/.env
web/.env.development.local
web/.env.test.local
web/.env.production.local
web/.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
web/.next
web/out

# Nuxt.js build / generate output
web/.nuxt
web/dist

# Gatsby files
web/.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
web/.vuepress/dist

# vuepress v2.x temp and cache directory
web/.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
web/.vscode-test

# yarn v2
web/.yarn/cache
web/.yarn/unplugged
web/.yarn/build-state.yml
web/.yarn/install-state.gz
web/.pnp.*

### Node Patch ###
# Serverless Webpack directories
web/.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
web/.svelte-kit

# End of https://www.toptal.com/developers/gitignore/api/node

41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Use official golang image as builder
FROM golang:1.23.3-alpine AS builder

# Set working directory
WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download dependencies
RUN go mod download

# Copy source code
COPY . .

# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o fabric

# Use scratch as final base image
FROM alpine:latest

# Copy the binary from builder
COPY --from=builder /app/fabric /fabric

# Copy patterns directory
COPY patterns /patterns

# Ensure clean config directory and copy ENV file
RUN rm -rf /root/.config/fabric && \
mkdir -p /root/.config/fabric
COPY ENV /root/.config/fabric/.env

# Add debug commands
RUN ls -la /root/.config/fabric/

# Expose port 8080
EXPOSE 8080

# Run the binary with debug output
ENTRYPOINT ["/fabric"]
CMD ["--serve"]
9 changes: 9 additions & 0 deletions ENV
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEFAULT_VENDOR=OpenRouter
DEFAULT_MODEL=openai/gpt-3.5-turbo-0125
DEFAULT_MODEL_CONTEXT_LENGTH=128K
PATTERNS_LOADER_GIT_REPO_URL=https://github.com/danielmiessler/fabric.git
PATTERNS_LOADER_GIT_REPO_PATTERNS_FOLDER=patterns
OPENROUTER_API_KEY=sk-or-v1-
OPENROUTER_API_BASE_URL=https://openrouter.ai/api/v1
YOUTUBE_API_KEY=AIzaS
JINA_AI_API_KEY=jina_57
Loading

0 comments on commit 95f0c95

Please sign in to comment.