mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-09 22:38:10 -05:00
Compare commits
82 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a56b7f2edc | ||
|
|
16355210e4 | ||
|
|
c8da276926 | ||
|
|
f966c0a516 | ||
|
|
9d433b71d2 | ||
|
|
0744be4710 | ||
|
|
5e96af8afb | ||
|
|
e2c28c8f19 | ||
|
|
9eb85725da | ||
|
|
f39a4f47c9 | ||
|
|
13b608e227 | ||
|
|
7570e7930b | ||
|
|
fe0a173166 | ||
|
|
a916137db3 | ||
|
|
333c8cd363 | ||
|
|
294a4635de | ||
|
|
a70431eaa5 | ||
|
|
ac57c3d2b0 | ||
|
|
5e4e4f4bf1 | ||
|
|
96225d4aea | ||
|
|
adcdc0cf0b | ||
|
|
e3f9b12fde | ||
|
|
7fa4c0a030 | ||
|
|
8a3fa9337c | ||
|
|
26ac5f3bf9 | ||
|
|
b4226da967 | ||
|
|
b2d24aa5c7 | ||
|
|
9f79877524 | ||
|
|
829c182a9d | ||
|
|
8475051a7c | ||
|
|
9f3122ba35 | ||
|
|
f61db2cdce | ||
|
|
8a2d5f82f1 | ||
|
|
edaf1a0110 | ||
|
|
3a4468b970 | ||
|
|
645190be3a | ||
|
|
c06c94f8b8 | ||
|
|
d84bd6f989 | ||
|
|
7ab5e8956c | ||
|
|
99b8b6a972 | ||
|
|
833b09081e | ||
|
|
201d1fb791 | ||
|
|
6ecbd044e6 | ||
|
|
fdadeae1e7 | ||
|
|
57c3e36574 | ||
|
|
1b98a8899f | ||
|
|
a4484d4e01 | ||
|
|
005d43674f | ||
|
|
3a69437790 | ||
|
|
b057f52ca6 | ||
|
|
dccdfbac8c | ||
|
|
98038707f1 | ||
|
|
03b22a70f0 | ||
|
|
66025d516c | ||
|
|
32ef2b73c4 | ||
|
|
656ca7ee28 | ||
|
|
0025466e4e | ||
|
|
4c2b38ca53 | ||
|
|
9c7ce4a974 | ||
|
|
626c492c63 | ||
|
|
71fb3fea7e | ||
|
|
3bc1150da4 | ||
|
|
827e0aeca7 | ||
|
|
0a1e01c4ab | ||
|
|
6003bb2c86 | ||
|
|
bb896b1064 | ||
|
|
d149c62a37 | ||
|
|
3d25fbc04c | ||
|
|
4c822d2c59 | ||
|
|
f1ffd6ee29 | ||
|
|
deb59bdd21 | ||
|
|
2a1e8dcf12 | ||
|
|
b6fd81dd16 | ||
|
|
5b723c9e92 | ||
|
|
93f8978085 | ||
|
|
4d91bf837f | ||
|
|
cb29a0d606 | ||
|
|
b1eb7a82d9 | ||
|
|
bc8f5add00 | ||
|
|
c3f874f985 | ||
|
|
922df52d0c | ||
|
|
4badfecadb |
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github: [danielmiessler, ksylvan]
|
||||
buy_me_a_coffee: kayvansylvan
|
||||
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@@ -20,18 +20,22 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: ./go.mod
|
||||
|
||||
- name: Run tests
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Check for modernization opportunities
|
||||
run: |
|
||||
go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest ./...
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@v21
|
||||
|
||||
- name: Check Formatting
|
||||
run: nix flake check
|
||||
|
||||
4
.github/workflows/patterns.yaml
vendored
4
.github/workflows/patterns.yaml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
|
||||
- name: Upload Patterns Artifact
|
||||
if: steps.check-changes.outputs.changes == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: patterns
|
||||
path: patterns.zip
|
||||
|
||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -15,12 +15,12 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: ./go.mod
|
||||
|
||||
@@ -37,11 +37,11 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: ./go.mod
|
||||
- name: Run GoReleaser
|
||||
|
||||
@@ -24,17 +24,17 @@ concurrency:
|
||||
jobs:
|
||||
update-version:
|
||||
if: >
|
||||
${{ github.repository_owner == 'danielmiessler' }} &&
|
||||
github.repository_owner == 'danielmiessler' &&
|
||||
github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
uses: DeterminateSystems/nix-installer-action@v21
|
||||
|
||||
- name: Set up Git
|
||||
run: |
|
||||
|
||||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -7,7 +7,9 @@
|
||||
"Anki",
|
||||
"anthropics",
|
||||
"Aoede",
|
||||
"apikey",
|
||||
"aplicar",
|
||||
"Astley",
|
||||
"atotto",
|
||||
"Autonoe",
|
||||
"azureml",
|
||||
@@ -63,6 +65,7 @@
|
||||
"gjson",
|
||||
"GOARCH",
|
||||
"GODEBUG",
|
||||
"godoc",
|
||||
"godotenv",
|
||||
"GOEXPERIMENT",
|
||||
"gofmt",
|
||||
@@ -166,12 +169,14 @@
|
||||
"sess",
|
||||
"sgaunet",
|
||||
"shellquote",
|
||||
"skeletonlabs",
|
||||
"SSEHTTP",
|
||||
"storer",
|
||||
"Streamlit",
|
||||
"stretchr",
|
||||
"subchunk",
|
||||
"Sulafat",
|
||||
"swaggo",
|
||||
"synctest",
|
||||
"talkpanel",
|
||||
"Telos",
|
||||
@@ -187,6 +192,7 @@
|
||||
"updatepatterns",
|
||||
"useb",
|
||||
"USERPROFILE",
|
||||
"varnames",
|
||||
"videoid",
|
||||
"webp",
|
||||
"WEBVTT",
|
||||
|
||||
200
CHANGELOG.md
200
CHANGELOG.md
@@ -1,5 +1,205 @@
|
||||
# Changelog
|
||||
|
||||
## v1.4.358 (2025-12-23)
|
||||
|
||||
### PR [#1901](https://github.com/danielmiessler/Fabric/pull/1901) by [orbisai0security](https://github.com/orbisai0security): sexurity fix: Ollama update: CVE-2025-63389
|
||||
|
||||
- Fix: resolve critical vulnerability CVE-2025-63389 (update Ollama Go library)
|
||||
|
||||
## v1.4.357 (2025-12-22)
|
||||
|
||||
### PR [#1897](https://github.com/danielmiessler/Fabric/pull/1897) by [ksylvan](https://github.com/ksylvan): feat: add MiniMax provider support to OpenAI compatible plugin
|
||||
|
||||
- Add MiniMax provider support to OpenAI compatible plugin
|
||||
- Add MiniMax provider configuration to ProviderMap
|
||||
- Set MiniMax base URL to api.minimaxi.com/v1
|
||||
- Configure MiniMax with ImplementsResponses as false
|
||||
- Add test case for MiniMax provider validation
|
||||
|
||||
### Direct commits
|
||||
|
||||
- Docs: add v1.4.356 release note highlighting complete i18n support
|
||||
|
||||
- Add v1.4.356 entry to Recent Major Features list
|
||||
- Highlight full setup prompt i18n across 10 languages
|
||||
|
||||
- Note intelligent environment variable handling for consistency
|
||||
|
||||
## v1.4.356 (2025-12-22)
|
||||
|
||||
### PR [#1895](https://github.com/danielmiessler/Fabric/pull/1895) by [ksylvan](https://github.com/ksylvan): Localize setup process and add funding configuration
|
||||
|
||||
- Localize setup prompts and error messages across multiple languages
|
||||
- Implement helper for localized questions with static environment keys
|
||||
- Update environment variable builder to handle hyphenated plugin names
|
||||
- Replace hardcoded console output with localized i18n translation strings
|
||||
- Add GitHub and Buy Me a Coffee funding configuration
|
||||
|
||||
## v1.4.355 (2025-12-20)
|
||||
|
||||
### PR [#1890](https://github.com/danielmiessler/Fabric/pull/1890) by [ksylvan](https://github.com/ksylvan): Bundle yt-dlp with fabric in Nix flake, introduce slim variant
|
||||
|
||||
- Added yt-dlp bundling with fabric package and introduced fabric-slim variant
|
||||
- Renamed original fabric package to fabricSlim and created new fabric package as symlinkJoin of fabricSlim and yt-dlp
|
||||
- Added fabric-slim output for the slim variant and updated default package to point to bundled fabric
|
||||
- Enhanced fabric meta description to note yt-dlp inclusion and set mainProgram to fabric in bundled package
|
||||
- Added wrapper for fabric binary to include PATH in execution environment
|
||||
|
||||
## v1.4.354 (2025-12-19)
|
||||
|
||||
### PR [#1889](https://github.com/danielmiessler/Fabric/pull/1889) by [ksylvan](https://github.com/ksylvan): docs: Add a YouTube transcript endpoint to the Swagger UI
|
||||
|
||||
- Add `/youtube/transcript` POST endpoint to Swagger docs
|
||||
- Define `YouTubeRequest` schema with URL, language, timestamps fields
|
||||
- Define `YouTubeResponse` schema with transcript and metadata fields
|
||||
- Add API security requirement using ApiKeyAuth
|
||||
- Document 200, 400, and 500 response codes
|
||||
|
||||
## v1.4.353 (2025-12-19)
|
||||
|
||||
### PR [#1887](https://github.com/danielmiessler/Fabric/pull/1887) by [bvandevliet](https://github.com/bvandevliet): feat: correct video title and added description to yt transcript api response
|
||||
|
||||
- Feat: correct video title (instead of id) and added description to yt transcript api response
|
||||
- Updated API documentation.
|
||||
|
||||
## v1.4.352 (2025-12-18)
|
||||
|
||||
### PR [#1886](https://github.com/danielmiessler/Fabric/pull/1886) by [ksylvan](https://github.com/ksylvan): Enhanced Onboarding and Setup Experience
|
||||
|
||||
- User Experience: implement automated first-time setup and improved configuration validation
|
||||
- Add automated first-time setup for patterns and strategies
|
||||
- Implement configuration validation to warn about missing required components
|
||||
- Update setup menu to group plugins into required and optional
|
||||
- Provide helpful guidance when no patterns are found in listing
|
||||
|
||||
### Direct commits
|
||||
|
||||
- Chore: update README with new interactive Swagger available in v.1.4.350
|
||||
|
||||
## v1.4.351 (2025-12-18)
|
||||
|
||||
### PR [#1882](https://github.com/danielmiessler/Fabric/pull/1882) by [bvandevliet](https://github.com/bvandevliet): Added yt-dlp package to docker image
|
||||
|
||||
- Added yt-dlp package to docker image.
|
||||
|
||||
## v1.4.350 (2025-12-18)
|
||||
|
||||
### PR [#1880](https://github.com/danielmiessler/Fabric/pull/1880) by [ksylvan](https://github.com/ksylvan): docs: add REST API server section and new endpoint reference
|
||||
|
||||
- Add README table-of-contents link for REST API
|
||||
- Document REST API server startup and capabilities
|
||||
- Add endpoint overview for chat, patterns, contexts
|
||||
- Describe sessions management and model listing endpoints
|
||||
- Provide curl examples for key API workflows
|
||||
|
||||
### PR [#1884](https://github.com/danielmiessler/Fabric/pull/1884) by [ksylvan](https://github.com/ksylvan): Implement interactive Swagger API documentation and automated OpenAPI specification generation
|
||||
|
||||
- Add Swagger UI at `/swagger/index.html` endpoint
|
||||
- Generate OpenAPI spec files (JSON and YAML)
|
||||
- Document chat, patterns, and models endpoints
|
||||
- Update contributing guide with Swagger annotation instructions
|
||||
- Configure authentication bypass for Swagger documentation
|
||||
|
||||
## v1.4.349 (2025-12-16)
|
||||
|
||||
### PR [#1877](https://github.com/danielmiessler/Fabric/pull/1877) by [ksylvan](https://github.com/ksylvan): modernize: update GitHub Actions and modernize Go code
|
||||
|
||||
- Modernize GitHub Actions and Go code with latest stdlib features
|
||||
- Upgrade GitHub Actions to latest versions (v6, v21) and add modernization check step
|
||||
- Replace strings manipulation with `strings.CutPrefix` and `strings.CutSuffix`
|
||||
- Replace manual loops with `slices.Contains` for validation and use `strings.SplitSeq` for iterator-based splitting
|
||||
- Replace `fmt.Sprintf` with `fmt.Appendf` for efficiency and simplify padding calculation with `max` builtin
|
||||
|
||||
## v1.4.348 (2025-12-16)
|
||||
|
||||
### PR [#1876](https://github.com/danielmiessler/Fabric/pull/1876) by [ksylvan](https://github.com/ksylvan): modernize Go code with TypeFor and range loops
|
||||
|
||||
- Replace reflect.TypeOf with TypeFor generic syntax for improved type handling
|
||||
- Convert traditional for loops to range-based iterations for better code readability
|
||||
- Simplify reflection usage in CLI flag handling to reduce complexity
|
||||
- Update test loops to use range over integers for cleaner test code
|
||||
- Refactor string processing loops in template plugin to use modern Go patterns
|
||||
|
||||
## v1.4.347 (2025-12-16)
|
||||
|
||||
### PR [#1875](https://github.com/danielmiessler/Fabric/pull/1875) by [ksylvan](https://github.com/ksylvan): modernize: update benchmarks to use b.Loop and refactor map copying
|
||||
|
||||
- Updated benchmark loops to use cleaner `b.Loop()` syntax
|
||||
- Removed unnecessary `b.ResetTimer()` call in token benchmark
|
||||
- Used `maps.Copy` for merging variables in patterns handler
|
||||
|
||||
## v1.4.346 (2025-12-16)
|
||||
|
||||
### PR [#1874](https://github.com/danielmiessler/Fabric/pull/1874) by [ksylvan](https://github.com/ksylvan): refactor: replace interface{} with any across codebase
|
||||
|
||||
- Part 1 of dealing with #1873 as pointed out by @philoserf
|
||||
- Replace `interface{}` with `any` in slice type declarations throughout the codebase
|
||||
- Update map types from `map[string]interface{}` to `map[string]any` for modern Go standards
|
||||
- Change variadic function parameters to use `...any` instead of `...interface{}`
|
||||
- Modernize JSON unmarshaling variables to use `any` for consistency
|
||||
- Update struct fields and method signatures to prefer the `any` alias over legacy interface syntax
|
||||
|
||||
## v1.4.345 (2025-12-15)
|
||||
|
||||
### PR [#1870](https://github.com/danielmiessler/Fabric/pull/1870) by [ksylvan](https://github.com/ksylvan): Web UI: upgrade pdfjs and add SSR-safe dynamic PDF worker init
|
||||
|
||||
- Upgrade `pdfjs-dist` to v5 with new engine requirement
|
||||
- Dynamically import PDF.js to avoid SSR import-time crashes
|
||||
- Configure PDF worker via CDN using runtime PDF.js version
|
||||
- Update PDF conversion pipeline to use lazy initialization
|
||||
- Guard chat message localStorage persistence behind browser checks
|
||||
|
||||
## v1.4.344 (2025-12-14)
|
||||
|
||||
### PR [#1867](https://github.com/danielmiessler/Fabric/pull/1867) by [jaredmontoya](https://github.com/jaredmontoya): chore: update flake
|
||||
|
||||
- Chore: update flake
|
||||
- Merge branch 'main' into update-flake
|
||||
|
||||
## v1.4.343 (2025-12-14)
|
||||
|
||||
### PR [#1829](https://github.com/danielmiessler/Fabric/pull/1829) by [dependabo](https://github.com/apps/dependabot): chore(deps): bump js-yaml from 4.1.0 to 4.1.1 in /web in the npm_and_yarn group across 1 directory
|
||||
|
||||
- Updated js-yaml dependency from version 4.1.0 to 4.1.1 in the /web directory
|
||||
|
||||
## v1.4.342 (2025-12-13)
|
||||
|
||||
### PR [#1866](https://github.com/danielmiessler/Fabric/pull/1866) by [ksylvan](https://github.com/ksylvan): fix: write CLI and streaming errors to stderr
|
||||
|
||||
- Fix: write CLI and streaming errors to stderr
|
||||
- Route CLI execution errors to standard error output
|
||||
- Print Anthropic stream errors to stderr consistently
|
||||
- Add os import to support stderr error writes
|
||||
- Preserve help-output suppression and exit behavior
|
||||
|
||||
## v1.4.341 (2025-12-10)
|
||||
|
||||
### PR [#1860](https://github.com/danielmiessler/Fabric/pull/1860) by [ksylvan](https://github.com/ksylvan): fix: allow resetting required settings without validation errors
|
||||
|
||||
- Fix: allow resetting required settings without validation errors
|
||||
- Update `Ask` to detect reset command and bypass validation
|
||||
- Refactor `OnAnswer` to support new `isReset` parameter logic
|
||||
- Invoke `ConfigureCustom` in `Setup` to avoid redundant re-validation
|
||||
- Add unit tests ensuring required fields can be reset
|
||||
|
||||
## v1.4.340 (2025-12-08)
|
||||
|
||||
### PR [#1856](https://github.com/danielmiessler/Fabric/pull/1856) by [ksylvan](https://github.com/ksylvan): Add support for new ClaudeHaiku 4.5 models
|
||||
|
||||
- Add support for new ClaudeHaiku models in client
|
||||
- Add `ModelClaudeHaiku4_5` to supported models
|
||||
- Add `ModelClaudeHaiku4_5_20251001` to supported models
|
||||
|
||||
## v1.4.339 (2025-12-08)
|
||||
|
||||
### PR [#1855](https://github.com/danielmiessler/Fabric/pull/1855) by [ksylvan](https://github.com/ksylvan): feat: add image attachment support for Ollama vision models
|
||||
|
||||
- Add multi-modal image support to Ollama client
|
||||
- Implement convertMessage to handle multi-content chat messages
|
||||
- Add loadImageBytes to fetch images from URLs
|
||||
- Support base64 data URLs for inline images
|
||||
- Handle HTTP image URLs with context propagation
|
||||
|
||||
## v1.4.338 (2025-12-04)
|
||||
|
||||
### PR [#1852](https://github.com/danielmiessler/Fabric/pull/1852) by [ksylvan](https://github.com/ksylvan): Add Abacus vendor for ChatLLM models with static model list
|
||||
|
||||
25
README.md
25
README.md
@@ -38,6 +38,7 @@
|
||||
[Philosophy](#philosophy) •
|
||||
[Installation](#installation) •
|
||||
[Usage](#usage) •
|
||||
[REST API](#rest-api-server) •
|
||||
[Examples](#examples) •
|
||||
[Just Use the Patterns](#just-use-the-patterns) •
|
||||
[Custom Patterns](#custom-patterns) •
|
||||
@@ -73,6 +74,8 @@ Below are the **new features and capabilities** we've added (newest first):
|
||||
|
||||
### Recent Major Features
|
||||
|
||||
- [v1.4.356](https://github.com/danielmiessler/fabric/releases/tag/v1.4.356) (Dec 22, 2025) — **Complete Internationalization**: Full i18n support for setup prompts across all 10 languages with intelligent environment variable handling—making Fabric truly accessible worldwide while maintaining configuration consistency.
|
||||
- [v1.4.350](https://github.com/danielmiessler/fabric/releases/tag/v1.4.350) (Dec 18, 2025) — **Interactive API Documentation**: Adds Swagger/OpenAPI UI at `/swagger/index.html` with comprehensive REST API documentation, enhanced developer guides, and improved endpoint discoverability for easier integration.
|
||||
- [v1.4.338](https://github.com/danielmiessler/fabric/releases/tag/v1.4.338) (Dec 4, 2025) — Add Abacus vendor support for Chat-LLM
|
||||
models (see [RouteLLM APIs](https://abacus.ai/app/route-llm-apis)).
|
||||
- [v1.4.337](https://github.com/danielmiessler/fabric/releases/tag/v1.4.337) (Dec 4, 2025) — Add "Z AI" vendor support. See the [Z AI overview](https://docs.z.ai/guides/overview/overview) page for more details.
|
||||
@@ -170,6 +173,7 @@ Keep in mind that many of these were recorded when Fabric was Python-based, so r
|
||||
- [Usage](#usage)
|
||||
- [Debug Levels](#debug-levels)
|
||||
- [Extensions](#extensions)
|
||||
- [REST API Server](#rest-api-server)
|
||||
- [Our approach to prompting](#our-approach-to-prompting)
|
||||
- [Examples](#examples)
|
||||
- [Just use the Patterns](#just-use-the-patterns)
|
||||
@@ -299,7 +303,7 @@ docker run --rm -it -v $HOME/.fabric-config:/root/.config/fabric kayvan/fabric:l
|
||||
# Use Fabric with your patterns
|
||||
docker run --rm -it -v $HOME/.fabric-config:/root/.config/fabric kayvan/fabric:latest -p summarize
|
||||
|
||||
# Run the REST API server
|
||||
# Run the REST API server (see REST API Server section)
|
||||
docker run --rm -it -p 8080:8080 -v $HOME/.fabric-config:/root/.config/fabric kayvan/fabric:latest --serve
|
||||
```
|
||||
|
||||
@@ -721,6 +725,25 @@ Fabric supports extensions that can be called within patterns. See the [Extensio
|
||||
|
||||
**Important:** Extensions only work within pattern files, not via direct stdin. See the guide for details and examples.
|
||||
|
||||
## REST API Server
|
||||
|
||||
Fabric includes a built-in REST API server that exposes all core functionality over HTTP. Start the server with:
|
||||
|
||||
```bash
|
||||
fabric --serve
|
||||
```
|
||||
|
||||
The server provides endpoints for:
|
||||
|
||||
- Chat completions with streaming responses
|
||||
- Pattern management (create, read, update, delete)
|
||||
- Context and session management
|
||||
- Model and vendor listing
|
||||
- YouTube transcript extraction
|
||||
- Configuration management
|
||||
|
||||
For complete endpoint documentation, authentication setup, and usage examples, see [REST API Documentation](docs/rest-api.md).
|
||||
|
||||
## Our approach to prompting
|
||||
|
||||
Fabric _Patterns_ are different than most prompts you'll see.
|
||||
|
||||
@@ -109,11 +109,11 @@ func ScanDirectory(rootDir string, maxDepth int, instructions string, ignoreList
|
||||
}
|
||||
|
||||
// Create final data structure
|
||||
var data []interface{}
|
||||
var data []any
|
||||
data = append(data, rootItem)
|
||||
|
||||
// Add report
|
||||
reportItem := map[string]interface{}{
|
||||
reportItem := map[string]any{
|
||||
"type": "report",
|
||||
"directories": dirCount,
|
||||
"files": fileCount,
|
||||
@@ -121,7 +121,7 @@ func ScanDirectory(rootDir string, maxDepth int, instructions string, ignoreList
|
||||
data = append(data, reportItem)
|
||||
|
||||
// Add instructions
|
||||
instructionsItem := map[string]interface{}{
|
||||
instructionsItem := map[string]any{
|
||||
"type": "instructions",
|
||||
"name": "code_change_instructions",
|
||||
"details": instructions,
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
func main() {
|
||||
err := cli.Cli(version)
|
||||
if err != nil && !flags.WroteHelp(err) {
|
||||
fmt.Printf("%s\n", err)
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package main
|
||||
|
||||
var version = "v1.4.338"
|
||||
var version = "v1.4.358"
|
||||
|
||||
Binary file not shown.
@@ -574,8 +574,8 @@ func (g *Generator) extractChanges(pr *github.PR) []string {
|
||||
}
|
||||
|
||||
if len(changes) == 0 && pr.Body != "" {
|
||||
lines := strings.Split(pr.Body, "\n")
|
||||
for _, line := range lines {
|
||||
lines := strings.SplitSeq(pr.Body, "\n")
|
||||
for line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
if strings.HasPrefix(line, "- ") || strings.HasPrefix(line, "* ") {
|
||||
change := strings.TrimPrefix(strings.TrimPrefix(line, "- "), "* ")
|
||||
|
||||
@@ -159,7 +159,7 @@ func (g *Generator) CreateNewChangelogEntry(version string) error {
|
||||
for _, file := range files {
|
||||
// Extract PR number from filename (e.g., "1640.txt" -> 1640)
|
||||
filename := filepath.Base(file)
|
||||
if prNumStr := strings.TrimSuffix(filename, ".txt"); prNumStr != filename {
|
||||
if prNumStr, ok := strings.CutSuffix(filename, ".txt"); ok {
|
||||
if prNum, err := strconv.Atoi(prNumStr); err == nil {
|
||||
processedPRs[prNum] = true
|
||||
prNumbers = append(prNumbers, prNum)
|
||||
|
||||
@@ -333,7 +333,7 @@ func (c *Client) FetchAllMergedPRsGraphQL(since time.Time) ([]*PR, error) {
|
||||
|
||||
for {
|
||||
// Prepare variables
|
||||
variables := map[string]interface{}{
|
||||
variables := map[string]any{
|
||||
"owner": graphql.String(c.owner),
|
||||
"repo": graphql.String(c.repo),
|
||||
"after": (*graphql.String)(after),
|
||||
|
||||
@@ -51,6 +51,29 @@ docs: update installation instructions
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
### Pull Request Guidelines
|
||||
|
||||
**Keep pull requests focused and minimal.**
|
||||
|
||||
PRs that touch a large number of files (50+) without clear functional justification will likely be rejected without detailed review.
|
||||
|
||||
#### Why we enforce this
|
||||
|
||||
- **Reviewability**: Large PRs are effectively un-reviewable. Studies show reviewer effectiveness drops significantly after ~200-400 lines of code. A 93-file "cleanup" PR cannot receive meaningful review.
|
||||
- **Git history**: Sweeping changes pollute `git blame`, making it harder to trace when and why functional changes were made.
|
||||
- **Merge conflicts**: Large PRs increase the likelihood of conflicts with other contributors' work.
|
||||
- **Risk**: More changed lines means more opportunities for subtle bugs, even in "safe" refactors.
|
||||
|
||||
#### What to do instead
|
||||
|
||||
If you have a large change in mind, break it into logical, independently-mergeable slices. For example:
|
||||
|
||||
- ✅ "Replace `interface{}` with `any` across codebase" (single mechanical change, easy to verify)
|
||||
- ✅ "Migrate to `strings.CutPrefix` in `internal/cli`" (scoped to one package)
|
||||
- ❌ "Modernize codebase with multiple idiom updates" (too broad, impossible to review)
|
||||
|
||||
For sweeping refactors or style changes, **open an issue first** to discuss the approach with maintainers before investing time in the work.
|
||||
|
||||
### Changelog Generation (REQUIRED)
|
||||
|
||||
After opening your PR, generate a changelog entry:
|
||||
@@ -142,6 +165,79 @@ Example output here
|
||||
- Include usage examples
|
||||
- Keep documentation current
|
||||
|
||||
### REST API Documentation
|
||||
|
||||
When adding or modifying REST API endpoints, you must update the Swagger documentation:
|
||||
|
||||
**1. Add Swagger annotations to your handler:**
|
||||
|
||||
```go
|
||||
// HandlerName godoc
|
||||
// @Summary Short description of what this endpoint does
|
||||
// @Description Detailed description of the endpoint's functionality
|
||||
// @Tags category-name
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param name path string true "Parameter description"
|
||||
// @Param body body RequestType true "Request body description"
|
||||
// @Success 200 {object} ResponseType "Success description"
|
||||
// @Failure 400 {object} map[string]string "Bad request"
|
||||
// @Failure 500 {object} map[string]string "Server error"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /endpoint/path [get]
|
||||
func (h *Handler) HandlerName(c *gin.Context) {
|
||||
// Implementation
|
||||
}
|
||||
```
|
||||
|
||||
**2. Regenerate Swagger documentation:**
|
||||
|
||||
```bash
|
||||
# Install swag CLI if you haven't already
|
||||
go install github.com/swaggo/swag/cmd/swag@latest
|
||||
|
||||
# Generate updated documentation
|
||||
swag init -g internal/server/serve.go -o docs
|
||||
```
|
||||
|
||||
**3. Commit the generated files:**
|
||||
|
||||
The following files will be updated and should be committed:
|
||||
|
||||
- `docs/swagger.json`
|
||||
- `docs/swagger.yaml`
|
||||
- `docs/docs.go`
|
||||
|
||||
**4. Test your changes:**
|
||||
|
||||
Start the server and verify your endpoint appears in Swagger UI:
|
||||
|
||||
```bash
|
||||
go run ./cmd/fabric --serve
|
||||
# Open http://localhost:8080/swagger/index.html
|
||||
```
|
||||
|
||||
**Examples to follow:**
|
||||
|
||||
- Chat endpoint: `internal/server/chat.go:58-68`
|
||||
- Patterns endpoint: `internal/server/patterns.go:36-45`
|
||||
- Models endpoint: `internal/server/models.go:20-28`
|
||||
|
||||
**Common annotation tags:**
|
||||
|
||||
- `@Summary` - One-line description (required)
|
||||
- `@Description` - Detailed explanation
|
||||
- `@Tags` - Logical grouping (e.g., "patterns", "chat", "models")
|
||||
- `@Accept` - Input content type (e.g., "json")
|
||||
- `@Produce` - Output content type (e.g., "json", "text/event-stream")
|
||||
- `@Param` - Request parameters (path, query, body)
|
||||
- `@Success` - Successful response (include status code and type)
|
||||
- `@Failure` - Error responses
|
||||
- `@Security` - Authentication requirement (use "ApiKeyAuth" for API key)
|
||||
- `@Router` - Endpoint path and HTTP method
|
||||
|
||||
For complete Swagger annotation syntax, see the [swaggo documentation](https://github.com/swaggo/swag#declarative-comments-format)
|
||||
|
||||
## Getting Help
|
||||
|
||||
- Check existing issues first
|
||||
|
||||
536
docs/docs.go
Normal file
536
docs/docs.go
Normal file
@@ -0,0 +1,536 @@
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {
|
||||
"name": "Fabric Support",
|
||||
"url": "https://github.com/danielmiessler/fabric"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://opensource.org/licenses/MIT"
|
||||
},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/chat": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Stream AI responses using Server-Sent Events (SSE)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"text/event-stream"
|
||||
],
|
||||
"tags": [
|
||||
"chat"
|
||||
],
|
||||
"summary": "Stream chat completions",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Chat request with prompts and options",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.ChatRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Streaming response",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.StreamResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/models/names": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get a list of all available AI models grouped by vendor",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"models"
|
||||
],
|
||||
"summary": "List all available models",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns models (array) and vendors (map)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/patterns/{name}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Retrieve a pattern by name",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"patterns"
|
||||
],
|
||||
"summary": "Get a pattern",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Pattern name",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/fsdb.Pattern"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/patterns/{name}/apply": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Apply a pattern with variable substitution",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"patterns"
|
||||
],
|
||||
"summary": "Apply pattern with variables",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Pattern name",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Pattern application request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.PatternApplyRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/fsdb.Pattern"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/youtube/transcript": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Retrieves the transcript of a YouTube video along with video metadata (title and description)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"youtube"
|
||||
],
|
||||
"summary": "Get YouTube video transcript",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "YouTube transcript request with URL, language, and timestamp options",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.YouTubeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response with transcript and metadata",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.YouTubeResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request - invalid URL or playlist URL provided",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error - failed to retrieve transcript or metadata",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"domain.ThinkingLevel": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"off",
|
||||
"low",
|
||||
"medium",
|
||||
"high"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ThinkingOff",
|
||||
"ThinkingLow",
|
||||
"ThinkingMedium",
|
||||
"ThinkingHigh"
|
||||
]
|
||||
},
|
||||
"fsdb.Pattern": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"pattern": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.ChatRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"audioFormat": {
|
||||
"type": "string"
|
||||
},
|
||||
"audioOutput": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"frequencyPenalty": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"imageBackground": {
|
||||
"type": "string"
|
||||
},
|
||||
"imageCompression": {
|
||||
"type": "integer"
|
||||
},
|
||||
"imageFile": {
|
||||
"type": "string"
|
||||
},
|
||||
"imageQuality": {
|
||||
"type": "string"
|
||||
},
|
||||
"imageSize": {
|
||||
"type": "string"
|
||||
},
|
||||
"language": {
|
||||
"description": "Add Language field to bind from request",
|
||||
"type": "string"
|
||||
},
|
||||
"maxTokens": {
|
||||
"type": "integer"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"modelContextLength": {
|
||||
"type": "integer"
|
||||
},
|
||||
"notification": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"notificationCommand": {
|
||||
"type": "string"
|
||||
},
|
||||
"presencePenalty": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"prompts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/restapi.PromptRequest"
|
||||
}
|
||||
},
|
||||
"raw": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"search": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"searchLocation": {
|
||||
"type": "string"
|
||||
},
|
||||
"seed": {
|
||||
"type": "integer"
|
||||
},
|
||||
"suppressThink": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"temperature": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"thinkEndTag": {
|
||||
"type": "string"
|
||||
},
|
||||
"thinkStartTag": {
|
||||
"type": "string"
|
||||
},
|
||||
"thinking": {
|
||||
"$ref": "#/definitions/domain.ThinkingLevel"
|
||||
},
|
||||
"topP": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"voice": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.PatternApplyRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input": {
|
||||
"type": "string"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.PromptRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contextName": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"patternName": {
|
||||
"type": "string"
|
||||
},
|
||||
"strategyName": {
|
||||
"description": "Optional strategy name",
|
||||
"type": "string"
|
||||
},
|
||||
"userInput": {
|
||||
"type": "string"
|
||||
},
|
||||
"variables": {
|
||||
"description": "Pattern variables",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"vendor": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.StreamResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": {
|
||||
"description": "The actual content",
|
||||
"type": "string"
|
||||
},
|
||||
"format": {
|
||||
"description": "\"markdown\", \"mermaid\", \"plain\"",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"description": "\"content\", \"error\", \"complete\"",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.YouTubeRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"url"
|
||||
],
|
||||
"properties": {
|
||||
"language": {
|
||||
"description": "Language code for transcript (default: \"en\")",
|
||||
"type": "string",
|
||||
"example": "en"
|
||||
},
|
||||
"timestamps": {
|
||||
"description": "Include timestamps in the transcript (default: false)",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"url": {
|
||||
"description": "YouTube video URL (required)",
|
||||
"type": "string",
|
||||
"example": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.YouTubeResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"description": "Video description from YouTube metadata",
|
||||
"type": "string",
|
||||
"example": "This is the video description from YouTube..."
|
||||
},
|
||||
"title": {
|
||||
"description": "Video title from YouTube metadata",
|
||||
"type": "string",
|
||||
"example": "Example Video Title"
|
||||
},
|
||||
"transcript": {
|
||||
"description": "The video transcript text",
|
||||
"type": "string",
|
||||
"example": "This is the video transcript..."
|
||||
},
|
||||
"videoId": {
|
||||
"description": "YouTube video ID",
|
||||
"type": "string",
|
||||
"example": "dQw4w9WgXcQ"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"ApiKeyAuth": {
|
||||
"type": "apiKey",
|
||||
"name": "X-API-Key",
|
||||
"in": "header"
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0",
|
||||
Host: "localhost:8080",
|
||||
BasePath: "/",
|
||||
Schemes: []string{},
|
||||
Title: "Fabric REST API",
|
||||
Description: "REST API for Fabric AI augmentation framework. Provides endpoints for chat completions, pattern management, contexts, sessions, and more.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
491
docs/rest-api.md
Normal file
491
docs/rest-api.md
Normal file
@@ -0,0 +1,491 @@
|
||||
# Fabric REST API
|
||||
|
||||
Fabric's REST API provides HTTP access to all core functionality: chat completions, pattern management, contexts, sessions, and more.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Start the server:
|
||||
|
||||
```bash
|
||||
fabric --serve
|
||||
```
|
||||
|
||||
The server runs on `http://localhost:8080` by default.
|
||||
|
||||
Test it:
|
||||
|
||||
```bash
|
||||
curl http://localhost:8080/patterns/names
|
||||
```
|
||||
|
||||
## Interactive API Documentation
|
||||
|
||||
Fabric includes Swagger/OpenAPI documentation with an interactive UI:
|
||||
|
||||
- **Swagger UI**: [http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html)
|
||||
- **OpenAPI JSON**: [http://localhost:8080/swagger/doc.json](http://localhost:8080/swagger/doc.json)
|
||||
- **OpenAPI YAML**: [http://localhost:8080/swagger/swagger.yaml](http://localhost:8080/swagger/swagger.yaml)
|
||||
|
||||
The Swagger UI lets you:
|
||||
|
||||
- Browse all available endpoints
|
||||
- View request/response schemas
|
||||
- Test API calls directly in your browser
|
||||
- See authentication requirements
|
||||
|
||||
**Note:** Swagger documentation endpoints are publicly accessible even when API key authentication is enabled. Only the actual API endpoints require authentication
|
||||
|
||||
## Server Options
|
||||
|
||||
| Flag | Description | Default |
|
||||
| ------ | ------------- | --------- |
|
||||
| `--serve` | Start the REST API server | - |
|
||||
| `--address` | Server address and port | `:8080` |
|
||||
| `--api-key` | Enable API key authentication | (none) |
|
||||
|
||||
Example with custom configuration:
|
||||
|
||||
```bash
|
||||
fabric --serve --address :9090 --api-key my_secret_key
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
When you set an API key with `--api-key`, all requests must include:
|
||||
|
||||
```http
|
||||
X-API-Key: your-api-key-here
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl -H "X-API-Key: my_secret_key" http://localhost:8080/patterns/names
|
||||
```
|
||||
|
||||
Without an API key, the server accepts all requests and logs a warning.
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Chat Completions
|
||||
|
||||
Stream AI responses using Server-Sent Events (SSE).
|
||||
|
||||
**Endpoint:** `POST /chat`
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{
|
||||
"prompts": [
|
||||
{
|
||||
"userInput": "Explain quantum computing",
|
||||
"vendor": "openai",
|
||||
"model": "gpt-4o",
|
||||
"patternName": "explain",
|
||||
"contextName": "",
|
||||
"strategyName": "",
|
||||
"variables": {}
|
||||
}
|
||||
],
|
||||
"language": "en",
|
||||
"temperature": 0.7,
|
||||
"topP": 0.9,
|
||||
"frequencyPenalty": 0,
|
||||
"presencePenalty": 0,
|
||||
"thinking": 0
|
||||
}
|
||||
```
|
||||
|
||||
**Prompt Fields:**
|
||||
|
||||
| Field | Required | Default | Description |
|
||||
| ------- | ---------- | --------- | ------------- |
|
||||
| `userInput` | **Yes** | - | Your message or question |
|
||||
| `vendor` | **Yes** | - | AI provider: `openai`, `anthropic`, `gemini`, `ollama`, etc. |
|
||||
| `model` | **Yes** | - | Model name: `gpt-4o`, `claude-sonnet-4.5`, `gemini-2.0-flash-exp`, etc. |
|
||||
| `patternName` | No | `""` | Pattern to apply (from `~/.config/fabric/patterns/`) |
|
||||
| `contextName` | No | `""` | Context to prepend (from `~/.config/fabric/contexts/`) |
|
||||
| `strategyName` | No | `""` | Strategy to use (from `~/.config/fabric/strategies/`) |
|
||||
| `variables` | No | `{}` | Variable substitutions for patterns (e.g., `{"role": "expert"}`) |
|
||||
|
||||
**Chat Options:**
|
||||
|
||||
| Field | Required | Default | Description |
|
||||
| ------- | ---------- | --------- | ------------- |
|
||||
| `language` | No | `"en"` | Language code for responses |
|
||||
| `temperature` | No | `0.7` | Randomness (0.0-1.0) |
|
||||
| `topP` | No | `0.9` | Nucleus sampling (0.0-1.0) |
|
||||
| `frequencyPenalty` | No | `0.0` | Reduce repetition (-2.0 to 2.0) |
|
||||
| `presencePenalty` | No | `0.0` | Encourage new topics (-2.0 to 2.0) |
|
||||
| `thinking` | No | `0` | Reasoning level (0=off, or numeric for tokens) |
|
||||
|
||||
**Response:**
|
||||
|
||||
Server-Sent Events stream with `Content-Type: text/readystream`. Each line contains JSON:
|
||||
|
||||
```json
|
||||
{"type": "content", "format": "markdown", "content": "Quantum computing uses..."}
|
||||
{"type": "content", "format": "markdown", "content": " quantum mechanics..."}
|
||||
{"type": "complete", "format": "markdown", "content": ""}
|
||||
```
|
||||
|
||||
**Types:**
|
||||
|
||||
- `content` - Response chunk
|
||||
- `error` - Error message
|
||||
- `complete` - Stream finished
|
||||
|
||||
**Formats:**
|
||||
|
||||
- `markdown` - Standard text
|
||||
- `mermaid` - Mermaid diagram
|
||||
- `plain` - Plain text
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/chat \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"prompts": [{
|
||||
"userInput": "What is Fabric?",
|
||||
"vendor": "openai",
|
||||
"model": "gpt-4o",
|
||||
"patternName": "explain"
|
||||
}]
|
||||
}'
|
||||
```
|
||||
|
||||
### Patterns
|
||||
|
||||
Manage reusable AI prompts.
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
| -------- | ---------- | ------------- |
|
||||
| `GET` | `/patterns/names` | List all pattern names |
|
||||
| `GET` | `/patterns/:name` | Get pattern content |
|
||||
| `GET` | `/patterns/exists/:name` | Check if pattern exists |
|
||||
| `POST` | `/patterns/:name` | Create or update pattern |
|
||||
| `DELETE` | `/patterns/:name` | Delete pattern |
|
||||
| `PUT` | `/patterns/rename/:oldName/:newName` | Rename pattern |
|
||||
| `POST` | `/patterns/:name/apply` | Apply pattern with variables |
|
||||
|
||||
**Example - Get pattern:**
|
||||
|
||||
```bash
|
||||
curl http://localhost:8080/patterns/summarize
|
||||
```
|
||||
|
||||
**Example - Apply pattern with variables:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/patterns/translate/apply \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"input": "Hello world",
|
||||
"variables": {"lang_code": "es"}
|
||||
}'
|
||||
```
|
||||
|
||||
**Example - Create pattern:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/patterns/my_custom_pattern \
|
||||
-H "Content-Type: text/plain" \
|
||||
-d "You are an expert in explaining complex topics simply..."
|
||||
```
|
||||
|
||||
### Contexts
|
||||
|
||||
Manage context snippets that prepend to prompts.
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
| -------- | ---------- | ------------- |
|
||||
| `GET` | `/contexts/names` | List all context names |
|
||||
| `GET` | `/contexts/:name` | Get context content |
|
||||
| `GET` | `/contexts/exists/:name` | Check if context exists |
|
||||
| `POST` | `/contexts/:name` | Create or update context |
|
||||
| `DELETE` | `/contexts/:name` | Delete context |
|
||||
| `PUT` | `/contexts/rename/:oldName/:newName` | Rename context |
|
||||
|
||||
### Sessions
|
||||
|
||||
Manage chat conversation history.
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
| -------- | ---------- | ------------- |
|
||||
| `GET` | `/sessions/names` | List all session names |
|
||||
| `GET` | `/sessions/:name` | Get session messages (JSON array) |
|
||||
| `GET` | `/sessions/exists/:name` | Check if session exists |
|
||||
| `POST` | `/sessions/:name` | Save session messages |
|
||||
| `DELETE` | `/sessions/:name` | Delete session |
|
||||
| `PUT` | `/sessions/rename/:oldName/:newName` | Rename session |
|
||||
|
||||
### Models
|
||||
|
||||
List available AI models.
|
||||
|
||||
**Endpoint:** `GET /models/names`
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"models": ["gpt-4o", "gpt-4o-mini", "claude-sonnet-4.5", "gemini-2.0-flash-exp"],
|
||||
"vendors": {
|
||||
"openai": ["gpt-4o", "gpt-4o-mini"],
|
||||
"anthropic": ["claude-sonnet-4.5", "claude-opus-4.5"],
|
||||
"gemini": ["gemini-2.0-flash-exp", "gemini-2.0-flash-thinking-exp"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Strategies
|
||||
|
||||
List available prompt strategies (Chain of Thought, etc.).
|
||||
|
||||
**Endpoint:** `GET /strategies`
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "chain_of_thought",
|
||||
"description": "Think step by step",
|
||||
"prompt": "Let's think through this step by step..."
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### YouTube Transcripts
|
||||
|
||||
Extract transcripts from YouTube videos.
|
||||
|
||||
**Endpoint:** `POST /youtube/transcript`
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{
|
||||
"url": "https://youtube.com/watch?v=dQw4w9WgXcQ",
|
||||
"timestamps": false
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"videoId": "Video ID",
|
||||
"title": "Video Title",
|
||||
"description" : "Video description...",
|
||||
"transcript": "Full transcript text..."
|
||||
}
|
||||
```
|
||||
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/youtube/transcript \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"url": "https://youtube.com/watch?v=dQw4w9WgXcQ", "timestamps": true}'
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
Manage API keys and environment settings.
|
||||
|
||||
**Get configuration:**
|
||||
|
||||
`GET /config`
|
||||
|
||||
Returns API keys and URLs for all configured vendors.
|
||||
|
||||
**Update configuration:**
|
||||
|
||||
`POST /config/update`
|
||||
|
||||
```json
|
||||
{
|
||||
"OPENAI_API_KEY": "sk-...",
|
||||
"ANTHROPIC_API_KEY": "sk-ant-..."
|
||||
}
|
||||
```
|
||||
|
||||
Updates `~/.config/fabric/.env` with new values.
|
||||
|
||||
## Complete Workflow Examples
|
||||
|
||||
### Example: Summarize a YouTube Video
|
||||
|
||||
This example shows how to extract a YouTube transcript and summarize it using the `youtube_summary` pattern. This requires two API calls:
|
||||
|
||||
#### Step 1: Extract the transcript
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/youtube/transcript \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"url": "https://youtube.com/watch?v=dQw4w9WgXcQ",
|
||||
"timestamps": false
|
||||
}' > transcript.json
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"videoId": "dQw4w9WgXcQ",
|
||||
"title": "Rick Astley - Never Gonna Give You Up (Official Video)",
|
||||
"description": "The official video for “Never Gonna Give You Up” by Rick Astley...",
|
||||
"transcript": "We're no strangers to love. You know the rules and so do I..."
|
||||
}
|
||||
```
|
||||
|
||||
#### Step 2: Summarize the transcript
|
||||
|
||||
Extract the transcript text and send it to the chat endpoint with the `youtube_summary` pattern:
|
||||
|
||||
```bash
|
||||
# Extract transcript text from JSON
|
||||
TRANSCRIPT=$(cat transcript.json | jq -r '.transcript')
|
||||
|
||||
# Send to chat endpoint with pattern
|
||||
curl -X POST http://localhost:8080/chat \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"prompts\": [{
|
||||
\"userInput\": \"$TRANSCRIPT\",
|
||||
\"vendor\": \"openai\",
|
||||
\"model\": \"gpt-4o\",
|
||||
\"patternName\": \"youtube_summary\"
|
||||
}]
|
||||
}"
|
||||
```
|
||||
|
||||
#### Combined one-liner (using jq)
|
||||
|
||||
```bash
|
||||
curl -s -X POST http://localhost:8080/youtube/transcript \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"url": "https://youtube.com/watch?v=dQw4w9WgXcQ", "timestamps": false}' | \
|
||||
jq -r '.transcript' | \
|
||||
xargs -I {} curl -X POST http://localhost:8080/chat \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"prompts\":[{\"userInput\":\"{}\",\"vendor\":\"openai\",\"model\":\"gpt-4o\",\"patternName\":\"youtube_summary\"}]}"
|
||||
```
|
||||
|
||||
#### Alternative: Using a script
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
YOUTUBE_URL="https://youtube.com/watch?v=dQw4w9WgXcQ"
|
||||
API_BASE="http://localhost:8080"
|
||||
|
||||
# Step 1: Get transcript
|
||||
echo "Extracting transcript..."
|
||||
TRANSCRIPT=$(curl -s -X POST "$API_BASE/youtube/transcript" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"url\":\"$YOUTUBE_URL\",\"timestamps\":false}" | jq -r '.transcript')
|
||||
|
||||
# Step 2: Summarize with pattern
|
||||
echo "Generating summary..."
|
||||
curl -X POST "$API_BASE/chat" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"prompts\": [{
|
||||
\"userInput\": $(echo "$TRANSCRIPT" | jq -Rs .),
|
||||
\"vendor\": \"openai\",
|
||||
\"model\": \"gpt-4o\",
|
||||
\"patternName\": \"youtube_summary\"
|
||||
}]
|
||||
}"
|
||||
```
|
||||
|
||||
#### Comparison with CLI
|
||||
|
||||
The CLI combines these steps automatically:
|
||||
|
||||
```bash
|
||||
# CLI version (single command)
|
||||
fabric -y "https://youtube.com/watch?v=dQw4w9WgXcQ" --pattern youtube_summary
|
||||
```
|
||||
|
||||
The API provides more flexibility by separating transcript extraction and summarization, allowing you to:
|
||||
|
||||
- Extract the transcript once and process it multiple ways
|
||||
- Apply different patterns to the same transcript
|
||||
- Store the transcript for later use
|
||||
- Use different models or vendors for summarization
|
||||
|
||||
## Docker Usage
|
||||
|
||||
Run the server in Docker:
|
||||
|
||||
```bash
|
||||
# Setup (first time)
|
||||
mkdir -p $HOME/.fabric-config
|
||||
docker run --rm -it \
|
||||
-v $HOME/.fabric-config:/root/.config/fabric \
|
||||
kayvan/fabric:latest --setup
|
||||
|
||||
# Start server
|
||||
docker run --rm -it \
|
||||
-p 8080:8080 \
|
||||
-v $HOME/.fabric-config:/root/.config/fabric \
|
||||
kayvan/fabric:latest --serve
|
||||
|
||||
# With authentication
|
||||
docker run --rm -it \
|
||||
-p 8080:8080 \
|
||||
-v $HOME/.fabric-config:/root/.config/fabric \
|
||||
kayvan/fabric:latest --serve --api-key my_secret_key
|
||||
```
|
||||
|
||||
## Ollama Compatibility Mode
|
||||
|
||||
Fabric can emulate Ollama's API endpoints:
|
||||
|
||||
```bash
|
||||
fabric --serveOllama --address :11434
|
||||
```
|
||||
|
||||
This mode provides:
|
||||
|
||||
- `GET /api/tags` - Lists patterns as models
|
||||
- `GET /api/version` - Server version
|
||||
- `POST /api/chat` - Ollama-compatible chat endpoint
|
||||
|
||||
## Error Handling
|
||||
|
||||
All endpoints return standard HTTP status codes:
|
||||
|
||||
- `200 OK` - Success
|
||||
- `400 Bad Request` - Invalid input
|
||||
- `401 Unauthorized` - Missing or invalid API key
|
||||
- `404 Not Found` - Resource not found
|
||||
- `500 Internal Server Error` - Server error
|
||||
|
||||
Error responses include JSON with details:
|
||||
|
||||
```json
|
||||
{
|
||||
"error": "Pattern not found: nonexistent"
|
||||
}
|
||||
```
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
The server does not implement rate limiting. When deploying publicly, use a reverse proxy (nginx, Caddy) with rate limiting enabled.
|
||||
|
||||
## CORS
|
||||
|
||||
The server sets CORS headers for local development:
|
||||
|
||||
```http
|
||||
Access-Control-Allow-Origin: http://localhost:5173
|
||||
```
|
||||
|
||||
For production, configure CORS through a reverse proxy.
|
||||
512
docs/swagger.json
Normal file
512
docs/swagger.json
Normal file
@@ -0,0 +1,512 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "REST API for Fabric AI augmentation framework. Provides endpoints for chat completions, pattern management, contexts, sessions, and more.",
|
||||
"title": "Fabric REST API",
|
||||
"contact": {
|
||||
"name": "Fabric Support",
|
||||
"url": "https://github.com/danielmiessler/fabric"
|
||||
},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://opensource.org/licenses/MIT"
|
||||
},
|
||||
"version": "1.0"
|
||||
},
|
||||
"host": "localhost:8080",
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/chat": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Stream AI responses using Server-Sent Events (SSE)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"text/event-stream"
|
||||
],
|
||||
"tags": [
|
||||
"chat"
|
||||
],
|
||||
"summary": "Stream chat completions",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Chat request with prompts and options",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.ChatRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Streaming response",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.StreamResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/models/names": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get a list of all available AI models grouped by vendor",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"models"
|
||||
],
|
||||
"summary": "List all available models",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns models (array) and vendors (map)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/patterns/{name}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Retrieve a pattern by name",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"patterns"
|
||||
],
|
||||
"summary": "Get a pattern",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Pattern name",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/fsdb.Pattern"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/patterns/{name}/apply": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Apply a pattern with variable substitution",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"patterns"
|
||||
],
|
||||
"summary": "Apply pattern with variables",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Pattern name",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Pattern application request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.PatternApplyRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/fsdb.Pattern"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/youtube/transcript": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Retrieves the transcript of a YouTube video along with video metadata (title and description)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"youtube"
|
||||
],
|
||||
"summary": "Get YouTube video transcript",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "YouTube transcript request with URL, language, and timestamp options",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.YouTubeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response with transcript and metadata",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/restapi.YouTubeResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request - invalid URL or playlist URL provided",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error - failed to retrieve transcript or metadata",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"domain.ThinkingLevel": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"off",
|
||||
"low",
|
||||
"medium",
|
||||
"high"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ThinkingOff",
|
||||
"ThinkingLow",
|
||||
"ThinkingMedium",
|
||||
"ThinkingHigh"
|
||||
]
|
||||
},
|
||||
"fsdb.Pattern": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"pattern": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.ChatRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"audioFormat": {
|
||||
"type": "string"
|
||||
},
|
||||
"audioOutput": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"frequencyPenalty": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"imageBackground": {
|
||||
"type": "string"
|
||||
},
|
||||
"imageCompression": {
|
||||
"type": "integer"
|
||||
},
|
||||
"imageFile": {
|
||||
"type": "string"
|
||||
},
|
||||
"imageQuality": {
|
||||
"type": "string"
|
||||
},
|
||||
"imageSize": {
|
||||
"type": "string"
|
||||
},
|
||||
"language": {
|
||||
"description": "Add Language field to bind from request",
|
||||
"type": "string"
|
||||
},
|
||||
"maxTokens": {
|
||||
"type": "integer"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"modelContextLength": {
|
||||
"type": "integer"
|
||||
},
|
||||
"notification": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"notificationCommand": {
|
||||
"type": "string"
|
||||
},
|
||||
"presencePenalty": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"prompts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/restapi.PromptRequest"
|
||||
}
|
||||
},
|
||||
"raw": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"search": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"searchLocation": {
|
||||
"type": "string"
|
||||
},
|
||||
"seed": {
|
||||
"type": "integer"
|
||||
},
|
||||
"suppressThink": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"temperature": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"thinkEndTag": {
|
||||
"type": "string"
|
||||
},
|
||||
"thinkStartTag": {
|
||||
"type": "string"
|
||||
},
|
||||
"thinking": {
|
||||
"$ref": "#/definitions/domain.ThinkingLevel"
|
||||
},
|
||||
"topP": {
|
||||
"type": "number",
|
||||
"format": "float64"
|
||||
},
|
||||
"voice": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.PatternApplyRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input": {
|
||||
"type": "string"
|
||||
},
|
||||
"variables": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.PromptRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contextName": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"patternName": {
|
||||
"type": "string"
|
||||
},
|
||||
"strategyName": {
|
||||
"description": "Optional strategy name",
|
||||
"type": "string"
|
||||
},
|
||||
"userInput": {
|
||||
"type": "string"
|
||||
},
|
||||
"variables": {
|
||||
"description": "Pattern variables",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"vendor": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.StreamResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": {
|
||||
"description": "The actual content",
|
||||
"type": "string"
|
||||
},
|
||||
"format": {
|
||||
"description": "\"markdown\", \"mermaid\", \"plain\"",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"description": "\"content\", \"error\", \"complete\"",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.YouTubeRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"url"
|
||||
],
|
||||
"properties": {
|
||||
"language": {
|
||||
"description": "Language code for transcript (default: \"en\")",
|
||||
"type": "string",
|
||||
"example": "en"
|
||||
},
|
||||
"timestamps": {
|
||||
"description": "Include timestamps in the transcript (default: false)",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"url": {
|
||||
"description": "YouTube video URL (required)",
|
||||
"type": "string",
|
||||
"example": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
||||
}
|
||||
}
|
||||
},
|
||||
"restapi.YouTubeResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"description": "Video description from YouTube metadata",
|
||||
"type": "string",
|
||||
"example": "This is the video description from YouTube..."
|
||||
},
|
||||
"title": {
|
||||
"description": "Video title from YouTube metadata",
|
||||
"type": "string",
|
||||
"example": "Example Video Title"
|
||||
},
|
||||
"transcript": {
|
||||
"description": "The video transcript text",
|
||||
"type": "string",
|
||||
"example": "This is the video transcript..."
|
||||
},
|
||||
"videoId": {
|
||||
"description": "YouTube video ID",
|
||||
"type": "string",
|
||||
"example": "dQw4w9WgXcQ"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"ApiKeyAuth": {
|
||||
"type": "apiKey",
|
||||
"name": "X-API-Key",
|
||||
"in": "header"
|
||||
}
|
||||
}
|
||||
}
|
||||
344
docs/swagger.yaml
Normal file
344
docs/swagger.yaml
Normal file
@@ -0,0 +1,344 @@
|
||||
basePath: /
|
||||
definitions:
|
||||
domain.ThinkingLevel:
|
||||
enum:
|
||||
- "off"
|
||||
- low
|
||||
- medium
|
||||
- high
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- ThinkingOff
|
||||
- ThinkingLow
|
||||
- ThinkingMedium
|
||||
- ThinkingHigh
|
||||
fsdb.Pattern:
|
||||
properties:
|
||||
description:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
pattern:
|
||||
type: string
|
||||
type: object
|
||||
restapi.ChatRequest:
|
||||
properties:
|
||||
audioFormat:
|
||||
type: string
|
||||
audioOutput:
|
||||
type: boolean
|
||||
frequencyPenalty:
|
||||
format: float64
|
||||
type: number
|
||||
imageBackground:
|
||||
type: string
|
||||
imageCompression:
|
||||
type: integer
|
||||
imageFile:
|
||||
type: string
|
||||
imageQuality:
|
||||
type: string
|
||||
imageSize:
|
||||
type: string
|
||||
language:
|
||||
description: Add Language field to bind from request
|
||||
type: string
|
||||
maxTokens:
|
||||
type: integer
|
||||
model:
|
||||
type: string
|
||||
modelContextLength:
|
||||
type: integer
|
||||
notification:
|
||||
type: boolean
|
||||
notificationCommand:
|
||||
type: string
|
||||
presencePenalty:
|
||||
format: float64
|
||||
type: number
|
||||
prompts:
|
||||
items:
|
||||
$ref: '#/definitions/restapi.PromptRequest'
|
||||
type: array
|
||||
raw:
|
||||
type: boolean
|
||||
search:
|
||||
type: boolean
|
||||
searchLocation:
|
||||
type: string
|
||||
seed:
|
||||
type: integer
|
||||
suppressThink:
|
||||
type: boolean
|
||||
temperature:
|
||||
format: float64
|
||||
type: number
|
||||
thinkEndTag:
|
||||
type: string
|
||||
thinkStartTag:
|
||||
type: string
|
||||
thinking:
|
||||
$ref: '#/definitions/domain.ThinkingLevel'
|
||||
topP:
|
||||
format: float64
|
||||
type: number
|
||||
voice:
|
||||
type: string
|
||||
type: object
|
||||
restapi.PatternApplyRequest:
|
||||
properties:
|
||||
input:
|
||||
type: string
|
||||
variables:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
restapi.PromptRequest:
|
||||
properties:
|
||||
contextName:
|
||||
type: string
|
||||
model:
|
||||
type: string
|
||||
patternName:
|
||||
type: string
|
||||
strategyName:
|
||||
description: Optional strategy name
|
||||
type: string
|
||||
userInput:
|
||||
type: string
|
||||
variables:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Pattern variables
|
||||
type: object
|
||||
vendor:
|
||||
type: string
|
||||
type: object
|
||||
restapi.StreamResponse:
|
||||
properties:
|
||||
content:
|
||||
description: The actual content
|
||||
type: string
|
||||
format:
|
||||
description: '"markdown", "mermaid", "plain"'
|
||||
type: string
|
||||
type:
|
||||
description: '"content", "error", "complete"'
|
||||
type: string
|
||||
type: object
|
||||
restapi.YouTubeRequest:
|
||||
properties:
|
||||
language:
|
||||
description: 'Language code for transcript (default: "en")'
|
||||
example: en
|
||||
type: string
|
||||
timestamps:
|
||||
description: 'Include timestamps in the transcript (default: false)'
|
||||
example: false
|
||||
type: boolean
|
||||
url:
|
||||
description: YouTube video URL (required)
|
||||
example: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
||||
type: string
|
||||
required:
|
||||
- url
|
||||
type: object
|
||||
restapi.YouTubeResponse:
|
||||
properties:
|
||||
description:
|
||||
description: Video description from YouTube metadata
|
||||
example: This is the video description from YouTube...
|
||||
type: string
|
||||
title:
|
||||
description: Video title from YouTube metadata
|
||||
example: Example Video Title
|
||||
type: string
|
||||
transcript:
|
||||
description: The video transcript text
|
||||
example: This is the video transcript...
|
||||
type: string
|
||||
videoId:
|
||||
description: YouTube video ID
|
||||
example: dQw4w9WgXcQ
|
||||
type: string
|
||||
type: object
|
||||
host: localhost:8080
|
||||
info:
|
||||
contact:
|
||||
name: Fabric Support
|
||||
url: https://github.com/danielmiessler/fabric
|
||||
description: REST API for Fabric AI augmentation framework. Provides endpoints for
|
||||
chat completions, pattern management, contexts, sessions, and more.
|
||||
license:
|
||||
name: MIT
|
||||
url: https://opensource.org/licenses/MIT
|
||||
title: Fabric REST API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/chat:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Stream AI responses using Server-Sent Events (SSE)
|
||||
parameters:
|
||||
- description: Chat request with prompts and options
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/restapi.ChatRequest'
|
||||
produces:
|
||||
- text/event-stream
|
||||
responses:
|
||||
"200":
|
||||
description: Streaming response
|
||||
schema:
|
||||
$ref: '#/definitions/restapi.StreamResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Stream chat completions
|
||||
tags:
|
||||
- chat
|
||||
/models/names:
|
||||
get:
|
||||
description: Get a list of all available AI models grouped by vendor
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Returns models (array) and vendors (map)
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: List all available models
|
||||
tags:
|
||||
- models
|
||||
/patterns/{name}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve a pattern by name
|
||||
parameters:
|
||||
- description: Pattern name
|
||||
in: path
|
||||
name: name
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/fsdb.Pattern'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get a pattern
|
||||
tags:
|
||||
- patterns
|
||||
/patterns/{name}/apply:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Apply a pattern with variable substitution
|
||||
parameters:
|
||||
- description: Pattern name
|
||||
in: path
|
||||
name: name
|
||||
required: true
|
||||
type: string
|
||||
- description: Pattern application request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/restapi.PatternApplyRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/fsdb.Pattern'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Apply pattern with variables
|
||||
tags:
|
||||
- patterns
|
||||
/youtube/transcript:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieves the transcript of a YouTube video along with video metadata
|
||||
(title and description)
|
||||
parameters:
|
||||
- description: YouTube transcript request with URL, language, and timestamp
|
||||
options
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/restapi.YouTubeRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Successful response with transcript and metadata
|
||||
schema:
|
||||
$ref: '#/definitions/restapi.YouTubeResponse'
|
||||
"400":
|
||||
description: Bad request - invalid URL or playlist URL provided
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error - failed to retrieve transcript or metadata
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get YouTube video transcript
|
||||
tags:
|
||||
- youtube
|
||||
securityDefinitions:
|
||||
ApiKeyAuth:
|
||||
in: header
|
||||
name: X-API-Key
|
||||
type: apiKey
|
||||
swagger: "2.0"
|
||||
24
flake.lock
generated
24
flake.lock
generated
@@ -5,11 +5,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -26,11 +26,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1742209644,
|
||||
"narHash": "sha256-jMy1XqXqD0/tJprEbUmKilTkvbDY/C0ZGSsJJH4TNCE=",
|
||||
"lastModified": 1763982521,
|
||||
"narHash": "sha256-ur4QIAHwgFc0vXiaxn5No/FuZicxBr2p0gmT54xZkUQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "gomod2nix",
|
||||
"rev": "8f3534eb8f6c5c3fce799376dc3b91bae6b11884",
|
||||
"rev": "02e63a239d6eabd595db56852535992c898eba72",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -41,11 +41,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1745234285,
|
||||
"narHash": "sha256-GfpyMzxwkfgRVN0cTGQSkTC0OHhEkv3Jf6Tcjm//qZ0=",
|
||||
"lastModified": 1765472234,
|
||||
"narHash": "sha256-9VvC20PJPsleGMewwcWYKGzDIyjckEz8uWmT0vCDYK0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c11863f1e964833214b767f4a369c6e6a7aba141",
|
||||
"rev": "2fbfb1d73d239d2402a8fe03963e37aab15abe8b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -100,11 +100,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1744961264,
|
||||
"narHash": "sha256-aRmUh0AMwcbdjJHnytg1e5h5ECcaWtIFQa6d9gI85AI=",
|
||||
"lastModified": 1762938485,
|
||||
"narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "8d404a69efe76146368885110f29a2ca3700bee6",
|
||||
"rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
27
flake.nix
27
flake.nix
@@ -73,14 +73,33 @@
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
goVersion = getGoVersion system;
|
||||
in
|
||||
{
|
||||
default = self.packages.${system}.fabric;
|
||||
fabric = pkgs.callPackage ./nix/pkgs/fabric {
|
||||
fabricSlim = pkgs.callPackage ./nix/pkgs/fabric {
|
||||
go = goVersion;
|
||||
inherit self;
|
||||
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
|
||||
};
|
||||
fabric = pkgs.symlinkJoin {
|
||||
name = "fabric-${fabricSlim.version}";
|
||||
inherit (fabricSlim) version;
|
||||
paths = [
|
||||
fabricSlim
|
||||
pkgs.yt-dlp
|
||||
];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/fabric \
|
||||
--prefix PATH : $out/bin
|
||||
'';
|
||||
meta = fabricSlim.meta // {
|
||||
description = "${fabricSlim.meta.description} (includes yt-dlp)";
|
||||
mainProgram = "fabric";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
default = fabric;
|
||||
inherit fabric;
|
||||
"fabric-slim" = fabricSlim;
|
||||
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
|
||||
}
|
||||
);
|
||||
|
||||
54
go.mod
54
go.mod
@@ -9,8 +9,8 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/config v1.31.8
|
||||
github.com/aws/aws-sdk-go-v2/service/bedrock v1.46.1
|
||||
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.40.1
|
||||
github.com/gabriel-vasile/mimetype v1.4.9
|
||||
github.com/gin-gonic/gin v1.10.1
|
||||
github.com/gabriel-vasile/mimetype v1.4.12
|
||||
github.com/gin-gonic/gin v1.11.0
|
||||
github.com/go-git/go-git/v5 v5.16.2
|
||||
github.com/go-shiori/go-readability v0.0.0-20250217085726-9f5bf5ca7612
|
||||
github.com/google/go-github/v66 v66.0.0
|
||||
@@ -20,7 +20,7 @@ require (
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/mattn/go-sqlite3 v1.14.28
|
||||
github.com/nicksnyder/go-i18n/v2 v2.6.0
|
||||
github.com/ollama/ollama v0.11.7
|
||||
github.com/ollama/ollama v0.12.4
|
||||
github.com/openai/openai-go v1.12.0
|
||||
github.com/otiai10/copy v1.14.1
|
||||
github.com/pkg/errors v0.9.1
|
||||
@@ -28,8 +28,11 @@ require (
|
||||
github.com/sgaunet/perplexity-go/v2 v2.8.0
|
||||
github.com/spf13/cobra v1.9.1
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/swaggo/files v1.0.1
|
||||
github.com/swaggo/gin-swagger v1.6.1
|
||||
github.com/swaggo/swag v1.16.6
|
||||
golang.org/x/oauth2 v0.30.0
|
||||
golang.org/x/text v0.31.0
|
||||
golang.org/x/text v0.32.0
|
||||
google.golang.org/api v0.247.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
@@ -37,8 +40,27 @@ require (
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
github.com/bytedance/gopkg v0.1.3 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.22.4 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.4 // indirect
|
||||
github.com/go-openapi/spec v0.22.2 // indirect
|
||||
github.com/go-openapi/swag/conv v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/loading v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
|
||||
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
|
||||
github.com/goccy/go-yaml v1.19.1 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/quic-go/qpack v0.6.0 // indirect
|
||||
github.com/quic-go/quic-go v0.57.1 // indirect
|
||||
go.uber.org/mock v0.6.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/mod v0.31.0 // indirect
|
||||
golang.org/x/tools v0.40.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -63,10 +85,10 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.38.4 // indirect
|
||||
github.com/aws/smithy-go v1.23.0 // indirect
|
||||
github.com/bytedance/sonic v1.13.3 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||
github.com/bytedance/sonic v1.14.2 // indirect
|
||||
github.com/bytedance/sonic/loader v0.4.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||
github.com/cloudwego/base64x v0.1.6 // indirect
|
||||
github.com/coder/websocket v1.8.13 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
@@ -79,7 +101,7 @@ require (
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.29.0 // indirect
|
||||
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
|
||||
@@ -93,7 +115,7 @@ require (
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
@@ -110,23 +132,23 @@ require (
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tidwall/sjson v1.2.5 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.14 // indirect
|
||||
github.com/ugorji/go/codec v1.3.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
|
||||
go.opentelemetry.io/otel v1.36.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.36.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.36.0 // indirect
|
||||
golang.org/x/arch v0.18.0 // indirect
|
||||
golang.org/x/crypto v0.45.0 // indirect
|
||||
golang.org/x/arch v0.23.0 // indirect
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/sync v0.18.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
google.golang.org/genai v1.17.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
|
||||
google.golang.org/grpc v1.74.2 // indirect
|
||||
google.golang.org/protobuf v1.36.7 // indirect
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
)
|
||||
|
||||
146
go.sum
146
go.sum
@@ -18,6 +18,8 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJ
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
|
||||
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
|
||||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||
@@ -27,8 +29,6 @@ github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kk
|
||||
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||
github.com/anthropics/anthropic-sdk-go v1.16.0 h1:nRkOFDqYXsHteoIhjdJr/5dsiKbFF3rflSv8ax50y8o=
|
||||
github.com/anthropics/anthropic-sdk-go v1.16.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE=
|
||||
github.com/anthropics/anthropic-sdk-go v1.19.0 h1:mO6E+ffSzLRvR/YUH9KJC0uGw0uV8GjISIuzem//3KE=
|
||||
github.com/anthropics/anthropic-sdk-go v1.19.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE=
|
||||
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA=
|
||||
@@ -69,16 +69,16 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.38.4 h1:PR00NXRYgY4FWHqOGx3fC3lhVKjs
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.38.4/go.mod h1:Z+Gd23v97pX9zK97+tX4ppAgqCt3Z2dIXB02CtBncK8=
|
||||
github.com/aws/smithy-go v1.23.0 h1:8n6I3gXzWJB2DxBDnfxgBaSX6oe0d/t10qGz7OKqMCE=
|
||||
github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
|
||||
github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0=
|
||||
github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
|
||||
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
|
||||
github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE=
|
||||
github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980=
|
||||
github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o=
|
||||
github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
|
||||
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
|
||||
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
||||
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
|
||||
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
|
||||
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
|
||||
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||
@@ -94,12 +94,14 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc
|
||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
|
||||
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
||||
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
|
||||
github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
|
||||
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
|
||||
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
|
||||
github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls=
|
||||
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
|
||||
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
||||
@@ -115,20 +117,49 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4=
|
||||
github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80=
|
||||
github.com/go-openapi/jsonreference v0.21.4 h1:24qaE2y9bx/q3uRK/qN+TDwbok1NhbSmGjjySRCHtC8=
|
||||
github.com/go-openapi/jsonreference v0.21.4/go.mod h1:rIENPTjDbLpzQmQWCj5kKj3ZlmEh+EFVbz3RTUh30/4=
|
||||
github.com/go-openapi/spec v0.22.2 h1:KEU4Fb+Lp1qg0V4MxrSCPv403ZjBl8Lx1a83gIPU8Qc=
|
||||
github.com/go-openapi/spec v0.22.2/go.mod h1:iIImLODL2loCh3Vnox8TY2YWYJZjMAKYyLH2Mu8lOZs=
|
||||
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
||||
github.com/go-openapi/swag/conv v0.25.4 h1:/Dd7p0LZXczgUcC/Ikm1+YqVzkEeCc9LnOWjfkpkfe4=
|
||||
github.com/go-openapi/swag/conv v0.25.4/go.mod h1:3LXfie/lwoAv0NHoEuY1hjoFAYkvlqI/Bn5EQDD3PPU=
|
||||
github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI=
|
||||
github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag=
|
||||
github.com/go-openapi/swag/jsonutils v0.25.4 h1:VSchfbGhD4UTf4vCdR2F4TLBdLwHyUDTd1/q4i+jGZA=
|
||||
github.com/go-openapi/swag/jsonutils v0.25.4/go.mod h1:7OYGXpvVFPn4PpaSdPHJBtF0iGnbEaTk8AvBkoWnaAY=
|
||||
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4 h1:IACsSvBhiNJwlDix7wq39SS2Fh7lUOCJRmx/4SN4sVo=
|
||||
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4/go.mod h1:Mt0Ost9l3cUzVv4OEZG+WSeoHwjWLnarzMePNDAOBiM=
|
||||
github.com/go-openapi/swag/loading v0.25.4 h1:jN4MvLj0X6yhCDduRsxDDw1aHe+ZWoLjW+9ZQWIKn2s=
|
||||
github.com/go-openapi/swag/loading v0.25.4/go.mod h1:rpUM1ZiyEP9+mNLIQUdMiD7dCETXvkkC30z53i+ftTE=
|
||||
github.com/go-openapi/swag/stringutils v0.25.4 h1:O6dU1Rd8bej4HPA3/CLPciNBBDwZj9HiEpdVsb8B5A8=
|
||||
github.com/go-openapi/swag/stringutils v0.25.4/go.mod h1:GTsRvhJW5xM5gkgiFe0fV3PUlFm0dr8vki6/VSRaZK0=
|
||||
github.com/go-openapi/swag/typeutils v0.25.4 h1:1/fbZOUN472NTc39zpa+YGHn3jzHWhv42wAJSN91wRw=
|
||||
github.com/go-openapi/swag/typeutils v0.25.4/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE=
|
||||
github.com/go-openapi/swag/yamlutils v0.25.4 h1:6jdaeSItEUb7ioS9lFoCZ65Cne1/RZtPBZ9A56h92Sw=
|
||||
github.com/go-openapi/swag/yamlutils v0.25.4/go.mod h1:MNzq1ulQu+yd8Kl7wPOut/YHAAU/H6hL91fF+E2RFwc=
|
||||
github.com/go-openapi/testify/enable/yaml/v2 v2.0.2 h1:0+Y41Pz1NkbTHz8NngxTuAXxEodtNSI1WG1c/m5Akw4=
|
||||
github.com/go-openapi/testify/enable/yaml/v2 v2.0.2/go.mod h1:kme83333GCtJQHXQ8UKX3IBZu6z8T5Dvy5+CW3NLUUg=
|
||||
github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
|
||||
github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
||||
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||
github.com/go-playground/validator/v10 v10.29.0 h1:lQlF5VNJWNlRbRZNeOIkWElR+1LL/OuHcc0Kp14w1xk=
|
||||
github.com/go-playground/validator/v10 v10.29.0/go.mod h1:D6QxqeMlgIPuT02L66f2ccrZ7AGgHkzKmmTMZhk/Kc4=
|
||||
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c h1:wpkoddUomPfHiOziHZixGO5ZBS73cKqVzZipfrLmO1w=
|
||||
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c/go.mod h1:oVDCh3qjJMLVUSILBRwrm+Bc6RNXGZYtoh9xdvf1ffM=
|
||||
github.com/go-shiori/go-readability v0.0.0-20250217085726-9f5bf5ca7612 h1:BYLNYdZaepitbZreRIa9xeCQZocWmy/wj4cGIH0qyw0=
|
||||
github.com/go-shiori/go-readability v0.0.0-20250217085726-9f5bf5ca7612/go.mod h1:wgqthQa8SAYs0yyljVeCOQlZ027VW5CmLsbi9jWC08c=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.19.1 h1:3rG3+v8pkhRqoQ/88NYNMHYVGYztCOCIZ7UQhu7H+NE=
|
||||
github.com/goccy/go-yaml v1.19.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f h1:3BSP1Tbs2djlpprl7wCLuiqMaUh5SJkkzI2gDs+FgLs=
|
||||
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
||||
@@ -172,10 +203,8 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
@@ -199,8 +228,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/nicksnyder/go-i18n/v2 v2.6.0 h1:C/m2NNWNiTB6SK4Ao8df5EWm3JETSTIGNXBpMJTxzxQ=
|
||||
github.com/nicksnyder/go-i18n/v2 v2.6.0/go.mod h1:88sRqr0C6OPyJn0/KRNaEz1uWorjxIKP7rUUcvycecE=
|
||||
github.com/ollama/ollama v0.11.7 h1:CuYjaJ/YEnvLDpJocJbbVdpdVFyGA/OP6lKFyzZD4dI=
|
||||
github.com/ollama/ollama v0.11.7/go.mod h1:9+1//yWPsDE2u+l1a5mpaKrYw4VdnSsRU3ioq5BvMms=
|
||||
github.com/ollama/ollama v0.12.4 h1:VfqVk8qSxREJar0z0EQAU2/h9qi/cqAMIKzo+nT+faI=
|
||||
github.com/ollama/ollama v0.12.4/go.mod h1:9+1//yWPsDE2u+l1a5mpaKrYw4VdnSsRU3ioq5BvMms=
|
||||
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
|
||||
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
|
||||
github.com/openai/openai-go v1.12.0 h1:NBQCnXzqOTv5wsgNC36PrFEiskGfO5wccfCWDo9S1U0=
|
||||
@@ -220,6 +249,10 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
|
||||
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
|
||||
github.com/quic-go/quic-go v0.57.1 h1:25KAAR9QR8KZrCZRThWMKVAwGoiHIrNbT72ULHTuI10=
|
||||
github.com/quic-go/quic-go v0.57.1/go.mod h1:ly4QBAjHA2VhdnxhojRsCUOeJwKYg+taDlos92xb1+s=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
@@ -241,15 +274,23 @@ github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
|
||||
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
|
||||
github.com/swaggo/gin-swagger v1.6.1 h1:Ri06G4gc9N4t4k8hekMigJ9zKTFSlqj/9paAQCQs7cY=
|
||||
github.com/swaggo/gin-swagger v1.6.1/go.mod h1:LQ+hJStHakCWRiK/YNYtJOu4mR2FP+pxLnILT/qNiTw=
|
||||
github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI=
|
||||
github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg=
|
||||
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
@@ -262,8 +303,8 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.14 h1:yOQvXCBc3Ij46LRkRoh4Yd5qK6LVOgi0bYOXfb7ifjw=
|
||||
github.com/ugorji/go/codec v1.2.14/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
|
||||
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
|
||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
@@ -281,8 +322,12 @@ go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFw
|
||||
go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4=
|
||||
go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w=
|
||||
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
|
||||
golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc=
|
||||
golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
||||
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
|
||||
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
|
||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||
golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg=
|
||||
golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
@@ -290,10 +335,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
||||
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
||||
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
|
||||
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
|
||||
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b h1:QoALfVG9rhQ/M7vYDScfPdWjGL9dlsVVM5VGh7aKoAA=
|
||||
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
@@ -301,20 +344,21 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
|
||||
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
|
||||
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -324,10 +368,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
|
||||
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -344,10 +386,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@@ -357,9 +397,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
||||
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
||||
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
|
||||
golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q=
|
||||
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
@@ -370,16 +409,18 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
|
||||
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
|
||||
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
|
||||
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
|
||||
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.247.0 h1:tSd/e0QrUlLsrwMKmkbQhYVa109qIintOls2Wh6bngc=
|
||||
@@ -394,8 +435,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c h1:
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c/go.mod h1:gw1tLEfykwDz2ET4a12jcXt4couGAm7IwsVaTy0Sflo=
|
||||
google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4=
|
||||
google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM=
|
||||
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
|
||||
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
@@ -407,4 +448,3 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -115,7 +116,7 @@ func Init() (ret *Flags, err error) {
|
||||
|
||||
// Create mapping from flag names (both short and long) to yaml tag names
|
||||
flagToYamlTag := make(map[string]string)
|
||||
t := reflect.TypeOf(Flags{})
|
||||
t := reflect.TypeFor[Flags]()
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
field := t.Field(i)
|
||||
yamlTag := field.Tag.Get("yaml")
|
||||
@@ -224,14 +225,14 @@ func Init() (ret *Flags, err error) {
|
||||
}
|
||||
|
||||
func parseDebugLevel(args []string) int {
|
||||
for i := 0; i < len(args); i++ {
|
||||
for i := range args {
|
||||
arg := args[i]
|
||||
if arg == "--debug" && i+1 < len(args) {
|
||||
if lvl, err := strconv.Atoi(args[i+1]); err == nil {
|
||||
return lvl
|
||||
}
|
||||
} else if strings.HasPrefix(arg, "--debug=") {
|
||||
if lvl, err := strconv.Atoi(strings.TrimPrefix(arg, "--debug=")); err == nil {
|
||||
} else if after, ok := strings.CutPrefix(arg, "--debug="); ok {
|
||||
if lvl, err := strconv.Atoi(after); err == nil {
|
||||
return lvl
|
||||
}
|
||||
}
|
||||
@@ -241,8 +242,8 @@ func parseDebugLevel(args []string) int {
|
||||
|
||||
func extractFlag(arg string) string {
|
||||
var flag string
|
||||
if strings.HasPrefix(arg, "--") {
|
||||
flag = strings.TrimPrefix(arg, "--")
|
||||
if after, ok := strings.CutPrefix(arg, "--"); ok {
|
||||
flag = after
|
||||
if i := strings.Index(flag, "="); i > 0 {
|
||||
flag = flag[:i]
|
||||
}
|
||||
@@ -348,10 +349,8 @@ func validateImageFile(imagePath string) error {
|
||||
ext := strings.ToLower(filepath.Ext(imagePath))
|
||||
validExtensions := []string{".png", ".jpeg", ".jpg", ".webp"}
|
||||
|
||||
for _, validExt := range validExtensions {
|
||||
if ext == validExt {
|
||||
return nil // Valid extension found
|
||||
}
|
||||
if slices.Contains(validExtensions, ext) {
|
||||
return nil // Valid extension found
|
||||
}
|
||||
|
||||
return fmt.Errorf("%s", fmt.Sprintf(i18n.T("invalid_image_file_extension"), ext))
|
||||
@@ -370,13 +369,7 @@ func validateImageParameters(imagePath, size, quality, background string, compre
|
||||
// Validate size
|
||||
if size != "" {
|
||||
validSizes := []string{"1024x1024", "1536x1024", "1024x1536", "auto"}
|
||||
valid := false
|
||||
for _, validSize := range validSizes {
|
||||
if size == validSize {
|
||||
valid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
valid := slices.Contains(validSizes, size)
|
||||
if !valid {
|
||||
return fmt.Errorf("%s", fmt.Sprintf(i18n.T("invalid_image_size"), size))
|
||||
}
|
||||
@@ -385,13 +378,7 @@ func validateImageParameters(imagePath, size, quality, background string, compre
|
||||
// Validate quality
|
||||
if quality != "" {
|
||||
validQualities := []string{"low", "medium", "high", "auto"}
|
||||
valid := false
|
||||
for _, validQuality := range validQualities {
|
||||
if quality == validQuality {
|
||||
valid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
valid := slices.Contains(validQualities, quality)
|
||||
if !valid {
|
||||
return fmt.Errorf("%s", fmt.Sprintf(i18n.T("invalid_image_quality"), quality))
|
||||
}
|
||||
@@ -400,13 +387,7 @@ func validateImageParameters(imagePath, size, quality, background string, compre
|
||||
// Validate background
|
||||
if background != "" {
|
||||
validBackgrounds := []string{"opaque", "transparent"}
|
||||
valid := false
|
||||
for _, validBackground := range validBackgrounds {
|
||||
if background == validBackground {
|
||||
valid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
valid := slices.Contains(validBackgrounds, background)
|
||||
if !valid {
|
||||
return fmt.Errorf("%s", fmt.Sprintf(i18n.T("invalid_image_background"), background))
|
||||
}
|
||||
|
||||
@@ -137,8 +137,7 @@ func (h *TranslatedHelpWriter) getTranslatedDescription(flagName string) string
|
||||
|
||||
// getOriginalDescription retrieves the original description from struct tags
|
||||
func (h *TranslatedHelpWriter) getOriginalDescription(flagName string) string {
|
||||
flags := &Flags{}
|
||||
flagsType := reflect.TypeOf(flags).Elem()
|
||||
flagsType := reflect.TypeFor[Flags]()
|
||||
|
||||
for i := 0; i < flagsType.NumField(); i++ {
|
||||
field := flagsType.Field(i)
|
||||
@@ -184,10 +183,10 @@ func detectLanguageFromArgs() string {
|
||||
if i+1 < len(args) {
|
||||
return args[i+1]
|
||||
}
|
||||
} else if strings.HasPrefix(arg, "--language=") {
|
||||
return strings.TrimPrefix(arg, "--language=")
|
||||
} else if strings.HasPrefix(arg, "-g=") {
|
||||
return strings.TrimPrefix(arg, "-g=")
|
||||
} else if after, ok := strings.CutPrefix(arg, "--language="); ok {
|
||||
return after
|
||||
} else if after, ok := strings.CutPrefix(arg, "-g="); ok {
|
||||
return after
|
||||
} else if runtime.GOOS == "windows" && strings.HasPrefix(arg, "/g:") {
|
||||
return strings.TrimPrefix(arg, "/g:")
|
||||
} else if runtime.GOOS == "windows" && strings.HasPrefix(arg, "/g=") {
|
||||
@@ -218,8 +217,7 @@ func detectLanguageFromEnv() string {
|
||||
// writeAllFlags writes all flags with translated descriptions
|
||||
func (h *TranslatedHelpWriter) writeAllFlags() {
|
||||
// Use direct reflection on the Flags struct to get all flag definitions
|
||||
flags := &Flags{}
|
||||
flagsType := reflect.TypeOf(flags).Elem()
|
||||
flagsType := reflect.TypeFor[Flags]()
|
||||
|
||||
for i := 0; i < flagsType.NumField(); i++ {
|
||||
field := flagsType.Field(i)
|
||||
@@ -274,10 +272,7 @@ func (h *TranslatedHelpWriter) writeAllFlags() {
|
||||
|
||||
// Pad to align descriptions
|
||||
flagStr := flagLine.String()
|
||||
padding := 34 - len(flagStr)
|
||||
if padding < 2 {
|
||||
padding = 2
|
||||
}
|
||||
padding := max(34-len(flagStr), 2)
|
||||
|
||||
fmt.Fprintf(h.writer, "%s%s%s", flagStr, strings.Repeat(" ", padding), description)
|
||||
|
||||
|
||||
@@ -30,6 +30,28 @@ func handleListingCommands(currentFlags *Flags, fabricDb *fsdb.Db, registry *cor
|
||||
}
|
||||
|
||||
if currentFlags.ListPatterns {
|
||||
// Check if patterns exist before listing
|
||||
var names []string
|
||||
if names, err = fabricDb.Patterns.GetNames(); err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
if len(names) == 0 && !currentFlags.ShellCompleteOutput {
|
||||
// No patterns found - provide helpful guidance
|
||||
fmt.Println("\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
fmt.Println(i18n.T("patterns_not_found_header"))
|
||||
fmt.Println("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
fmt.Printf("\n%s\n", i18n.T("patterns_required_to_work"))
|
||||
fmt.Println()
|
||||
fmt.Println(i18n.T("patterns_option_run_setup"))
|
||||
fmt.Printf(" %s\n", i18n.T("patterns_option_run_setup_command"))
|
||||
fmt.Println()
|
||||
fmt.Println(i18n.T("patterns_option_run_update"))
|
||||
fmt.Printf(" %s\n", i18n.T("patterns_option_run_update_command"))
|
||||
fmt.Println()
|
||||
return true, nil
|
||||
}
|
||||
|
||||
err = fabricDb.Patterns.ListNames(currentFlags.ShellCompleteOutput)
|
||||
return true, err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/atotto/clipboard"
|
||||
@@ -66,10 +67,5 @@ func CreateAudioOutputFile(audioData []byte, fileName string) (err error) {
|
||||
func IsAudioFormat(fileName string) bool {
|
||||
ext := strings.ToLower(filepath.Ext(fileName))
|
||||
audioExts := []string{".wav", ".mp3", ".m4a", ".aac", ".ogg", ".flac"}
|
||||
for _, audioExt := range audioExts {
|
||||
if ext == audioExt {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(audioExts, ext)
|
||||
}
|
||||
|
||||
@@ -176,29 +176,178 @@ func (o *PluginRegistry) SaveEnvFile() (err error) {
|
||||
}
|
||||
|
||||
func (o *PluginRegistry) Setup() (err error) {
|
||||
setupQuestion := plugins.NewSetupQuestion("Enter the number of the plugin to setup")
|
||||
groupsPlugins := util.NewGroupsItemsSelector("Available plugins (please configure all required plugins):",
|
||||
// Check if this is a first-time setup
|
||||
isFirstRun := o.isFirstTimeSetup()
|
||||
|
||||
if isFirstRun {
|
||||
err = o.runFirstTimeSetup()
|
||||
} else {
|
||||
err = o.runInteractiveSetup()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Validate setup after completion
|
||||
o.validateSetup()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// isFirstTimeSetup checks if this is a first-time setup
|
||||
func (o *PluginRegistry) isFirstTimeSetup() bool {
|
||||
// Check if patterns and strategies are not configured
|
||||
patternsConfigured := o.PatternsLoader.IsConfigured()
|
||||
strategiesConfigured := o.Strategies.IsConfigured()
|
||||
hasVendor := len(o.VendorManager.Vendors) > 0
|
||||
|
||||
return !patternsConfigured || !strategiesConfigured || !hasVendor
|
||||
}
|
||||
|
||||
// runFirstTimeSetup handles first-time setup with automatic pattern/strategy download
|
||||
func (o *PluginRegistry) runFirstTimeSetup() (err error) {
|
||||
fmt.Println("\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
fmt.Println(i18n.T("setup_welcome_header"))
|
||||
fmt.Println("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
|
||||
// Step 1: Download patterns (required, automatic)
|
||||
if !o.PatternsLoader.IsConfigured() {
|
||||
fmt.Printf("\n%s\n", i18n.T("setup_step_downloading_patterns"))
|
||||
if err = o.PatternsLoader.Setup(); err != nil {
|
||||
return fmt.Errorf(i18n.T("setup_failed_download_patterns"), err)
|
||||
}
|
||||
if err = o.SaveEnvFile(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2: Download strategies (required, automatic)
|
||||
if !o.Strategies.IsConfigured() {
|
||||
fmt.Printf("\n%s\n", i18n.T("setup_step_downloading_strategies"))
|
||||
if err = o.Strategies.Setup(); err != nil {
|
||||
return fmt.Errorf(i18n.T("setup_failed_download_strategies"), err)
|
||||
}
|
||||
if err = o.SaveEnvFile(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3: Configure AI vendor (interactive)
|
||||
if len(o.VendorManager.Vendors) == 0 {
|
||||
fmt.Printf("\n%s\n", i18n.T("setup_step_configure_ai_provider"))
|
||||
fmt.Printf(" %s\n", i18n.T("setup_ai_provider_required"))
|
||||
fmt.Printf(" %s\n", i18n.T("setup_add_more_providers_later"))
|
||||
fmt.Println()
|
||||
|
||||
if err = o.runVendorSetup(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Step 4: Set default vendor and model
|
||||
if !o.Defaults.IsConfigured() {
|
||||
fmt.Printf("\n%s\n", i18n.T("setup_step_setting_defaults"))
|
||||
if err = o.Defaults.Setup(); err != nil {
|
||||
return fmt.Errorf(i18n.T("setup_failed_set_defaults"), err)
|
||||
}
|
||||
if err = o.SaveEnvFile(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
fmt.Println(i18n.T("setup_complete_header"))
|
||||
fmt.Println("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
fmt.Printf("\n%s\n", i18n.T("setup_next_steps"))
|
||||
fmt.Printf(" %s\n", i18n.T("setup_list_patterns"))
|
||||
fmt.Printf(" %s\n", i18n.T("setup_try_pattern"))
|
||||
fmt.Printf(" %s\n", i18n.T("setup_configure_more"))
|
||||
fmt.Println()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// runVendorSetup helps user select and configure their first AI vendor
|
||||
func (o *PluginRegistry) runVendorSetup() (err error) {
|
||||
setupQuestion := plugins.NewSetupQuestion("Enter the number of the AI provider to configure")
|
||||
groupsPlugins := util.NewGroupsItemsSelector(i18n.T("setup_available_ai_providers"),
|
||||
func(plugin plugins.Plugin) string {
|
||||
var configuredLabel string
|
||||
if plugin.IsConfigured() {
|
||||
configuredLabel = " (configured)"
|
||||
} else {
|
||||
configuredLabel = ""
|
||||
}
|
||||
return fmt.Sprintf("%v%v", plugin.GetSetupDescription(), configuredLabel)
|
||||
return plugin.GetSetupDescription()
|
||||
})
|
||||
|
||||
groupsPlugins.AddGroupItems("AI Vendors [at least one, required]", lo.Map(o.VendorsAll.Vendors,
|
||||
groupsPlugins.AddGroupItems("", lo.Map(o.VendorsAll.Vendors,
|
||||
func(vendor ai.Vendor, _ int) plugins.Plugin {
|
||||
return vendor
|
||||
})...)
|
||||
|
||||
groupsPlugins.AddGroupItems("Tools", o.CustomPatterns, o.Defaults, o.Jina, o.Language, o.PatternsLoader, o.Strategies, o.YouTube)
|
||||
groupsPlugins.Print(false)
|
||||
|
||||
if answerErr := setupQuestion.Ask(i18n.T("setup_enter_ai_provider_number")); answerErr != nil {
|
||||
return answerErr
|
||||
}
|
||||
|
||||
if setupQuestion.Value == "" {
|
||||
return fmt.Errorf("%s", i18n.T("setup_no_ai_provider_selected"))
|
||||
}
|
||||
|
||||
number, parseErr := strconv.Atoi(setupQuestion.Value)
|
||||
if parseErr != nil {
|
||||
return fmt.Errorf(i18n.T("setup_invalid_selection"), setupQuestion.Value)
|
||||
}
|
||||
|
||||
var plugin plugins.Plugin
|
||||
if _, plugin, err = groupsPlugins.GetGroupAndItemByItemNumber(number); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if pluginSetupErr := plugin.Setup(); pluginSetupErr != nil {
|
||||
return pluginSetupErr
|
||||
}
|
||||
|
||||
if err = o.SaveEnvFile(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if o.VendorManager.FindByName(plugin.GetName()) == nil {
|
||||
if vendor, ok := plugin.(ai.Vendor); ok {
|
||||
o.VendorManager.AddVendors(vendor)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// runInteractiveSetup runs the standard interactive setup menu
|
||||
func (o *PluginRegistry) runInteractiveSetup() (err error) {
|
||||
setupQuestion := plugins.NewSetupQuestion(i18n.T("setup_plugin_prompt"))
|
||||
groupsPlugins := util.NewGroupsItemsSelector(i18n.T("setup_available_plugins"),
|
||||
func(plugin plugins.Plugin) string {
|
||||
var configuredLabel string
|
||||
if plugin.IsConfigured() {
|
||||
configuredLabel = i18n.T("plugin_configured")
|
||||
} else {
|
||||
configuredLabel = i18n.T("plugin_not_configured")
|
||||
}
|
||||
return fmt.Sprintf("%v%v", plugin.GetSetupDescription(), configuredLabel)
|
||||
})
|
||||
|
||||
// Add vendors first under REQUIRED section
|
||||
groupsPlugins.AddGroupItems(i18n.T("setup_required_configuration_header"), lo.Map(o.VendorsAll.Vendors,
|
||||
func(vendor ai.Vendor, _ int) plugins.Plugin {
|
||||
return vendor
|
||||
})...)
|
||||
|
||||
// Add required tools
|
||||
groupsPlugins.AddGroupItems(i18n.T("setup_required_tools"), o.Defaults, o.PatternsLoader, o.Strategies)
|
||||
|
||||
// Add optional tools
|
||||
groupsPlugins.AddGroupItems(i18n.T("setup_optional_configuration_header"), o.CustomPatterns, o.Jina, o.Language, o.YouTube)
|
||||
|
||||
for {
|
||||
groupsPlugins.Print(false)
|
||||
|
||||
if answerErr := setupQuestion.Ask("Plugin Number"); answerErr != nil {
|
||||
if answerErr := setupQuestion.Ask(i18n.T("setup_plugin_number")); answerErr != nil {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -237,6 +386,58 @@ func (o *PluginRegistry) Setup() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// validateSetup checks if required components are configured and warns user
|
||||
func (o *PluginRegistry) validateSetup() {
|
||||
fmt.Println("\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
fmt.Println(i18n.T("setup_validation_header"))
|
||||
fmt.Println("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
|
||||
missingRequired := false
|
||||
|
||||
// Check AI vendor
|
||||
if len(o.VendorManager.Vendors) > 0 {
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_ai_provider_configured"))
|
||||
} else {
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_ai_provider_missing"))
|
||||
missingRequired = true
|
||||
}
|
||||
|
||||
// Check default model
|
||||
if o.Defaults.IsConfigured() {
|
||||
fmt.Printf(" %s\n", fmt.Sprintf(i18n.T("setup_validation_defaults_configured"), o.Defaults.Vendor.Value, o.Defaults.Model.Value))
|
||||
} else {
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_defaults_missing"))
|
||||
missingRequired = true
|
||||
}
|
||||
|
||||
// Check patterns
|
||||
if o.PatternsLoader.IsConfigured() {
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_patterns_configured"))
|
||||
} else {
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_patterns_missing"))
|
||||
missingRequired = true
|
||||
}
|
||||
|
||||
// Check strategies
|
||||
if o.Strategies.IsConfigured() {
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_strategies_configured"))
|
||||
} else {
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_strategies_missing"))
|
||||
missingRequired = true
|
||||
}
|
||||
|
||||
fmt.Println("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
|
||||
if missingRequired {
|
||||
fmt.Printf("\n%s\n", i18n.T("setup_validation_incomplete_warning"))
|
||||
fmt.Printf(" %s\n", i18n.T("setup_validation_incomplete_help"))
|
||||
fmt.Println()
|
||||
} else {
|
||||
fmt.Printf("\n%s\n", i18n.T("setup_validation_complete"))
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
|
||||
func (o *PluginRegistry) SetupVendor(vendorName string) (err error) {
|
||||
if err = o.VendorsAll.SetupVendor(vendorName, o.VendorManager.VendorsByName); err != nil {
|
||||
return
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -146,14 +147,7 @@ func fixInvalidEscapes(jsonStr string) string {
|
||||
// Check for escape sequences only inside strings
|
||||
if inQuotes && ch == '\\' && i+1 < len(jsonStr) {
|
||||
nextChar := jsonStr[i+1]
|
||||
isValid := false
|
||||
|
||||
for _, validEscape := range validEscapes {
|
||||
if nextChar == validEscape {
|
||||
isValid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
isValid := slices.Contains(validEscapes, nextChar)
|
||||
|
||||
if !isValid {
|
||||
// Invalid escape sequence - add an extra backslash
|
||||
|
||||
@@ -1,165 +1,289 @@
|
||||
{
|
||||
"html_readability_error": "verwende ursprüngliche Eingabe, da HTML-Lesbarkeit nicht angewendet werden kann",
|
||||
"vendor_not_configured": "Anbieter %s ist nicht konfiguriert",
|
||||
"vendor_no_transcription_support": "Anbieter %s unterstützt keine Audio-Transkription",
|
||||
"transcription_model_required": "Transkriptionsmodell ist erforderlich (verwende --transcribe-model)",
|
||||
"youtube_not_configured": "YouTube ist nicht konfiguriert, bitte führe das Setup-Verfahren aus",
|
||||
"youtube_api_key_required": "YouTube API-Schlüssel für Kommentare und Metadaten erforderlich. Führe 'fabric --setup' aus, um zu konfigurieren",
|
||||
"youtube_ytdlp_not_found": "yt-dlp wurde nicht in PATH gefunden. Bitte installiere yt-dlp, um die YouTube-Transkript-Funktionalität zu nutzen",
|
||||
"youtube_invalid_url": "ungültige YouTube-URL, kann keine Video- oder Playlist-ID abrufen: '%s'",
|
||||
"youtube_url_is_playlist_not_video": "URL ist eine Playlist, kein Video",
|
||||
"youtube_no_video_id_found": "keine Video-ID in URL gefunden",
|
||||
"youtube_rate_limit_exceeded": "YouTube-Ratenlimit überschritten. Versuche es später erneut oder verwende andere yt-dlp-Argumente wie '--sleep-requests 1', um Anfragen zu verlangsamen.",
|
||||
"youtube_auth_required_bot_detection": "YouTube erfordert Authentifizierung (Bot-Erkennung). Verwende --yt-dlp-args='--cookies-from-browser BROWSER' wobei BROWSER chrome, firefox, brave usw. sein kann.",
|
||||
"youtube_ytdlp_stderr_error": "Fehler beim Lesen von yt-dlp stderr",
|
||||
"youtube_invalid_ytdlp_arguments": "ungültige yt-dlp-Argumente: %v",
|
||||
"youtube_failed_create_temp_dir": "temporäres Verzeichnis konnte nicht erstellt werden: %v",
|
||||
"youtube_no_transcript_content": "kein Transkriptinhalt in VTT-Datei gefunden",
|
||||
"youtube_no_vtt_files_found": "keine VTT-Dateien im Verzeichnis gefunden",
|
||||
"youtube_failed_walk_directory": "Verzeichnis konnte nicht durchlaufen werden: %v",
|
||||
"youtube_error_getting_video_details": "Fehler beim Abrufen der Videodetails: %v",
|
||||
"youtube_invalid_duration_string": "ungültige Dauer-Zeichenfolge: %s",
|
||||
"youtube_error_getting_metadata": "Fehler beim Abrufen der Video-Metadaten: %v",
|
||||
"youtube_error_parsing_duration": "Fehler beim Parsen der Videodauer: %v",
|
||||
"youtube_error_getting_comments": "Fehler beim Abrufen der Kommentare: %v",
|
||||
"youtube_error_saving_csv": "Fehler beim Speichern der Videos in CSV: %v",
|
||||
"youtube_no_video_found_with_id": "kein Video mit ID gefunden: %s",
|
||||
"youtube_invalid_timestamp_format": "ungültiges Zeitstempel-Format: %s",
|
||||
"youtube_empty_seconds_string": "leere Sekunden-Zeichenfolge",
|
||||
"youtube_invalid_seconds_format": "ungültiges Sekundenformat %q: %w",
|
||||
"error_fetching_playlist_videos": "Fehler beim Abrufen der Playlist-Videos: %w",
|
||||
"openai_api_base_url_not_configured": "API-Basis-URL für Anbieter %s nicht konfiguriert",
|
||||
"openai_failed_to_create_models_url": "Modell-URL konnte nicht erstellt werden: %w",
|
||||
"openai_unexpected_status_code_with_body": "unerwarteter Statuscode: %d von Anbieter %s, Antwort: %s",
|
||||
"openai_unexpected_status_code_read_error_partial": "unerwarteter Statuscode: %d von Anbieter %s (Fehler beim Lesen: %v), teilweise Antwort: %s",
|
||||
"openai_unexpected_status_code_read_error": "unerwarteter Statuscode: %d von Anbieter %s (Fehler beim Lesen der Antwort: %v)",
|
||||
"openai_unable_to_parse_models_response": "Modell-Antwort konnte nicht geparst werden; rohe Antwort: %s",
|
||||
"scraping_not_configured": "Scraping-Funktionalität ist nicht konfiguriert. Bitte richte Jina ein, um Scraping zu aktivieren",
|
||||
"could_not_determine_home_dir": "konnte Benutzer-Home-Verzeichnis nicht bestimmen: %w",
|
||||
"could_not_stat_env_file": "konnte .env-Datei nicht überprüfen: %w",
|
||||
"could_not_create_config_dir": "konnte Konfigurationsverzeichnis nicht erstellen: %w",
|
||||
"could_not_create_env_file": "konnte .env-Datei nicht erstellen: %w",
|
||||
"could_not_copy_to_clipboard": "konnte nicht in die Zwischenablage kopieren: %v",
|
||||
"file_already_exists_not_overwriting": "Datei %s existiert bereits, wird nicht überschrieben. Benenne die vorhandene Datei um oder wähle einen anderen Namen",
|
||||
"error_creating_file": "Fehler beim Erstellen der Datei: %v",
|
||||
"error_writing_to_file": "Fehler beim Schreiben in die Datei: %v",
|
||||
"error_creating_audio_file": "Fehler beim Erstellen der Audio-Datei: %v",
|
||||
"error_writing_audio_data": "Fehler beim Schreiben von Audio-Daten in die Datei: %v",
|
||||
"tts_model_requires_audio_output": "TTS-Modell '%s' benötigt Audio-Ausgabe. Bitte gib eine Audio-Ausgabedatei mit dem -o Flag an (z.B., -o output.wav)",
|
||||
"audio_output_file_specified_but_not_tts_model": "Audio-Ausgabedatei '%s' angegeben, aber Modell '%s' ist kein TTS-Modell. Bitte verwende ein TTS-Modell wie gemini-2.5-flash-preview-tts",
|
||||
"file_already_exists_choose_different": "Datei %s existiert bereits. Bitte wähle einen anderen Dateinamen oder entferne die vorhandene Datei",
|
||||
"no_notification_system_available": "kein Benachrichtigungssystem verfügbar",
|
||||
"cannot_convert_string": "kann String %q nicht zu %v konvertieren",
|
||||
"unsupported_conversion": "nicht unterstützte Konvertierung von %v zu %v",
|
||||
"invalid_config_path": "ungültiger Konfigurationspfad: %w",
|
||||
"config_file_not_found": "Konfigurationsdatei nicht gefunden: %s",
|
||||
"error_reading_config_file": "Fehler beim Lesen der Konfigurationsdatei: %w",
|
||||
"error_parsing_config_file": "Fehler beim Parsen der Konfigurationsdatei: %w",
|
||||
"error_reading_piped_message": "Fehler beim Lesen der weitergeleiteten Nachricht von stdin: %w",
|
||||
"image_file_already_exists": "Bilddatei existiert bereits: %s",
|
||||
"invalid_image_file_extension": "ungültige Bilddatei-Erweiterung '%s'. Unterstützte Formate: .png, .jpeg, .jpg, .webp",
|
||||
"image_parameters_require_image_file": "Bildparameter (--image-size, --image-quality, --image-background, --image-compression) können nur mit --image-file verwendet werden",
|
||||
"invalid_image_size": "ungültige Bildgröße '%s'. Unterstützte Größen: 1024x1024, 1536x1024, 1024x1536, auto",
|
||||
"invalid_image_quality": "ungültige Bildqualität '%s'. Unterstützte Qualitäten: low, medium, high, auto",
|
||||
"invalid_image_background": "ungültiger Bildhintergrund '%s'. Unterstützte Hintergründe: opaque, transparent",
|
||||
"image_compression_jpeg_webp_only": "Bildkomprimierung kann nur mit JPEG- und WebP-Formaten verwendet werden, nicht %s",
|
||||
"image_compression_range_error": "Bildkomprimierung muss zwischen 0 und 100 liegen, erhalten: %d",
|
||||
"transparent_background_png_webp_only": "transparenter Hintergrund kann nur mit PNG- und WebP-Formaten verwendet werden, nicht %s",
|
||||
"available_transcription_models": "Verfügbare Transkriptionsmodelle:",
|
||||
"tts_audio_generated_successfully": "TTS-Audio erfolgreich generiert und gespeichert unter: %s\n",
|
||||
"fabric_command_complete": "Fabric-Befehl abgeschlossen",
|
||||
"fabric_command_complete_with_pattern": "Fabric: %s abgeschlossen",
|
||||
"command_completed_successfully": "Befehl erfolgreich abgeschlossen",
|
||||
"output_truncated": "Ausgabe: %s...",
|
||||
"output_full": "Ausgabe: %s",
|
||||
"choose_pattern_from_available": "Wähle ein Muster aus den verfügbaren Mustern",
|
||||
"pattern_variables_help": "Werte für Mustervariablen, z.B. -v=#role:expert -v=#points:30",
|
||||
"choose_context_from_available": "Wähle einen Kontext aus den verfügbaren Kontexten",
|
||||
"choose_session_from_available": "Wähle eine Sitzung aus den verfügbaren Sitzungen",
|
||||
"attachment_path_or_url_help": "Anhangspfad oder URL (z.B. für OpenAI-Bilderkennungsnachrichten)",
|
||||
"run_setup_for_reconfigurable_parts": "Setup für alle rekonfigurierbaren Teile von Fabric ausführen",
|
||||
"set_temperature": "Temperatur festlegen",
|
||||
"set_top_p": "Top P festlegen",
|
||||
"stream_help": "Streaming",
|
||||
"set_presence_penalty": "Präsenzstrafe festlegen",
|
||||
"use_model_defaults_raw_help": "Verwende die Standardwerte des Modells, ohne Chat-Optionen (temperature, top_p usw.) zu senden. Gilt nur für OpenAI-kompatible Anbieter. Anthropic-Modelle verwenden stets eine intelligente Parameterauswahl, um modell-spezifische Anforderungen einzuhalten.",
|
||||
"set_frequency_penalty": "Häufigkeitsstrafe festlegen",
|
||||
"list_all_patterns": "Alle Muster auflisten",
|
||||
"list_all_available_models": "Alle verfügbaren Modelle auflisten",
|
||||
"list_all_contexts": "Alle Kontexte auflisten",
|
||||
"list_all_sessions": "Alle Sitzungen auflisten",
|
||||
"update_patterns": "Muster aktualisieren",
|
||||
"messages_to_send_to_chat": "Nachrichten zum Senden an den Chat",
|
||||
"copy_to_clipboard": "In Zwischenablage kopieren",
|
||||
"choose_model": "Modell wählen",
|
||||
"specify_vendor_for_model": "Anbieter für das ausgewählte Modell angeben (z.B., -V \"LM Studio\" -m openai/gpt-oss-20b)",
|
||||
"model_context_length_ollama": "Modell-Kontextlänge (betrifft nur ollama)",
|
||||
"output_to_file": "Ausgabe in Datei",
|
||||
"output_entire_session": "Gesamte Sitzung (auch eine temporäre) in die Ausgabedatei ausgeben",
|
||||
"number_of_latest_patterns": "Anzahl der neuesten Muster zum Auflisten",
|
||||
"change_default_model": "Standardmodell ändern",
|
||||
"youtube_url_help": "YouTube-Video oder Playlist-\"URL\" zum Abrufen von Transkript und Kommentaren und Senden an Chat oder Ausgabe in Konsole und Speichern in Ausgabedatei",
|
||||
"prefer_playlist_over_video": "Playlist gegenüber Video bevorzugen, wenn beide IDs in der URL vorhanden sind",
|
||||
"grab_transcript_from_youtube": "Transkript von YouTube-Video abrufen und an Chat senden (wird standardmäßig verwendet).",
|
||||
"grab_transcript_with_timestamps": "Transkript von YouTube-Video mit Zeitstempeln abrufen und an Chat senden",
|
||||
"grab_comments_from_youtube": "Kommentare von YouTube-Video abrufen und an Chat senden",
|
||||
"output_video_metadata": "Video-Metadaten ausgeben",
|
||||
"additional_yt_dlp_args": "Zusätzliche Argumente für yt-dlp (z.B. '--cookies-from-browser brave')",
|
||||
"specify_language_code": "Sprachencode für den Chat angeben, z.B. -g=en -g=zh -g=pt-BR -g=pt-PT",
|
||||
"scrape_website_url": "Website-URL zu Markdown mit Jina AI scrapen",
|
||||
"search_question_jina": "Suchanfrage mit Jina AI",
|
||||
"seed_for_lmm_generation": "Seed für LMM-Generierung",
|
||||
"wipe_context": "Kontext löschen",
|
||||
"wipe_session": "Sitzung löschen",
|
||||
"print_context": "Kontext ausgeben",
|
||||
"print_session": "Sitzung ausgeben",
|
||||
"convert_html_readability": "HTML-Eingabe in eine saubere, lesbare Ansicht konvertieren",
|
||||
"apply_variables_to_input": "Variablen auf Benutzereingabe anwenden",
|
||||
"disable_pattern_variable_replacement": "Mustervariablenersetzung deaktivieren",
|
||||
"show_dry_run": "Zeige, was an das Modell gesendet würde, ohne es tatsächlich zu senden",
|
||||
"serve_fabric_rest_api": "Fabric REST API bereitstellen",
|
||||
"serve_fabric_api_ollama_endpoints": "Fabric REST API mit ollama-Endpunkten bereitstellen",
|
||||
"address_to_bind_rest_api": "Adresse zum Binden der REST API",
|
||||
"api_key_secure_server_routes": "API-Schlüssel zum Sichern der Server-Routen",
|
||||
"path_to_yaml_config": "Pfad zur YAML-Konfigurationsdatei",
|
||||
"print_current_version": "Aktuelle Version ausgeben",
|
||||
"list_all_registered_extensions": "Alle registrierten Erweiterungen auflisten",
|
||||
"register_new_extension": "Neue Erweiterung aus Konfigurationsdateipfad registrieren",
|
||||
"remove_registered_extension": "Registrierte Erweiterung nach Name entfernen",
|
||||
"choose_strategy_from_available": "Strategie aus den verfügbaren Strategien wählen",
|
||||
"list_all_strategies": "Alle Strategien auflisten",
|
||||
"list_all_vendors": "Alle Anbieter auflisten",
|
||||
"output_raw_list_shell_completion": "Rohe Liste ohne Kopfzeilen/Formatierung ausgeben (für Shell-Vervollständigung)",
|
||||
"enable_web_search_tool": "Web-Such-Tool für unterstützte Modelle aktivieren (Anthropic, OpenAI, Gemini)",
|
||||
"set_location_web_search": "Standort für Web-Suchergebnisse festlegen (z.B., 'America/Los_Angeles')",
|
||||
"save_generated_image_to_file": "Generiertes Bild in angegebenem Dateipfad speichern (z.B., 'output.png')",
|
||||
"image_dimensions_help": "Bildabmessungen: 1024x1024, 1536x1024, 1024x1536, auto (Standard: auto)",
|
||||
"image_quality_help": "Bildqualität: low, medium, high, auto (Standard: auto)",
|
||||
"compression_level_jpeg_webp": "Komprimierungslevel 0-100 für JPEG/WebP-Formate (Standard: nicht gesetzt)",
|
||||
"background_type_help": "Hintergrundtyp: opaque, transparent (Standard: opaque, nur für PNG/WebP)",
|
||||
"suppress_thinking_tags": "In Denk-Tags eingeschlossenen Text unterdrücken",
|
||||
"start_tag_thinking_sections": "Start-Tag für Denk-Abschnitte",
|
||||
"end_tag_thinking_sections": "End-Tag für Denk-Abschnitte",
|
||||
"disable_openai_responses_api": "OpenAI Responses API deaktivieren (Standard: false)",
|
||||
"audio_video_file_transcribe": "Audio- oder Video-Datei zum Transkribieren",
|
||||
"model_for_transcription": "Modell für Transkription (getrennt vom Chat-Modell)",
|
||||
"split_media_files_ffmpeg": "Audio/Video-Dateien größer als 25MB mit ffmpeg aufteilen",
|
||||
"tts_voice_name": "TTS-Stimmenname für unterstützte Modelle (z.B., Kore, Charon, Puck)",
|
||||
"list_gemini_tts_voices": "Alle verfügbaren Gemini TTS-Stimmen auflisten",
|
||||
"list_transcription_models": "Alle verfügbaren Transkriptionsmodelle auflisten",
|
||||
"send_desktop_notification": "Desktop-Benachrichtigung senden, wenn Befehl abgeschlossen ist",
|
||||
"custom_notification_command": "Benutzerdefinierter Befehl für Benachrichtigungen (überschreibt eingebaute Benachrichtigungen)",
|
||||
"set_reasoning_thinking_level": "Reasoning/Thinking-Level festlegen (z.B., off, low, medium, high, oder numerische Token für Anthropic oder Google Gemini)",
|
||||
"set_debug_level": "Debug-Level festlegen (0=aus, 1=grundlegend, 2=detailliert, 3=Trace)",
|
||||
"usage_header": "Verwendung:",
|
||||
"application_options_header": "Anwendungsoptionen:",
|
||||
"help_options_header": "Hilfe-Optionen:",
|
||||
"help_message": "Diese Hilfenachricht anzeigen",
|
||||
"options_placeholder": "[OPTIONEN]",
|
||||
"available_vendors_header": "Verfügbare Anbieter:",
|
||||
"available_models_header": "Verfügbare Modelle",
|
||||
"no_items_found": "Keine %s",
|
||||
"no_description_available": "Keine Beschreibung verfügbar",
|
||||
"i18n_download_failed": "Fehler beim Herunterladen der Übersetzung für Sprache '%s': %v",
|
||||
"i18n_load_failed": "Fehler beim Laden der Übersetzungsdatei: %v"
|
||||
"html_readability_error": "verwende ursprüngliche Eingabe, da HTML-Lesbarkeit nicht angewendet werden kann",
|
||||
"vendor_not_configured": "Anbieter %s ist nicht konfiguriert",
|
||||
"vendor_no_transcription_support": "Anbieter %s unterstützt keine Audio-Transkription",
|
||||
"transcription_model_required": "Transkriptionsmodell ist erforderlich (verwende --transcribe-model)",
|
||||
"youtube_not_configured": "YouTube ist nicht konfiguriert, bitte führe das Setup-Verfahren aus",
|
||||
"youtube_api_key_required": "YouTube API-Schlüssel für Kommentare und Metadaten erforderlich. Führe 'fabric --setup' aus, um zu konfigurieren",
|
||||
"youtube_ytdlp_not_found": "yt-dlp wurde nicht in PATH gefunden. Bitte installiere yt-dlp, um die YouTube-Transkript-Funktionalität zu nutzen",
|
||||
"youtube_invalid_url": "ungültige YouTube-URL, kann keine Video- oder Playlist-ID abrufen: '%s'",
|
||||
"youtube_url_is_playlist_not_video": "URL ist eine Playlist, kein Video",
|
||||
"youtube_no_video_id_found": "keine Video-ID in URL gefunden",
|
||||
"youtube_rate_limit_exceeded": "YouTube-Ratenlimit überschritten. Versuche es später erneut oder verwende andere yt-dlp-Argumente wie '--sleep-requests 1', um Anfragen zu verlangsamen.",
|
||||
"youtube_auth_required_bot_detection": "YouTube erfordert Authentifizierung (Bot-Erkennung). Verwende --yt-dlp-args='--cookies-from-browser BROWSER' wobei BROWSER chrome, firefox, brave usw. sein kann.",
|
||||
"youtube_ytdlp_stderr_error": "Fehler beim Lesen von yt-dlp stderr",
|
||||
"youtube_invalid_ytdlp_arguments": "ungültige yt-dlp-Argumente: %v",
|
||||
"youtube_failed_create_temp_dir": "temporäres Verzeichnis konnte nicht erstellt werden: %v",
|
||||
"youtube_no_transcript_content": "kein Transkriptinhalt in VTT-Datei gefunden",
|
||||
"youtube_no_vtt_files_found": "keine VTT-Dateien im Verzeichnis gefunden",
|
||||
"youtube_failed_walk_directory": "Verzeichnis konnte nicht durchlaufen werden: %v",
|
||||
"youtube_error_getting_video_details": "Fehler beim Abrufen der Videodetails: %v",
|
||||
"youtube_invalid_duration_string": "ungültige Dauer-Zeichenfolge: %s",
|
||||
"youtube_error_getting_metadata": "Fehler beim Abrufen der Video-Metadaten: %v",
|
||||
"youtube_error_parsing_duration": "Fehler beim Parsen der Videodauer: %v",
|
||||
"youtube_error_getting_comments": "Fehler beim Abrufen der Kommentare: %v",
|
||||
"youtube_error_saving_csv": "Fehler beim Speichern der Videos in CSV: %v",
|
||||
"youtube_no_video_found_with_id": "kein Video mit ID gefunden: %s",
|
||||
"youtube_invalid_timestamp_format": "ungültiges Zeitstempel-Format: %s",
|
||||
"youtube_empty_seconds_string": "leere Sekunden-Zeichenfolge",
|
||||
"youtube_invalid_seconds_format": "ungültiges Sekundenformat %q: %w",
|
||||
"error_fetching_playlist_videos": "Fehler beim Abrufen der Playlist-Videos: %w",
|
||||
"openai_api_base_url_not_configured": "API-Basis-URL für Anbieter %s nicht konfiguriert",
|
||||
"openai_failed_to_create_models_url": "Modell-URL konnte nicht erstellt werden: %w",
|
||||
"openai_unexpected_status_code_with_body": "unerwarteter Statuscode: %d von Anbieter %s, Antwort: %s",
|
||||
"openai_unexpected_status_code_read_error_partial": "unerwarteter Statuscode: %d von Anbieter %s (Fehler beim Lesen: %v), teilweise Antwort: %s",
|
||||
"openai_unexpected_status_code_read_error": "unerwarteter Statuscode: %d von Anbieter %s (Fehler beim Lesen der Antwort: %v)",
|
||||
"openai_unable_to_parse_models_response": "Modell-Antwort konnte nicht geparst werden; rohe Antwort: %s",
|
||||
"scraping_not_configured": "Scraping-Funktionalität ist nicht konfiguriert. Bitte richte Jina ein, um Scraping zu aktivieren",
|
||||
"could_not_determine_home_dir": "konnte Benutzer-Home-Verzeichnis nicht bestimmen: %w",
|
||||
"could_not_stat_env_file": "konnte .env-Datei nicht überprüfen: %w",
|
||||
"could_not_create_config_dir": "konnte Konfigurationsverzeichnis nicht erstellen: %w",
|
||||
"could_not_create_env_file": "konnte .env-Datei nicht erstellen: %w",
|
||||
"could_not_copy_to_clipboard": "konnte nicht in die Zwischenablage kopieren: %v",
|
||||
"file_already_exists_not_overwriting": "Datei %s existiert bereits, wird nicht überschrieben. Benenne die vorhandene Datei um oder wähle einen anderen Namen",
|
||||
"error_creating_file": "Fehler beim Erstellen der Datei: %v",
|
||||
"error_writing_to_file": "Fehler beim Schreiben in die Datei: %v",
|
||||
"error_creating_audio_file": "Fehler beim Erstellen der Audio-Datei: %v",
|
||||
"error_writing_audio_data": "Fehler beim Schreiben von Audio-Daten in die Datei: %v",
|
||||
"tts_model_requires_audio_output": "TTS-Modell '%s' benötigt Audio-Ausgabe. Bitte gib eine Audio-Ausgabedatei mit dem -o Flag an (z.B., -o output.wav)",
|
||||
"audio_output_file_specified_but_not_tts_model": "Audio-Ausgabedatei '%s' angegeben, aber Modell '%s' ist kein TTS-Modell. Bitte verwende ein TTS-Modell wie gemini-2.5-flash-preview-tts",
|
||||
"file_already_exists_choose_different": "Datei %s existiert bereits. Bitte wähle einen anderen Dateinamen oder entferne die vorhandene Datei",
|
||||
"no_notification_system_available": "kein Benachrichtigungssystem verfügbar",
|
||||
"cannot_convert_string": "kann String %q nicht zu %v konvertieren",
|
||||
"unsupported_conversion": "nicht unterstützte Konvertierung von %v zu %v",
|
||||
"invalid_config_path": "ungültiger Konfigurationspfad: %w",
|
||||
"config_file_not_found": "Konfigurationsdatei nicht gefunden: %s",
|
||||
"error_reading_config_file": "Fehler beim Lesen der Konfigurationsdatei: %w",
|
||||
"error_parsing_config_file": "Fehler beim Parsen der Konfigurationsdatei: %w",
|
||||
"error_reading_piped_message": "Fehler beim Lesen der weitergeleiteten Nachricht von stdin: %w",
|
||||
"image_file_already_exists": "Bilddatei existiert bereits: %s",
|
||||
"invalid_image_file_extension": "ungültige Bilddatei-Erweiterung '%s'. Unterstützte Formate: .png, .jpeg, .jpg, .webp",
|
||||
"image_parameters_require_image_file": "Bildparameter (--image-size, --image-quality, --image-background, --image-compression) können nur mit --image-file verwendet werden",
|
||||
"invalid_image_size": "ungültige Bildgröße '%s'. Unterstützte Größen: 1024x1024, 1536x1024, 1024x1536, auto",
|
||||
"invalid_image_quality": "ungültige Bildqualität '%s'. Unterstützte Qualitäten: low, medium, high, auto",
|
||||
"invalid_image_background": "ungültiger Bildhintergrund '%s'. Unterstützte Hintergründe: opaque, transparent",
|
||||
"image_compression_jpeg_webp_only": "Bildkomprimierung kann nur mit JPEG- und WebP-Formaten verwendet werden, nicht %s",
|
||||
"image_compression_range_error": "Bildkomprimierung muss zwischen 0 und 100 liegen, erhalten: %d",
|
||||
"transparent_background_png_webp_only": "transparenter Hintergrund kann nur mit PNG- und WebP-Formaten verwendet werden, nicht %s",
|
||||
"available_transcription_models": "Verfügbare Transkriptionsmodelle:",
|
||||
"tts_audio_generated_successfully": "TTS-Audio erfolgreich generiert und gespeichert unter: %s\n",
|
||||
"fabric_command_complete": "Fabric-Befehl abgeschlossen",
|
||||
"fabric_command_complete_with_pattern": "Fabric: %s abgeschlossen",
|
||||
"command_completed_successfully": "Befehl erfolgreich abgeschlossen",
|
||||
"output_truncated": "Ausgabe: %s...",
|
||||
"output_full": "Ausgabe: %s",
|
||||
"choose_pattern_from_available": "Wähle ein Muster aus den verfügbaren Mustern",
|
||||
"pattern_variables_help": "Werte für Mustervariablen, z.B. -v=#role:expert -v=#points:30",
|
||||
"choose_context_from_available": "Wähle einen Kontext aus den verfügbaren Kontexten",
|
||||
"choose_session_from_available": "Wähle eine Sitzung aus den verfügbaren Sitzungen",
|
||||
"attachment_path_or_url_help": "Anhangspfad oder URL (z.B. für OpenAI-Bilderkennungsnachrichten)",
|
||||
"run_setup_for_reconfigurable_parts": "Setup für alle rekonfigurierbaren Teile von Fabric ausführen",
|
||||
"set_temperature": "Temperatur festlegen",
|
||||
"set_top_p": "Top P festlegen",
|
||||
"stream_help": "Streaming",
|
||||
"set_presence_penalty": "Präsenzstrafe festlegen",
|
||||
"use_model_defaults_raw_help": "Verwende die Standardwerte des Modells, ohne Chat-Optionen (temperature, top_p usw.) zu senden. Gilt nur für OpenAI-kompatible Anbieter. Anthropic-Modelle verwenden stets eine intelligente Parameterauswahl, um modell-spezifische Anforderungen einzuhalten.",
|
||||
"set_frequency_penalty": "Häufigkeitsstrafe festlegen",
|
||||
"list_all_patterns": "Alle Muster auflisten",
|
||||
"list_all_available_models": "Alle verfügbaren Modelle auflisten",
|
||||
"list_all_contexts": "Alle Kontexte auflisten",
|
||||
"list_all_sessions": "Alle Sitzungen auflisten",
|
||||
"update_patterns": "Muster aktualisieren",
|
||||
"messages_to_send_to_chat": "Nachrichten zum Senden an den Chat",
|
||||
"copy_to_clipboard": "In Zwischenablage kopieren",
|
||||
"choose_model": "Modell wählen",
|
||||
"specify_vendor_for_model": "Anbieter für das ausgewählte Modell angeben (z.B., -V \"LM Studio\" -m openai/gpt-oss-20b)",
|
||||
"model_context_length_ollama": "Modell-Kontextlänge (betrifft nur ollama)",
|
||||
"output_to_file": "Ausgabe in Datei",
|
||||
"output_entire_session": "Gesamte Sitzung (auch eine temporäre) in die Ausgabedatei ausgeben",
|
||||
"number_of_latest_patterns": "Anzahl der neuesten Muster zum Auflisten",
|
||||
"change_default_model": "Standardmodell ändern",
|
||||
"youtube_url_help": "YouTube-Video oder Playlist-\"URL\" zum Abrufen von Transkript und Kommentaren und Senden an Chat oder Ausgabe in Konsole und Speichern in Ausgabedatei",
|
||||
"prefer_playlist_over_video": "Playlist gegenüber Video bevorzugen, wenn beide IDs in der URL vorhanden sind",
|
||||
"grab_transcript_from_youtube": "Transkript von YouTube-Video abrufen und an Chat senden (wird standardmäßig verwendet).",
|
||||
"grab_transcript_with_timestamps": "Transkript von YouTube-Video mit Zeitstempeln abrufen und an Chat senden",
|
||||
"grab_comments_from_youtube": "Kommentare von YouTube-Video abrufen und an Chat senden",
|
||||
"output_video_metadata": "Video-Metadaten ausgeben",
|
||||
"additional_yt_dlp_args": "Zusätzliche Argumente für yt-dlp (z.B. '--cookies-from-browser brave')",
|
||||
"specify_language_code": "Sprachencode für den Chat angeben, z.B. -g=en -g=zh -g=pt-BR -g=pt-PT",
|
||||
"scrape_website_url": "Website-URL zu Markdown mit Jina AI scrapen",
|
||||
"search_question_jina": "Suchanfrage mit Jina AI",
|
||||
"seed_for_lmm_generation": "Seed für LMM-Generierung",
|
||||
"wipe_context": "Kontext löschen",
|
||||
"wipe_session": "Sitzung löschen",
|
||||
"print_context": "Kontext ausgeben",
|
||||
"print_session": "Sitzung ausgeben",
|
||||
"convert_html_readability": "HTML-Eingabe in eine saubere, lesbare Ansicht konvertieren",
|
||||
"apply_variables_to_input": "Variablen auf Benutzereingabe anwenden",
|
||||
"disable_pattern_variable_replacement": "Mustervariablenersetzung deaktivieren",
|
||||
"show_dry_run": "Zeige, was an das Modell gesendet würde, ohne es tatsächlich zu senden",
|
||||
"serve_fabric_rest_api": "Fabric REST API bereitstellen",
|
||||
"serve_fabric_api_ollama_endpoints": "Fabric REST API mit ollama-Endpunkten bereitstellen",
|
||||
"address_to_bind_rest_api": "Adresse zum Binden der REST API",
|
||||
"api_key_secure_server_routes": "API-Schlüssel zum Sichern der Server-Routen",
|
||||
"path_to_yaml_config": "Pfad zur YAML-Konfigurationsdatei",
|
||||
"print_current_version": "Aktuelle Version ausgeben",
|
||||
"list_all_registered_extensions": "Alle registrierten Erweiterungen auflisten",
|
||||
"register_new_extension": "Neue Erweiterung aus Konfigurationsdateipfad registrieren",
|
||||
"remove_registered_extension": "Registrierte Erweiterung nach Name entfernen",
|
||||
"choose_strategy_from_available": "Strategie aus den verfügbaren Strategien wählen",
|
||||
"list_all_strategies": "Alle Strategien auflisten",
|
||||
"list_all_vendors": "Alle Anbieter auflisten",
|
||||
"output_raw_list_shell_completion": "Rohe Liste ohne Kopfzeilen/Formatierung ausgeben (für Shell-Vervollständigung)",
|
||||
"enable_web_search_tool": "Web-Such-Tool für unterstützte Modelle aktivieren (Anthropic, OpenAI, Gemini)",
|
||||
"set_location_web_search": "Standort für Web-Suchergebnisse festlegen (z.B., 'America/Los_Angeles')",
|
||||
"save_generated_image_to_file": "Generiertes Bild in angegebenem Dateipfad speichern (z.B., 'output.png')",
|
||||
"image_dimensions_help": "Bildabmessungen: 1024x1024, 1536x1024, 1024x1536, auto (Standard: auto)",
|
||||
"image_quality_help": "Bildqualität: low, medium, high, auto (Standard: auto)",
|
||||
"compression_level_jpeg_webp": "Komprimierungslevel 0-100 für JPEG/WebP-Formate (Standard: nicht gesetzt)",
|
||||
"background_type_help": "Hintergrundtyp: opaque, transparent (Standard: opaque, nur für PNG/WebP)",
|
||||
"suppress_thinking_tags": "In Denk-Tags eingeschlossenen Text unterdrücken",
|
||||
"start_tag_thinking_sections": "Start-Tag für Denk-Abschnitte",
|
||||
"end_tag_thinking_sections": "End-Tag für Denk-Abschnitte",
|
||||
"disable_openai_responses_api": "OpenAI Responses API deaktivieren (Standard: false)",
|
||||
"audio_video_file_transcribe": "Audio- oder Video-Datei zum Transkribieren",
|
||||
"model_for_transcription": "Modell für Transkription (getrennt vom Chat-Modell)",
|
||||
"split_media_files_ffmpeg": "Audio/Video-Dateien größer als 25MB mit ffmpeg aufteilen",
|
||||
"tts_voice_name": "TTS-Stimmenname für unterstützte Modelle (z.B., Kore, Charon, Puck)",
|
||||
"list_gemini_tts_voices": "Alle verfügbaren Gemini TTS-Stimmen auflisten",
|
||||
"list_transcription_models": "Alle verfügbaren Transkriptionsmodelle auflisten",
|
||||
"send_desktop_notification": "Desktop-Benachrichtigung senden, wenn Befehl abgeschlossen ist",
|
||||
"custom_notification_command": "Benutzerdefinierter Befehl für Benachrichtigungen (überschreibt eingebaute Benachrichtigungen)",
|
||||
"set_reasoning_thinking_level": "Reasoning/Thinking-Level festlegen (z.B., off, low, medium, high, oder numerische Token für Anthropic oder Google Gemini)",
|
||||
"set_debug_level": "Debug-Level festlegen (0=aus, 1=grundlegend, 2=detailliert, 3=Trace)",
|
||||
"usage_header": "Verwendung:",
|
||||
"application_options_header": "Anwendungsoptionen:",
|
||||
"help_options_header": "Hilfe-Optionen:",
|
||||
"help_message": "Diese Hilfenachricht anzeigen",
|
||||
"options_placeholder": "[OPTIONEN]",
|
||||
"available_vendors_header": "Verfügbare Anbieter:",
|
||||
"available_models_header": "Verfügbare Modelle",
|
||||
"no_items_found": "Keine %s",
|
||||
"no_description_available": "Keine Beschreibung verfügbar",
|
||||
"i18n_download_failed": "Fehler beim Herunterladen der Übersetzung für Sprache '%s': %v",
|
||||
"i18n_load_failed": "Fehler beim Laden der Übersetzungsdatei: %v",
|
||||
"setup_welcome_header": "🎉 Willkommen bei Fabric! Lass uns mit der Einrichtung beginnen.",
|
||||
"setup_step_downloading_patterns": "📥 Schritt 1: Patterns werden heruntergeladen (erforderlich für Fabric)...",
|
||||
"setup_step_downloading_strategies": "📥 Schritt 2: Strategien werden heruntergeladen (erforderlich für Fabric)...",
|
||||
"setup_step_configure_ai_provider": "🤖 Schritt 3: KI-Anbieter konfigurieren",
|
||||
"setup_ai_provider_required": "Fabric benötigt mindestens einen KI-Anbieter.",
|
||||
"setup_add_more_providers_later": "Sie können später weitere Anbieter mit 'fabric --setup' hinzufügen",
|
||||
"setup_step_setting_defaults": "⚙️ Schritt 4: Standard-Anbieter und -Modell werden festgelegt...",
|
||||
"setup_complete_header": "✅ Einrichtung abgeschlossen! Sie können Fabric jetzt verwenden.",
|
||||
"setup_next_steps": "Nächste Schritte:",
|
||||
"setup_list_patterns": "• Verfügbare Patterns auflisten: fabric -l",
|
||||
"setup_try_pattern": "• Ein Pattern ausprobieren: echo 'Ihr Text' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• Weitere Einstellungen konfigurieren: fabric --setup",
|
||||
"setup_failed_download_patterns": "Fehler beim Herunterladen der Patterns: %w",
|
||||
"setup_failed_download_strategies": "Fehler beim Herunterladen der Strategien: %w",
|
||||
"setup_failed_set_defaults": "Fehler beim Festlegen des Standard-Anbieters und -Modells: %w",
|
||||
"setup_no_ai_provider_selected": "Kein KI-Anbieter ausgewählt - mindestens einer ist erforderlich",
|
||||
"setup_invalid_selection": "Ungültige Auswahl: %s",
|
||||
"setup_available_ai_providers": "Verfügbare KI-Anbieter:",
|
||||
"setup_enter_ai_provider_number": "KI-Anbieter-Nummer",
|
||||
"setup_available_plugins": "Verfügbare Plugins:",
|
||||
"setup_plugin_number": "Plugin-Nummer",
|
||||
"setup_plugin_prompt": "Geben Sie die Nummer des Plugins ein, das eingerichtet werden soll",
|
||||
"setup_required_configuration_header": "━━━ ERFORDERLICHE KONFIGURATION ━━━\n\nKI-Anbieter [mindestens einer erforderlich]",
|
||||
"setup_required_tools": "Erforderliche Werkzeuge",
|
||||
"setup_optional_configuration_header": "━━━ OPTIONALE KONFIGURATION ━━━\n\nOptionale Werkzeuge",
|
||||
"setup_validation_header": "Konfigurationsstatus:",
|
||||
"setup_validation_ai_provider_configured": "✓ KI-Anbieter konfiguriert",
|
||||
"setup_validation_ai_provider_missing": "✗ KI-Anbieter nicht konfiguriert - Erforderlich für Fabric",
|
||||
"setup_validation_defaults_configured": "✓ Standard-Anbieter/-Modell festgelegt: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ Standard-Anbieter/-Modell nicht festgelegt - Erforderlich für Fabric",
|
||||
"setup_validation_patterns_configured": "✓ Patterns heruntergeladen",
|
||||
"setup_validation_patterns_missing": "✗ Patterns nicht gefunden - Erforderlich für Fabric",
|
||||
"setup_validation_strategies_configured": "✓ Strategien heruntergeladen",
|
||||
"setup_validation_strategies_missing": "✗ Strategien nicht gefunden - Erforderlich für Fabric",
|
||||
"setup_validation_incomplete_warning": "⚠️ Einrichtung unvollständig! Erforderliche Komponenten fehlen.",
|
||||
"setup_validation_incomplete_help": "Führen Sie 'fabric --setup' erneut aus, um fehlende Elemente zu konfigurieren,\noder 'fabric -U', um Patterns und Strategien herunterzuladen.",
|
||||
"setup_validation_complete": "✓ Alle erforderlichen Komponenten konfiguriert!",
|
||||
"patterns_not_found_header": "⚠️ Keine Patterns gefunden!",
|
||||
"patterns_required_to_work": "Patterns sind erforderlich, damit Fabric funktioniert. Um dies zu beheben:",
|
||||
"patterns_option_run_setup": "Option 1 (Empfohlen): Setup ausführen, um Patterns herunterzuladen",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "Option 2: Patterns direkt herunterladen/aktualisieren",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "Pattern '%s' nicht gefunden.\n\nKeine Patterns installiert! Um dies zu beheben:\n • Führen Sie 'fabric --setup' aus, um Patterns zu konfigurieren und herunterzuladen\n • Oder führen Sie 'fabric -U' aus, um Patterns direkt herunterzuladen/zu aktualisieren",
|
||||
"pattern_not_found_list_available": "Pattern '%s' nicht gefunden. Führen Sie 'fabric -l' aus, um verfügbare Patterns anzuzeigen",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ NICHT KONFIGURIERT",
|
||||
"defaults_setup_description": "Standard-KI-Anbieter und -Modell",
|
||||
"defaults_model_question": "Geben Sie den Index oder den Namen Ihres Standardmodells ein",
|
||||
"defaults_model_context_length_question": "Geben Sie die Kontextlänge des Modells ein",
|
||||
"custom_patterns_label": "Benutzerdefinierte Patterns",
|
||||
"custom_patterns_setup_description": "Benutzerdefinierte Patterns - Verzeichnis für Ihre benutzerdefinierten Patterns festlegen",
|
||||
"custom_patterns_directory_question": "Geben Sie den Pfad zu Ihrem benutzerdefinierten Pattern-Verzeichnis ein",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Jina AI Service - zum Erfassen einer Webseite als sauberer, LLM-freundlicher Text",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - zum Erfassen von Video-Transkripten (via yt-dlp) und Kommentaren/Metadaten (via YouTube API)",
|
||||
"language_label": "Sprache",
|
||||
"language_setup_description": "Sprache - Standard-Ausgabesprache des AI-Anbieters",
|
||||
"language_output_question": "Geben Sie Ihre Standard-Ausgabesprache ein (zum Beispiel: zh_CN)",
|
||||
"optional_marker": "(optional)",
|
||||
"required_marker": "[erforderlich]",
|
||||
"patterns_loader_label": "Pattern-Loader",
|
||||
"patterns_setup_description": "Patterns – lädt Patterns herunter",
|
||||
"patterns_git_repo_url_label": "Git Repo URL",
|
||||
"patterns_git_repo_url_question": "Geben Sie die Standard-Git-Repository-URL für die Patterns ein",
|
||||
"patterns_git_repo_folder_label": "Git Repo Patterns Ordner",
|
||||
"patterns_git_repo_folder_question": "Geben Sie den Standardordner im Git-Repository an, in dem die Patterns gespeichert sind",
|
||||
"patterns_failed_create_temp_folder": "Fehler beim Erstellen des temporären Pattern-Ordners: %w",
|
||||
"patterns_downloading": "Lade Patterns herunter und befülle %s...\\n",
|
||||
"patterns_failed_download_from_git": "Fehler beim Herunterladen der Patterns aus dem Git-Repository: %w",
|
||||
"patterns_saving_updated_configuration": "💾 Aktualisierte Konfiguration wird gespeichert (Pfad geändert von '%s' zu '%s')...\\n",
|
||||
"patterns_failed_move_patterns": "Fehler beim Verschieben der Patterns in das Konfigurationsverzeichnis: %w",
|
||||
"patterns_download_success": "✅ Patterns erfolgreich nach %s heruntergeladen und installiert\\n",
|
||||
"patterns_failed_unique_file": "Fehler beim Erstellen der Datei mit eindeutigen Patterns: %w",
|
||||
"patterns_failed_access_directory": "Fehler beim Zugriff auf den Pattern-Ordner '%s': %w",
|
||||
"patterns_preserve_warning": "Warnung: Benutzerdefiniertes Pattern '%s' konnte nicht erhalten werden: %v\\n",
|
||||
"patterns_preserved_custom_pattern": "Benutzerdefiniertes Pattern beibehalten: %s\\n",
|
||||
"patterns_failed_create_temp_dir": "Fehler beim Erstellen des temporären Verzeichnisses: %w",
|
||||
"patterns_cloning_repository": "Repository %s wird geklont (Pfad: %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "Fehler beim Herunterladen der Patterns von %s: %w",
|
||||
"patterns_failed_read_temp_directory": "Fehler beim Lesen des temporären Pattern-Verzeichnisses: %w",
|
||||
"patterns_no_patterns_migration_failed": "Keine Patterns im Repository unter Pfad %s gefunden und Migration fehlgeschlagen: %w",
|
||||
"patterns_downloaded_temp": "%d Patterns in temporäres Verzeichnis heruntergeladen\\n",
|
||||
"patterns_detected_old_path": "🔄 Alter Pattern-Pfad 'patterns' erkannt, versuche Migration zu 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "Warnung: Der temporäre Testordner '%s' konnte nicht entfernt werden: %v\\n",
|
||||
"patterns_found_new_path": "✅ %d Patterns im neuen Pfad '%s' gefunden, Konfiguration wird aktualisiert...\\n",
|
||||
"patterns_failed_move_test_patterns": "Fehler beim Verschieben der Test-Patterns in den temporären Ordner: %w",
|
||||
"patterns_unable_to_find_or_migrate": "Keine Patterns im aktuellen Pfad '%s' gefunden oder Migration auf neue Struktur fehlgeschlagen",
|
||||
"patterns_failed_read_directory": "Fehler beim Lesen des Pattern-Verzeichnisses: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 Auch Patterns aus dem benutzerdefinierten Verzeichnis aufgenommen: %s\\n",
|
||||
"patterns_warning_custom_directory": "Warnung: Benutzerdefiniertes Pattern-Verzeichnis %s konnte nicht gelesen werden: %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "Keine Patterns in den Verzeichnissen %s und %s gefunden",
|
||||
"patterns_no_patterns_found_in_directory": "Keine Patterns im Verzeichnis %s gefunden",
|
||||
"patterns_failed_write_unique_file": "Fehler beim Schreiben der Datei mit eindeutigen Patterns: %w",
|
||||
"patterns_unique_file_created": "📝 Datei mit eindeutigen Patterns mit %d Einträgen erstellt\\n",
|
||||
"patterns_no_patterns_copied": "Keine Patterns wurden erfolgreich nach %s kopiert",
|
||||
"patterns_failed_loaded_marker": "Marker-Datei '%s' konnte nicht erstellt werden: %w",
|
||||
"strategies_label": "Prompt-Strategien",
|
||||
"strategies_setup_description": "Strategien – lädt Prompt-Strategien herunter (z. B. Chain of Thought)",
|
||||
"strategies_git_repo_url_label": "Git Repo URL",
|
||||
"strategies_git_repo_url_question": "Geben Sie die Standard-Git-Repository-URL für die Strategien ein",
|
||||
"strategies_git_repo_folder_label": "Git Repo Strategien Ordner",
|
||||
"strategies_git_repo_folder_question": "Geben Sie den Standardordner im Git-Repository an, in dem Strategien gespeichert sind",
|
||||
"strategies_downloading": "Lade Strategien herunter und befülle %s...\\n",
|
||||
"strategies_download_success": "✅ Strategien erfolgreich nach %s heruntergeladen und installiert\\n",
|
||||
"strategies_home_dir_error": "Startverzeichnis konnte nicht ermittelt werden: %v",
|
||||
"strategies_failed_create_directory": "Strategie-Verzeichnis konnte nicht erstellt werden: %w",
|
||||
"strategies_cloning_repository": "Repository %s wird geklont (Pfad: %s)...\\n",
|
||||
"strategies_failed_download": "Fehler beim Herunterladen der Strategien: %w",
|
||||
"strategies_downloaded_count": "%d Strategien heruntergeladen\\n",
|
||||
"strategies_home_dir_fallback": "Startverzeichnis konnte nicht ermittelt werden: %v, verwende stattdessen aktuelles Verzeichnis",
|
||||
"strategy_not_found": "Strategie %s nicht gefunden. Führen Sie 'fabric --liststrategies' aus, um eine Liste zu erhalten",
|
||||
"strategies_none_found": "Keine Strategien gefunden. Führen Sie 'fabric --setup' aus, um Strategien herunterzuladen",
|
||||
"strategies_available_header": "Verfügbare Strategien:",
|
||||
"plugin_enter_value": "Geben Sie Ihren %v %v ein",
|
||||
"plugin_enable_bool_question": "%v %v aktivieren (true/false)",
|
||||
"plugin_setup_skipped": "[%v] übersprungen\\n",
|
||||
"plugin_question_bool": "%v%v (true/false, leer lassen für '%s' oder '%v' eingeben, um den Wert zu entfernen):",
|
||||
"plugin_question_with_default": "%v%v (leer lassen für '%s' oder '%v' eingeben, um den Wert zu entfernen):",
|
||||
"plugin_question_optional": "%v%v (leer lassen zum Überspringen):",
|
||||
"plugin_invalid_boolean_value": "Ungültiger Boolescher Wert: %v",
|
||||
"plugin_setting_not_valid": "%v=%v ist nicht gültig",
|
||||
"plugin_invalid_bool": "Ungültiger boolescher Wert: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "No %s",
|
||||
"no_description_available": "No description available",
|
||||
"i18n_download_failed": "Failed to download translation for language '%s': %v",
|
||||
"i18n_load_failed": "Failed to load translation file: %v"
|
||||
"i18n_load_failed": "Failed to load translation file: %v",
|
||||
"setup_welcome_header": "🎉 Welcome to Fabric! Let's get you set up.",
|
||||
"setup_step_downloading_patterns": "📥 Step 1: Downloading patterns (required for Fabric to work)...",
|
||||
"setup_step_downloading_strategies": "📥 Step 2: Downloading strategies (required for Fabric to work)...",
|
||||
"setup_step_configure_ai_provider": "🤖 Step 3: Configure an AI provider",
|
||||
"setup_ai_provider_required": "Fabric needs at least one AI provider to work.",
|
||||
"setup_add_more_providers_later": "You'll be able to add more providers later with 'fabric --setup'",
|
||||
"setup_step_setting_defaults": "⚙️ Step 4: Setting default vendor and model...",
|
||||
"setup_complete_header": "✅ Setup complete! You can now use Fabric.",
|
||||
"setup_next_steps": "Next steps:",
|
||||
"setup_list_patterns": "• List available patterns: fabric -l",
|
||||
"setup_try_pattern": "• Try a pattern: echo 'your text' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• Configure more settings: fabric --setup",
|
||||
"setup_failed_download_patterns": "failed to download patterns: %w",
|
||||
"setup_failed_download_strategies": "failed to download strategies: %w",
|
||||
"setup_failed_set_defaults": "failed to set default vendor and model: %w",
|
||||
"setup_no_ai_provider_selected": "no AI provider selected - at least one is required",
|
||||
"setup_invalid_selection": "invalid selection: %s",
|
||||
"setup_available_ai_providers": "Available AI Providers:",
|
||||
"setup_enter_ai_provider_number": "AI Provider Number",
|
||||
"setup_available_plugins": "Available plugins:",
|
||||
"setup_plugin_number": "Plugin Number",
|
||||
"setup_plugin_prompt": "Enter the number of the plugin to setup",
|
||||
"setup_required_configuration_header": "━━━ REQUIRED CONFIGURATION ━━━\n\nAI Vendors [at least one required]",
|
||||
"setup_required_tools": "Required Tools",
|
||||
"setup_optional_configuration_header": "━━━ OPTIONAL CONFIGURATION ━━━\n\nOptional Tools",
|
||||
"setup_validation_header": "Configuration Status:",
|
||||
"setup_validation_ai_provider_configured": "✓ AI Provider configured",
|
||||
"setup_validation_ai_provider_missing": "✗ AI Provider not configured - Required for Fabric to work",
|
||||
"setup_validation_defaults_configured": "✓ Default vendor/model set: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ Default vendor/model not set - Required for Fabric to work",
|
||||
"setup_validation_patterns_configured": "✓ Patterns downloaded",
|
||||
"setup_validation_patterns_missing": "✗ Patterns not found - Required for Fabric to work",
|
||||
"setup_validation_strategies_configured": "✓ Strategies downloaded",
|
||||
"setup_validation_strategies_missing": "✗ Strategies not found - Required for Fabric to work",
|
||||
"setup_validation_incomplete_warning": "⚠️ Setup incomplete! Missing required components.",
|
||||
"setup_validation_incomplete_help": "Run 'fabric --setup' again to configure missing items,\nor run 'fabric -U' to download patterns and strategies.",
|
||||
"setup_validation_complete": "✓ All required components configured!",
|
||||
"patterns_not_found_header": "⚠️ No patterns found!",
|
||||
"patterns_required_to_work": "Patterns are required for Fabric to work. To fix this:",
|
||||
"patterns_option_run_setup": "Option 1 (Recommended): Run setup to download patterns",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "Option 2: Download/update patterns directly",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "pattern '%s' not found.\n\nNo patterns are installed! To fix this:\n • Run 'fabric --setup' to configure and download patterns\n • Or run 'fabric -U' to download/update patterns directly",
|
||||
"pattern_not_found_list_available": "pattern '%s' not found. Run 'fabric -l' to see available patterns",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ NOT CONFIGURED",
|
||||
"defaults_setup_description": "Default AI Vendor and Model",
|
||||
"defaults_model_question": "Enter the index or the name of your default model",
|
||||
"defaults_model_context_length_question": "Enter model context length",
|
||||
"custom_patterns_label": "Custom Patterns",
|
||||
"custom_patterns_setup_description": "Custom Patterns - Set directory for your custom patterns",
|
||||
"custom_patterns_directory_question": "Enter the path to your custom patterns directory",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Jina AI Service - to grab a webpage as clean, LLM-friendly text",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - to grab video transcripts (via yt-dlp) and comments/metadata (via YouTube API)",
|
||||
"language_label": "Language",
|
||||
"language_setup_description": "Language - Default AI Vendor Output Language",
|
||||
"language_output_question": "Enter your default output language (for example: zh_CN)",
|
||||
"optional_marker": "(optional)",
|
||||
"required_marker": "[required]",
|
||||
"patterns_loader_label": "Patterns Loader",
|
||||
"patterns_setup_description": "Patterns - Downloads patterns",
|
||||
"patterns_git_repo_url_label": "Git Repo Url",
|
||||
"patterns_git_repo_url_question": "Enter the default Git repository URL for the patterns",
|
||||
"patterns_git_repo_folder_label": "Git Repo Patterns Folder",
|
||||
"patterns_git_repo_folder_question": "Enter the default folder in the Git repository where patterns are stored",
|
||||
"patterns_failed_create_temp_folder": "failed to create temporary patterns folder: %w",
|
||||
"patterns_downloading": "Downloading patterns and Populating %s...\n",
|
||||
"patterns_failed_download_from_git": "failed to download patterns from git repository: %w",
|
||||
"patterns_saving_updated_configuration": "💾 Saving updated configuration (path changed from '%s' to '%s')...\n",
|
||||
"patterns_failed_move_patterns": "failed to move patterns to config directory: %w",
|
||||
"patterns_download_success": "✅ Successfully downloaded and installed patterns to %s\n",
|
||||
"patterns_failed_unique_file": "failed to create unique patterns file: %w",
|
||||
"patterns_failed_access_directory": "failed to access patterns directory '%s': %w",
|
||||
"patterns_preserve_warning": "Warning: failed to preserve custom pattern '%s': %v\n",
|
||||
"patterns_preserved_custom_pattern": "Preserved custom pattern: %s\n",
|
||||
"patterns_failed_create_temp_dir": "failed to create temp directory: %w",
|
||||
"patterns_cloning_repository": "Cloning repository %s (path: %s)...\n",
|
||||
"patterns_failed_download_from_repo": "failed to download patterns from %s: %w",
|
||||
"patterns_failed_read_temp_directory": "failed to read temp patterns directory: %w",
|
||||
"patterns_no_patterns_migration_failed": "no patterns found in repository at path %s and migration failed: %w",
|
||||
"patterns_downloaded_temp": "Downloaded %d patterns to temporary directory\n",
|
||||
"patterns_detected_old_path": "🔄 Detected old pattern path 'patterns', trying migration to 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "Warning: failed to remove test temporary folder '%s': %v\n",
|
||||
"patterns_found_new_path": "✅ Found %d patterns at new path '%s', updating configuration...\n",
|
||||
"patterns_failed_move_test_patterns": "failed to move test patterns to temp folder: %w",
|
||||
"patterns_unable_to_find_or_migrate": "unable to find patterns at current path '%s' or migrate to new structure",
|
||||
"patterns_failed_read_directory": "failed to read patterns directory: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 Also included patterns from custom directory: %s\n",
|
||||
"patterns_warning_custom_directory": "Warning: Could not read custom patterns directory %s: %v\n",
|
||||
"patterns_no_patterns_found_in_directories": "no patterns found in directories %s and %s",
|
||||
"patterns_no_patterns_found_in_directory": "no patterns found in directory %s",
|
||||
"patterns_failed_write_unique_file": "failed to write unique patterns file: %w",
|
||||
"patterns_unique_file_created": "📝 Created unique patterns file with %d patterns\n",
|
||||
"patterns_no_patterns_copied": "no patterns were successfully copied to %s",
|
||||
"patterns_failed_loaded_marker": "failed to create loaded marker file '%s': %w",
|
||||
"strategies_label": "Prompt Strategies",
|
||||
"strategies_setup_description": "Strategies - Downloads Prompting Strategies (like chain of thought)",
|
||||
"strategies_git_repo_url_label": "Git Repo Url",
|
||||
"strategies_git_repo_url_question": "Enter the default Git repository URL for the strategies",
|
||||
"strategies_git_repo_folder_label": "Git Repo Strategies Folder",
|
||||
"strategies_git_repo_folder_question": "Enter the default folder in the Git repository where strategies are stored",
|
||||
"strategies_downloading": "Downloading strategies and Populating %s...\n",
|
||||
"strategies_download_success": "✅ Successfully downloaded and installed strategies to %s\n",
|
||||
"strategies_home_dir_error": "could not get home directory: %v",
|
||||
"strategies_failed_create_directory": "failed to create strategies directory: %w",
|
||||
"strategies_cloning_repository": "Cloning repository %s (path: %s)...\n",
|
||||
"strategies_failed_download": "failed to download strategies: %w",
|
||||
"strategies_downloaded_count": "Downloaded %d strategies\n",
|
||||
"strategies_home_dir_fallback": "could not get home directory: %v, using current directory instead",
|
||||
"strategy_not_found": "strategy %s not found. Please run 'fabric --liststrategies' for list",
|
||||
"strategies_none_found": "no strategies found. Please run 'fabric --setup' to download strategies",
|
||||
"strategies_available_header": "Available Strategies:",
|
||||
"plugin_enter_value": "Enter your %v %v",
|
||||
"plugin_enable_bool_question": "Enable %v %v (true/false)",
|
||||
"plugin_setup_skipped": "[%v] skipped\n",
|
||||
"plugin_question_bool": "%v%v (true/false, leave empty for '%s' or type '%v' to remove the value):",
|
||||
"plugin_question_with_default": "%v%v (leave empty for '%s' or type '%v' to remove the value):",
|
||||
"plugin_question_optional": "%v%v (leave empty to skip):",
|
||||
"plugin_invalid_boolean_value": "invalid boolean value: %v",
|
||||
"plugin_setting_not_valid": "%v=%v, is not valid",
|
||||
"plugin_invalid_bool": "invalid bool: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "No hay %s",
|
||||
"no_description_available": "No hay descripción disponible",
|
||||
"i18n_download_failed": "Error al descargar traducción para el idioma '%s': %v",
|
||||
"i18n_load_failed": "Error al cargar archivo de traducción: %v"
|
||||
"i18n_load_failed": "Error al cargar archivo de traducción: %v",
|
||||
"setup_welcome_header": "🎉 ¡Bienvenido a Fabric! Vamos a configurarte.",
|
||||
"setup_step_downloading_patterns": "📥 Paso 1: Descargando patrones (requeridos para que Fabric funcione)...",
|
||||
"setup_step_downloading_strategies": "📥 Paso 2: Descargando estrategias (requeridas para que Fabric funcione)...",
|
||||
"setup_step_configure_ai_provider": "🤖 Paso 3: Configurar un proveedor de IA",
|
||||
"setup_ai_provider_required": "Fabric necesita al menos un proveedor de IA para funcionar.",
|
||||
"setup_add_more_providers_later": "Podrás agregar más proveedores después con 'fabric --setup'",
|
||||
"setup_step_setting_defaults": "⚙️ Paso 4: Estableciendo proveedor y modelo predeterminados...",
|
||||
"setup_complete_header": "✅ ¡Configuración completa! Ya puedes usar Fabric.",
|
||||
"setup_next_steps": "Próximos pasos:",
|
||||
"setup_list_patterns": "• Listar patrones disponibles: fabric -l",
|
||||
"setup_try_pattern": "• Probar un patrón: echo 'tu texto' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• Configurar más opciones: fabric --setup",
|
||||
"setup_failed_download_patterns": "error al descargar patrones: %w",
|
||||
"setup_failed_download_strategies": "error al descargar estrategias: %w",
|
||||
"setup_failed_set_defaults": "error al establecer proveedor y modelo predeterminados: %w",
|
||||
"setup_no_ai_provider_selected": "no se seleccionó proveedor de IA - se requiere al menos uno",
|
||||
"setup_invalid_selection": "selección inválida: %s",
|
||||
"setup_available_ai_providers": "Proveedores de IA Disponibles:",
|
||||
"setup_enter_ai_provider_number": "Número de Proveedor de IA",
|
||||
"setup_available_plugins": "Plugins disponibles:",
|
||||
"setup_plugin_number": "Número de Plugin",
|
||||
"setup_plugin_prompt": "Introduce el número del plugin a configurar",
|
||||
"setup_required_configuration_header": "━━━ CONFIGURACIÓN REQUERIDA ━━━\n\nProveedores de IA [se requiere al menos uno]",
|
||||
"setup_required_tools": "Herramientas Requeridas",
|
||||
"setup_optional_configuration_header": "━━━ CONFIGURACIÓN OPCIONAL ━━━\n\nHerramientas Opcionales",
|
||||
"setup_validation_header": "Estado de Configuración:",
|
||||
"setup_validation_ai_provider_configured": "✓ Proveedor de IA configurado",
|
||||
"setup_validation_ai_provider_missing": "✗ Proveedor de IA no configurado - Requerido para que Fabric funcione",
|
||||
"setup_validation_defaults_configured": "✓ Proveedor/modelo predeterminado establecido: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ Proveedor/modelo predeterminado no establecido - Requerido para que Fabric funcione",
|
||||
"setup_validation_patterns_configured": "✓ Patrones descargados",
|
||||
"setup_validation_patterns_missing": "✗ Patrones no encontrados - Requeridos para que Fabric funcione",
|
||||
"setup_validation_strategies_configured": "✓ Estrategias descargadas",
|
||||
"setup_validation_strategies_missing": "✗ Estrategias no encontradas - Requeridas para que Fabric funcione",
|
||||
"setup_validation_incomplete_warning": "⚠️ ¡Configuración incompleta! Faltan componentes requeridos.",
|
||||
"setup_validation_incomplete_help": "Ejecuta 'fabric --setup' de nuevo para configurar los elementos faltantes,\no ejecuta 'fabric -U' para descargar patrones y estrategias.",
|
||||
"setup_validation_complete": "✓ ¡Todos los componentes requeridos configurados!",
|
||||
"patterns_not_found_header": "⚠️ ¡No se encontraron patrones!",
|
||||
"patterns_required_to_work": "Los patrones son requeridos para que Fabric funcione. Para solucionar esto:",
|
||||
"patterns_option_run_setup": "Opción 1 (Recomendada): Ejecutar configuración para descargar patrones",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "Opción 2: Descargar/actualizar patrones directamente",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "patrón '%s' no encontrado.\n\n¡No hay patrones instalados! Para solucionar esto:\n • Ejecuta 'fabric --setup' para configurar y descargar patrones\n • O ejecuta 'fabric -U' para descargar/actualizar patrones directamente",
|
||||
"pattern_not_found_list_available": "patrón '%s' no encontrado. Ejecuta 'fabric -l' para ver los patrones disponibles",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ NO CONFIGURADO",
|
||||
"defaults_setup_description": "Proveedor y modelo de IA predeterminados",
|
||||
"defaults_model_question": "Introduce el índice o el nombre de tu modelo predeterminado",
|
||||
"defaults_model_context_length_question": "Introduce la longitud del contexto del modelo",
|
||||
"custom_patterns_label": "Patrones personalizados",
|
||||
"custom_patterns_setup_description": "Patrones personalizados - Establecer directorio para tus patrones personalizados",
|
||||
"custom_patterns_directory_question": "Introduce la ruta a tu directorio de patrones personalizados",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Servicio Jina AI - para obtener una página web como texto limpio y compatible con LLM",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - para obtener transcripciones de video (vía yt-dlp) y comentarios/metadatos (vía API de YouTube)",
|
||||
"language_label": "Idioma",
|
||||
"language_setup_description": "Idioma - Idioma de salida predeterminado del proveedor de IA",
|
||||
"language_output_question": "Ingrese su idioma de salida predeterminado (por ejemplo: zh_CN)",
|
||||
"optional_marker": "(opcional)",
|
||||
"required_marker": "[obligatorio]",
|
||||
"patterns_loader_label": "Cargador de patrones",
|
||||
"patterns_setup_description": "Patrones - Descarga patrones",
|
||||
"patterns_git_repo_url_label": "URL del repositorio Git",
|
||||
"patterns_git_repo_url_question": "Introduce la URL predeterminada del repositorio Git para los patrones",
|
||||
"patterns_git_repo_folder_label": "Carpeta de patrones en el repositorio Git",
|
||||
"patterns_git_repo_folder_question": "Introduce la carpeta predeterminada en el repositorio Git donde se almacenan los patrones",
|
||||
"patterns_failed_create_temp_folder": "no se pudo crear la carpeta temporal de patrones: %w",
|
||||
"patterns_downloading": "Descargando patrones y llenando %s...\\n",
|
||||
"patterns_failed_download_from_git": "error al descargar patrones del repositorio Git: %w",
|
||||
"patterns_saving_updated_configuration": "💾 Guardando configuración actualizada (ruta cambiada de '%s' a '%s')...\\n",
|
||||
"patterns_failed_move_patterns": "error al mover los patrones al directorio de configuración: %w",
|
||||
"patterns_download_success": "✅ Patrones descargados e instalados correctamente en %s\\n",
|
||||
"patterns_failed_unique_file": "error al crear el archivo de patrones únicos: %w",
|
||||
"patterns_failed_access_directory": "error al acceder al directorio de patrones '%s': %w",
|
||||
"patterns_preserve_warning": "Advertencia: no se pudo conservar el patrón personalizado '%s': %v\\n",
|
||||
"patterns_preserved_custom_pattern": "Patrón personalizado conservado: %s\\n",
|
||||
"patterns_failed_create_temp_dir": "no se pudo crear el directorio temporal: %w",
|
||||
"patterns_cloning_repository": "Clonando el repositorio %s (ruta: %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "error al descargar patrones de %s: %w",
|
||||
"patterns_failed_read_temp_directory": "error al leer el directorio temporal de patrones: %w",
|
||||
"patterns_no_patterns_migration_failed": "no se encontraron patrones en el repositorio en la ruta %s y la migración falló: %w",
|
||||
"patterns_downloaded_temp": "Se descargaron %d patrones al directorio temporal\\n",
|
||||
"patterns_detected_old_path": "🔄 Se detectó la ruta antigua de patrones 'patterns', intentando migrar a 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "Advertencia: no se pudo eliminar la carpeta temporal de prueba '%s': %v\\n",
|
||||
"patterns_found_new_path": "✅ Se encontraron %d patrones en la nueva ruta '%s', actualizando configuración...\\n",
|
||||
"patterns_failed_move_test_patterns": "error al mover los patrones de prueba al directorio temporal: %w",
|
||||
"patterns_unable_to_find_or_migrate": "no se pudieron encontrar patrones en la ruta actual '%s' ni migrar a la nueva estructura",
|
||||
"patterns_failed_read_directory": "error al leer el directorio de patrones: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 También se incluyeron patrones del directorio personalizado: %s\\n",
|
||||
"patterns_warning_custom_directory": "Advertencia: no se pudo leer el directorio de patrones personalizado %s: %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "no se encontraron patrones en los directorios %s y %s",
|
||||
"patterns_no_patterns_found_in_directory": "no se encontraron patrones en el directorio %s",
|
||||
"patterns_failed_write_unique_file": "error al escribir el archivo de patrones únicos: %w",
|
||||
"patterns_unique_file_created": "📝 Archivo de patrones únicos creado con %d patrones\\n",
|
||||
"patterns_no_patterns_copied": "no se copiaron patrones correctamente en %s",
|
||||
"patterns_failed_loaded_marker": "no se pudo crear el archivo indicador '%s': %w",
|
||||
"strategies_label": "Estrategias de prompts",
|
||||
"strategies_setup_description": "Estrategias - Descarga estrategias de prompting (como chain of thought)",
|
||||
"strategies_git_repo_url_label": "URL del repositorio Git",
|
||||
"strategies_git_repo_url_question": "Introduce la URL predeterminada del repositorio Git para las estrategias",
|
||||
"strategies_git_repo_folder_label": "Carpeta de estrategias en el repositorio Git",
|
||||
"strategies_git_repo_folder_question": "Introduce la carpeta predeterminada en el repositorio Git donde se almacenan las estrategias",
|
||||
"strategies_downloading": "Descargando estrategias y llenando %s...\\n",
|
||||
"strategies_download_success": "✅ Estrategias descargadas e instaladas correctamente en %s\\n",
|
||||
"strategies_home_dir_error": "no se pudo obtener el directorio personal: %v",
|
||||
"strategies_failed_create_directory": "no se pudo crear el directorio de estrategias: %w",
|
||||
"strategies_cloning_repository": "Clonando el repositorio %s (ruta: %s)...\\n",
|
||||
"strategies_failed_download": "error al descargar estrategias: %w",
|
||||
"strategies_downloaded_count": "Se descargaron %d estrategias\\n",
|
||||
"strategies_home_dir_fallback": "no se pudo obtener el directorio personal: %v, usando el directorio actual en su lugar",
|
||||
"strategy_not_found": "estrategia %s no encontrada. Ejecuta 'fabric --liststrategies' para ver la lista",
|
||||
"strategies_none_found": "no se encontraron estrategias. Ejecuta 'fabric --setup' para descargar estrategias",
|
||||
"strategies_available_header": "Estrategias disponibles:",
|
||||
"plugin_enter_value": "Introduce tu %v %v",
|
||||
"plugin_enable_bool_question": "Habilitar %v %v (true/false)",
|
||||
"plugin_setup_skipped": "[%v] omitido\\n",
|
||||
"plugin_question_bool": "%v%v (true/false, deja vacío para '%s' o escribe '%v' para eliminar el valor):",
|
||||
"plugin_question_with_default": "%v%v (deja vacío para '%s' o escribe '%v' para eliminar el valor):",
|
||||
"plugin_question_optional": "%v%v (deja vacío para omitir):",
|
||||
"plugin_invalid_boolean_value": "valor booleano no válido: %v",
|
||||
"plugin_setting_not_valid": "%v=%v no es válido",
|
||||
"plugin_invalid_bool": "bool no válido: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "هیچ %s",
|
||||
"no_description_available": "توضیحی در دسترس نیست",
|
||||
"i18n_download_failed": "دانلود ترجمه برای زبان '%s' ناموفق بود: %v",
|
||||
"i18n_load_failed": "بارگذاری فایل ترجمه ناموفق بود: %v"
|
||||
"i18n_load_failed": "بارگذاری فایل ترجمه ناموفق بود: %v",
|
||||
"setup_welcome_header": "🎉 به Fabric خوش آمدید! بیایید تنظیمات را انجام دهیم.",
|
||||
"setup_step_downloading_patterns": "📥 مرحله ۱: دانلود الگوها (برای کار Fabric ضروری است)...",
|
||||
"setup_step_downloading_strategies": "📥 مرحله ۲: دانلود استراتژیها (برای کار Fabric ضروری است)...",
|
||||
"setup_step_configure_ai_provider": "🤖 مرحله ۳: پیکربندی یک ارائهدهنده هوش مصنوعی",
|
||||
"setup_ai_provider_required": "Fabric برای کار کردن به حداقل یک ارائهدهنده هوش مصنوعی نیاز دارد.",
|
||||
"setup_add_more_providers_later": "میتوانید بعداً با 'fabric --setup' ارائهدهندگان بیشتری اضافه کنید",
|
||||
"setup_step_setting_defaults": "⚙️ مرحله ۴: تنظیم ارائهدهنده و مدل پیشفرض...",
|
||||
"setup_complete_header": "✅ تنظیمات کامل شد! اکنون میتوانید از Fabric استفاده کنید.",
|
||||
"setup_next_steps": "مراحل بعدی:",
|
||||
"setup_list_patterns": "• نمایش الگوهای موجود: fabric -l",
|
||||
"setup_try_pattern": "• امتحان یک الگو: echo 'متن شما' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• پیکربندی تنظیمات بیشتر: fabric --setup",
|
||||
"setup_failed_download_patterns": "دانلود الگوها ناموفق بود: %w",
|
||||
"setup_failed_download_strategies": "دانلود استراتژیها ناموفق بود: %w",
|
||||
"setup_failed_set_defaults": "تنظیم ارائهدهنده و مدل پیشفرض ناموفق بود: %w",
|
||||
"setup_no_ai_provider_selected": "هیچ ارائهدهنده هوش مصنوعی انتخاب نشده - حداقل یکی ضروری است",
|
||||
"setup_invalid_selection": "انتخاب نامعتبر: %s",
|
||||
"setup_available_ai_providers": "ارائهدهندگان هوش مصنوعی موجود:",
|
||||
"setup_enter_ai_provider_number": "شماره ارائهدهنده هوش مصنوعی",
|
||||
"setup_available_plugins": "افزونههای موجود:",
|
||||
"setup_plugin_number": "شماره افزونه",
|
||||
"setup_plugin_prompt": "شماره افزونهای را که میخواهید راهاندازی کنید وارد کنید",
|
||||
"setup_required_configuration_header": "━━━ پیکربندی ضروری ━━━\n\nارائهدهندگان هوش مصنوعی [حداقل یکی ضروری است]",
|
||||
"setup_required_tools": "ابزارهای ضروری",
|
||||
"setup_optional_configuration_header": "━━━ پیکربندی اختیاری ━━━\n\nابزارهای اختیاری",
|
||||
"setup_validation_header": "وضعیت پیکربندی:",
|
||||
"setup_validation_ai_provider_configured": "✓ ارائهدهنده هوش مصنوعی پیکربندی شده",
|
||||
"setup_validation_ai_provider_missing": "✗ ارائهدهنده هوش مصنوعی پیکربندی نشده - برای کار Fabric ضروری است",
|
||||
"setup_validation_defaults_configured": "✓ ارائهدهنده/مدل پیشفرض تنظیم شده: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ ارائهدهنده/مدل پیشفرض تنظیم نشده - برای کار Fabric ضروری است",
|
||||
"setup_validation_patterns_configured": "✓ الگوها دانلود شده",
|
||||
"setup_validation_patterns_missing": "✗ الگوها یافت نشد - برای کار Fabric ضروری است",
|
||||
"setup_validation_strategies_configured": "✓ استراتژیها دانلود شده",
|
||||
"setup_validation_strategies_missing": "✗ استراتژیها یافت نشد - برای کار Fabric ضروری است",
|
||||
"setup_validation_incomplete_warning": "⚠️ تنظیمات ناقص! اجزای ضروری وجود ندارند.",
|
||||
"setup_validation_incomplete_help": "دوباره 'fabric --setup' را اجرا کنید تا موارد ناقص را پیکربندی کنید،\nیا 'fabric -U' را برای دانلود الگوها و استراتژیها اجرا کنید.",
|
||||
"setup_validation_complete": "✓ تمام اجزای ضروری پیکربندی شدهاند!",
|
||||
"patterns_not_found_header": "⚠️ هیچ الگویی یافت نشد!",
|
||||
"patterns_required_to_work": "الگوها برای کار Fabric ضروری هستند. برای رفع این مشکل:",
|
||||
"patterns_option_run_setup": "گزینه ۱ (توصیه شده): اجرای تنظیمات برای دانلود الگوها",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "گزینه ۲: دانلود/بهروزرسانی مستقیم الگوها",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "الگوی '%s' یافت نشد.\n\nهیچ الگویی نصب نشده است! برای رفع این مشکل:\n • 'fabric --setup' را برای پیکربندی و دانلود الگوها اجرا کنید\n • یا 'fabric -U' را برای دانلود/بهروزرسانی الگوها اجرا کنید",
|
||||
"pattern_not_found_list_available": "الگوی '%s' یافت نشد. برای مشاهده الگوهای موجود 'fabric -l' را اجرا کنید",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ پیکربندی نشده",
|
||||
"defaults_setup_description": "ارائهدهنده و مدل هوش مصنوعی پیشفرض",
|
||||
"defaults_model_question": "شاخص یا نام مدل پیشفرض خود را وارد کنید",
|
||||
"defaults_model_context_length_question": "طول زمینه مدل را وارد کنید",
|
||||
"custom_patterns_label": "الگوهای سفارشی",
|
||||
"custom_patterns_setup_description": "الگوهای سفارشی - تنظیم دایرکتوری برای الگوهای سفارشی شما",
|
||||
"custom_patterns_directory_question": "مسیر دایرکتوری الگوهای سفارشی خود را وارد کنید",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "سرویس Jina AI - برای دریافت صفحه وب بهصورت متن تمیز و سازگار با LLM",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - برای دریافت رونوشت ویدیو (از طریق yt-dlp) و نظرات/متادیتا (از طریق API یوتیوب)",
|
||||
"language_label": "زبان",
|
||||
"language_setup_description": "زبان - زبان خروجی پیشفرض ارائهدهنده هوش مصنوعی",
|
||||
"language_output_question": "زبان خروجی پیشفرض خود را وارد کنید (به عنوان مثال: zh_CN)",
|
||||
"optional_marker": "(اختیاری)",
|
||||
"required_marker": "[الزامی]",
|
||||
"patterns_loader_label": "بارگذار الگوها",
|
||||
"patterns_setup_description": "الگوها - دانلود الگوها",
|
||||
"patterns_git_repo_url_label": "آدرس مخزن گیت",
|
||||
"patterns_git_repo_url_question": "آدرس مخزن گیت پیشفرض برای الگوها را وارد کنید",
|
||||
"patterns_git_repo_folder_label": "پوشه الگوها در مخزن گیت",
|
||||
"patterns_git_repo_folder_question": "پوشه پیشفرض در مخزن گیت که الگوها در آن ذخیره میشوند را وارد کنید",
|
||||
"patterns_failed_create_temp_folder": "ایجاد پوشه موقت الگوها ناموفق بود: %w",
|
||||
"patterns_downloading": "در حال دانلود الگوها و پر کردن %s...\\n",
|
||||
"patterns_failed_download_from_git": "دانلود الگوها از مخزن گیت ناموفق بود: %w",
|
||||
"patterns_saving_updated_configuration": "💾 ذخیره پیکربندی بهروزشده (مسیر از '%s' به '%s' تغییر کرد)...\\n",
|
||||
"patterns_failed_move_patterns": "انتقال الگوها به شاخه پیکربندی ناموفق بود: %w",
|
||||
"patterns_download_success": "✅ الگوها با موفقیت در %s دانلود و نصب شدند\\n",
|
||||
"patterns_failed_unique_file": "ایجاد فایل الگوهای یکتا ناموفق بود: %w",
|
||||
"patterns_failed_access_directory": "دسترسی به پوشه الگو '%s' ناموفق بود: %w",
|
||||
"patterns_preserve_warning": "هشدار: الگوی سفارشی '%s' حفظ نشد: %v\\n",
|
||||
"patterns_preserved_custom_pattern": "الگوی سفارشی حفظ شد: %s\\n",
|
||||
"patterns_failed_create_temp_dir": "ایجاد پوشه موقت ناموفق بود: %w",
|
||||
"patterns_cloning_repository": "در حال کلون کردن مخزن %s (مسیر: %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "دانلود الگوها از %s ناموفق بود: %w",
|
||||
"patterns_failed_read_temp_directory": "خواندن پوشه موقت الگوها ناموفق بود: %w",
|
||||
"patterns_no_patterns_migration_failed": "هیچ الگویی در مخزن با مسیر %s یافت نشد و مهاجرت هم ناموفق بود: %w",
|
||||
"patterns_downloaded_temp": "%d الگو در پوشه موقت دانلود شد\\n",
|
||||
"patterns_detected_old_path": "🔄 مسیر قدیمی الگو 'patterns' شناسایی شد، تلاش برای مهاجرت به 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "هشدار: پوشه موقت آزمایشی '%s' حذف نشد: %v\\n",
|
||||
"patterns_found_new_path": "✅ %d الگو در مسیر جدید '%s' پیدا شد، پیکربندی بهروزرسانی میشود...\\n",
|
||||
"patterns_failed_move_test_patterns": "انتقال الگوهای آزمایشی به پوشه موقت ناموفق بود: %w",
|
||||
"patterns_unable_to_find_or_migrate": "الگویی در مسیر فعلی '%s' یافت نشد یا مهاجرت به ساختار جدید ممکن نبود",
|
||||
"patterns_failed_read_directory": "خواندن پوشه الگوها ناموفق بود: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 الگوهای پوشه سفارشی نیز اضافه شد: %s\\n",
|
||||
"patterns_warning_custom_directory": "هشدار: پوشه الگوی سفارشی %s قابل خواندن نیست: %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "هیچ الگویی در پوشههای %s و %s پیدا نشد",
|
||||
"patterns_no_patterns_found_in_directory": "هیچ الگویی در پوشه %s پیدا نشد",
|
||||
"patterns_failed_write_unique_file": "نوشتن فایل الگوهای یکتا ناموفق بود: %w",
|
||||
"patterns_unique_file_created": "📝 فایل الگوهای یکتا با %d الگو ایجاد شد\\n",
|
||||
"patterns_no_patterns_copied": "هیچ الگویی با موفقیت به %s کپی نشد",
|
||||
"patterns_failed_loaded_marker": "ایجاد فایل نشانه '%s' ناموفق بود: %w",
|
||||
"strategies_label": "راهبردهای پرامپت",
|
||||
"strategies_setup_description": "راهبردها - دانلود راهبردهای پرامپت (مثل chain of thought)",
|
||||
"strategies_git_repo_url_label": "آدرس مخزن گیت",
|
||||
"strategies_git_repo_url_question": "آدرس مخزن گیت پیشفرض برای راهبردها را وارد کنید",
|
||||
"strategies_git_repo_folder_label": "پوشه راهبردها در مخزن گیت",
|
||||
"strategies_git_repo_folder_question": "پوشه پیشفرض در مخزن گیت که راهبردها در آن ذخیره میشوند را وارد کنید",
|
||||
"strategies_downloading": "در حال دانلود راهبردها و پر کردن %s...\\n",
|
||||
"strategies_download_success": "✅ راهبردها با موفقیت در %s دانلود و نصب شدند\\n",
|
||||
"strategies_home_dir_error": "دریافت پوشه خانگی ممکن نبود: %v",
|
||||
"strategies_failed_create_directory": "ایجاد پوشه راهبردها ناموفق بود: %w",
|
||||
"strategies_cloning_repository": "در حال کلون کردن مخزن %s (مسیر: %s)...\\n",
|
||||
"strategies_failed_download": "دانلود راهبردها ناموفق بود: %w",
|
||||
"strategies_downloaded_count": "%d راهبرد دانلود شد\\n",
|
||||
"strategies_home_dir_fallback": "دریافت پوشه خانگی ممکن نبود: %v، از پوشه فعلی استفاده میشود",
|
||||
"strategy_not_found": "راهبرد %s یافت نشد. برای مشاهده فهرست 'fabric --liststrategies' را اجرا کنید",
|
||||
"strategies_none_found": "هیچ راهبردی پیدا نشد. برای دانلود راهبردها 'fabric --setup' را اجرا کنید",
|
||||
"strategies_available_header": "راهبردهای موجود:",
|
||||
"plugin_enter_value": "مقدار %v %v خود را وارد کنید",
|
||||
"plugin_enable_bool_question": "%v %v را فعال کنید (true/false)",
|
||||
"plugin_setup_skipped": "[%v] رد شد\\n",
|
||||
"plugin_question_bool": "%v%v (true/false، برای '%s' خالی بگذارید یا '%v' را برای حذف مقدار بنویسید):",
|
||||
"plugin_question_with_default": "%v%v (برای '%s' خالی بگذارید یا '%v' را برای حذف مقدار بنویسید):",
|
||||
"plugin_question_optional": "%v%v (برای رد کردن خالی بگذارید):",
|
||||
"plugin_invalid_boolean_value": "مقدار بولی نامعتبر: %v",
|
||||
"plugin_setting_not_valid": "%v=%v معتبر نیست",
|
||||
"plugin_invalid_bool": "مقدار bool نامعتبر: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "Aucun %s",
|
||||
"no_description_available": "Aucune description disponible",
|
||||
"i18n_download_failed": "Échec du téléchargement de la traduction pour la langue '%s' : %v",
|
||||
"i18n_load_failed": "Échec du chargement du fichier de traduction : %v"
|
||||
"i18n_load_failed": "Échec du chargement du fichier de traduction : %v",
|
||||
"setup_welcome_header": "🎉 Bienvenue sur Fabric ! Configurons votre installation.",
|
||||
"setup_step_downloading_patterns": "📥 Étape 1 : Téléchargement des modèles (requis pour le fonctionnement de Fabric)...",
|
||||
"setup_step_downloading_strategies": "📥 Étape 2 : Téléchargement des stratégies (requis pour le fonctionnement de Fabric)...",
|
||||
"setup_step_configure_ai_provider": "🤖 Étape 3 : Configurer un fournisseur d'IA",
|
||||
"setup_ai_provider_required": "Fabric a besoin d'au moins un fournisseur d'IA pour fonctionner.",
|
||||
"setup_add_more_providers_later": "Vous pourrez ajouter d'autres fournisseurs plus tard avec 'fabric --setup'",
|
||||
"setup_step_setting_defaults": "⚙️ Étape 4 : Configuration du fournisseur et du modèle par défaut...",
|
||||
"setup_complete_header": "✅ Configuration terminée ! Vous pouvez maintenant utiliser Fabric.",
|
||||
"setup_next_steps": "Prochaines étapes :",
|
||||
"setup_list_patterns": "• Lister les modèles disponibles : fabric -l",
|
||||
"setup_try_pattern": "• Essayer un modèle : echo 'votre texte' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• Configurer plus de paramètres : fabric --setup",
|
||||
"setup_failed_download_patterns": "échec du téléchargement des modèles : %w",
|
||||
"setup_failed_download_strategies": "échec du téléchargement des stratégies : %w",
|
||||
"setup_failed_set_defaults": "échec de la configuration du fournisseur et du modèle par défaut : %w",
|
||||
"setup_no_ai_provider_selected": "aucun fournisseur d'IA sélectionné - au moins un est requis",
|
||||
"setup_invalid_selection": "sélection invalide : %s",
|
||||
"setup_available_ai_providers": "Fournisseurs d'IA disponibles :",
|
||||
"setup_enter_ai_provider_number": "Numéro du fournisseur d'IA",
|
||||
"setup_available_plugins": "Plugins disponibles :",
|
||||
"setup_plugin_number": "Numéro du plugin",
|
||||
"setup_plugin_prompt": "Entrez le numéro du plugin à configurer",
|
||||
"setup_required_configuration_header": "━━━ CONFIGURATION REQUISE ━━━\n\nFournisseurs d'IA [au moins un requis]",
|
||||
"setup_required_tools": "Outils requis",
|
||||
"setup_optional_configuration_header": "━━━ CONFIGURATION OPTIONNELLE ━━━\n\nOutils optionnels",
|
||||
"setup_validation_header": "État de la configuration :",
|
||||
"setup_validation_ai_provider_configured": "✓ Fournisseur d'IA configuré",
|
||||
"setup_validation_ai_provider_missing": "✗ Fournisseur d'IA non configuré - Requis pour le fonctionnement de Fabric",
|
||||
"setup_validation_defaults_configured": "✓ Fournisseur/modèle par défaut défini : %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ Fournisseur/modèle par défaut non défini - Requis pour le fonctionnement de Fabric",
|
||||
"setup_validation_patterns_configured": "✓ Modèles téléchargés",
|
||||
"setup_validation_patterns_missing": "✗ Modèles non trouvés - Requis pour le fonctionnement de Fabric",
|
||||
"setup_validation_strategies_configured": "✓ Stratégies téléchargées",
|
||||
"setup_validation_strategies_missing": "✗ Stratégies non trouvées - Requises pour le fonctionnement de Fabric",
|
||||
"setup_validation_incomplete_warning": "⚠️ Configuration incomplète ! Composants requis manquants.",
|
||||
"setup_validation_incomplete_help": "Exécutez à nouveau 'fabric --setup' pour configurer les éléments manquants,\nou exécutez 'fabric -U' pour télécharger les modèles et stratégies.",
|
||||
"setup_validation_complete": "✓ Tous les composants requis sont configurés !",
|
||||
"patterns_not_found_header": "⚠️ Aucun modèle trouvé !",
|
||||
"patterns_required_to_work": "Les modèles sont requis pour le fonctionnement de Fabric. Pour résoudre ce problème :",
|
||||
"patterns_option_run_setup": "Option 1 (Recommandée) : Exécuter la configuration pour télécharger les modèles",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "Option 2 : Télécharger/mettre à jour les modèles directement",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "modèle '%s' non trouvé.\n\nAucun modèle n'est installé ! Pour résoudre ce problème :\n • Exécutez 'fabric --setup' pour configurer et télécharger les modèles\n • Ou exécutez 'fabric -U' pour télécharger/mettre à jour les modèles directement",
|
||||
"pattern_not_found_list_available": "modèle '%s' non trouvé. Exécutez 'fabric -l' pour voir les modèles disponibles",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ NON CONFIGURÉ",
|
||||
"defaults_setup_description": "Fournisseur et modèle d'IA par défaut",
|
||||
"defaults_model_question": "Saisissez l'index ou le nom de votre modèle par défaut",
|
||||
"defaults_model_context_length_question": "Saisissez la longueur du contexte du modèle",
|
||||
"custom_patterns_label": "Patrons personnalisés",
|
||||
"custom_patterns_setup_description": "Patrons personnalisés - Définir le répertoire pour vos patrons personnalisés",
|
||||
"custom_patterns_directory_question": "Saisissez le chemin vers votre répertoire de patrons personnalisés",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Service Jina AI - pour récupérer une page web sous forme de texte propre et compatible LLM",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - pour récupérer les transcriptions vidéo (via yt-dlp) et les commentaires/métadonnées (via l'API YouTube)",
|
||||
"language_label": "Langue",
|
||||
"language_setup_description": "Langue - Langue de sortie par défaut du fournisseur d'IA",
|
||||
"language_output_question": "Entrez votre langue de sortie par défaut (par exemple : zh_CN)",
|
||||
"optional_marker": "(optionnel)",
|
||||
"required_marker": "[obligatoire]",
|
||||
"patterns_loader_label": "Chargeur de patrons",
|
||||
"patterns_setup_description": "Patrons - Télécharge les patrons",
|
||||
"patterns_git_repo_url_label": "URL du dépôt Git",
|
||||
"patterns_git_repo_url_question": "Saisissez l'URL du dépôt Git par défaut pour les patrons",
|
||||
"patterns_git_repo_folder_label": "Dossier des patrons dans le dépôt Git",
|
||||
"patterns_git_repo_folder_question": "Saisissez le dossier par défaut du dépôt Git où sont stockés les patrons",
|
||||
"patterns_failed_create_temp_folder": "impossible de créer le dossier temporaire des patrons : %w",
|
||||
"patterns_downloading": "Téléchargement des patrons et remplissage de %s...\\n",
|
||||
"patterns_failed_download_from_git": "échec du téléchargement des patrons depuis le dépôt Git : %w",
|
||||
"patterns_saving_updated_configuration": "💾 Enregistrement de la configuration mise à jour (chemin changé de '%s' à '%s')...\\n",
|
||||
"patterns_failed_move_patterns": "échec du déplacement des patrons vers le répertoire de configuration : %w",
|
||||
"patterns_download_success": "✅ Patrons téléchargés et installés avec succès dans %s\\n",
|
||||
"patterns_failed_unique_file": "échec de création du fichier de patrons uniques : %w",
|
||||
"patterns_failed_access_directory": "impossible d'accéder au répertoire des patrons '%s' : %w",
|
||||
"patterns_preserve_warning": "Avertissement : impossible de conserver le patron personnalisé '%s' : %v\\n",
|
||||
"patterns_preserved_custom_pattern": "Patron personnalisé conservé : %s\\n",
|
||||
"patterns_failed_create_temp_dir": "impossible de créer le répertoire temporaire : %w",
|
||||
"patterns_cloning_repository": "Clonage du dépôt %s (chemin : %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "échec du téléchargement des patrons depuis %s : %w",
|
||||
"patterns_failed_read_temp_directory": "échec de lecture du répertoire temporaire des patrons : %w",
|
||||
"patterns_no_patterns_migration_failed": "aucun patron trouvé dans le dépôt au chemin %s et la migration a échoué : %w",
|
||||
"patterns_downloaded_temp": "%d patrons téléchargés dans le répertoire temporaire\\n",
|
||||
"patterns_detected_old_path": "🔄 Ancien chemin 'patterns' détecté, tentative de migration vers 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "Avertissement : impossible de supprimer le dossier temporaire de test '%s' : %v\\n",
|
||||
"patterns_found_new_path": "✅ %d patrons trouvés au nouveau chemin '%s', mise à jour de la configuration...\\n",
|
||||
"patterns_failed_move_test_patterns": "échec du déplacement des patrons de test vers le dossier temporaire : %w",
|
||||
"patterns_unable_to_find_or_migrate": "impossible de trouver des patrons au chemin actuel '%s' ou de migrer vers la nouvelle structure",
|
||||
"patterns_failed_read_directory": "échec de lecture du répertoire des patrons : %w",
|
||||
"patterns_debug_included_custom_directory": "📂 Patrons du répertoire personnalisé également inclus : %s\\n",
|
||||
"patterns_warning_custom_directory": "Avertissement : impossible de lire le répertoire de patrons personnalisé %s : %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "aucun patron trouvé dans les répertoires %s et %s",
|
||||
"patterns_no_patterns_found_in_directory": "aucun patron trouvé dans le répertoire %s",
|
||||
"patterns_failed_write_unique_file": "échec d'écriture du fichier de patrons uniques : %w",
|
||||
"patterns_unique_file_created": "📝 Fichier de patrons uniques créé avec %d patrons\\n",
|
||||
"patterns_no_patterns_copied": "aucun patron n'a été copié avec succès vers %s",
|
||||
"patterns_failed_loaded_marker": "impossible de créer le fichier indicateur '%s' : %w",
|
||||
"strategies_label": "Stratégies de prompt",
|
||||
"strategies_setup_description": "Stratégies - Télécharge des stratégies de prompting (comme chain of thought)",
|
||||
"strategies_git_repo_url_label": "URL du dépôt Git",
|
||||
"strategies_git_repo_url_question": "Saisissez l'URL du dépôt Git par défaut pour les stratégies",
|
||||
"strategies_git_repo_folder_label": "Dossier des stratégies dans le dépôt Git",
|
||||
"strategies_git_repo_folder_question": "Saisissez le dossier par défaut du dépôt Git où sont stockées les stratégies",
|
||||
"strategies_downloading": "Téléchargement des stratégies et remplissage de %s...\\n",
|
||||
"strategies_download_success": "✅ Stratégies téléchargées et installées avec succès dans %s\\n",
|
||||
"strategies_home_dir_error": "impossible d'obtenir le répertoire personnel : %v",
|
||||
"strategies_failed_create_directory": "échec de création du répertoire des stratégies : %w",
|
||||
"strategies_cloning_repository": "Clonage du dépôt %s (chemin : %s)...\\n",
|
||||
"strategies_failed_download": "échec du téléchargement des stratégies : %w",
|
||||
"strategies_downloaded_count": "%d stratégies téléchargées\\n",
|
||||
"strategies_home_dir_fallback": "impossible d'obtenir le répertoire personnel : %v, utilisation du répertoire courant à la place",
|
||||
"strategy_not_found": "stratégie %s introuvable. Exécutez 'fabric --liststrategies' pour voir la liste",
|
||||
"strategies_none_found": "aucune stratégie trouvée. Exécutez 'fabric --setup' pour télécharger les stratégies",
|
||||
"strategies_available_header": "Stratégies disponibles :",
|
||||
"plugin_enter_value": "Saisissez votre %v %v",
|
||||
"plugin_enable_bool_question": "Activer %v %v (true/false)",
|
||||
"plugin_setup_skipped": "[%v] ignoré\\n",
|
||||
"plugin_question_bool": "%v%v (true/false, laissez vide pour '%s' ou tapez '%v' pour supprimer la valeur) :",
|
||||
"plugin_question_with_default": "%v%v (laissez vide pour '%s' ou tapez '%v' pour supprimer la valeur) :",
|
||||
"plugin_question_optional": "%v%v (laissez vide pour passer) :",
|
||||
"plugin_invalid_boolean_value": "valeur booléenne invalide : %v",
|
||||
"plugin_setting_not_valid": "%v=%v n'est pas valide",
|
||||
"plugin_invalid_bool": "booléen invalide : %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "Nessun %s",
|
||||
"no_description_available": "Nessuna descrizione disponibile",
|
||||
"i18n_download_failed": "Fallito il download della traduzione per la lingua '%s': %v",
|
||||
"i18n_load_failed": "Fallito il caricamento del file di traduzione: %v"
|
||||
"i18n_load_failed": "Fallito il caricamento del file di traduzione: %v",
|
||||
"setup_welcome_header": "🎉 Benvenuto su Fabric! Configuriamo tutto.",
|
||||
"setup_step_downloading_patterns": "📥 Passo 1: Download dei pattern (richiesti per il funzionamento di Fabric)...",
|
||||
"setup_step_downloading_strategies": "📥 Passo 2: Download delle strategie (richieste per il funzionamento di Fabric)...",
|
||||
"setup_step_configure_ai_provider": "🤖 Passo 3: Configura un fornitore di IA",
|
||||
"setup_ai_provider_required": "Fabric necessita di almeno un fornitore di IA per funzionare.",
|
||||
"setup_add_more_providers_later": "Potrai aggiungere altri fornitori in seguito con 'fabric --setup'",
|
||||
"setup_step_setting_defaults": "⚙️ Passo 4: Impostazione del fornitore e del modello predefiniti...",
|
||||
"setup_complete_header": "✅ Configurazione completata! Ora puoi usare Fabric.",
|
||||
"setup_next_steps": "Prossimi passi:",
|
||||
"setup_list_patterns": "• Elenca i pattern disponibili: fabric -l",
|
||||
"setup_try_pattern": "• Prova un pattern: echo 'il tuo testo' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• Configura altre impostazioni: fabric --setup",
|
||||
"setup_failed_download_patterns": "download dei pattern fallito: %w",
|
||||
"setup_failed_download_strategies": "download delle strategie fallito: %w",
|
||||
"setup_failed_set_defaults": "impostazione del fornitore e del modello predefiniti fallita: %w",
|
||||
"setup_no_ai_provider_selected": "nessun fornitore di IA selezionato - almeno uno è richiesto",
|
||||
"setup_invalid_selection": "selezione non valida: %s",
|
||||
"setup_available_ai_providers": "Fornitori di IA disponibili:",
|
||||
"setup_enter_ai_provider_number": "Numero del fornitore di IA",
|
||||
"setup_available_plugins": "Plugin disponibili:",
|
||||
"setup_plugin_number": "Numero del plugin",
|
||||
"setup_plugin_prompt": "Inserisci il numero del plugin da configurare",
|
||||
"setup_required_configuration_header": "━━━ CONFIGURAZIONE RICHIESTA ━━━\n\nFornitori di IA [almeno uno richiesto]",
|
||||
"setup_required_tools": "Strumenti richiesti",
|
||||
"setup_optional_configuration_header": "━━━ CONFIGURAZIONE OPZIONALE ━━━\n\nStrumenti opzionali",
|
||||
"setup_validation_header": "Stato della configurazione:",
|
||||
"setup_validation_ai_provider_configured": "✓ Fornitore di IA configurato",
|
||||
"setup_validation_ai_provider_missing": "✗ Fornitore di IA non configurato - Richiesto per il funzionamento di Fabric",
|
||||
"setup_validation_defaults_configured": "✓ Fornitore/modello predefinito impostato: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ Fornitore/modello predefinito non impostato - Richiesto per il funzionamento di Fabric",
|
||||
"setup_validation_patterns_configured": "✓ Pattern scaricati",
|
||||
"setup_validation_patterns_missing": "✗ Pattern non trovati - Richiesti per il funzionamento di Fabric",
|
||||
"setup_validation_strategies_configured": "✓ Strategie scaricate",
|
||||
"setup_validation_strategies_missing": "✗ Strategie non trovate - Richieste per il funzionamento di Fabric",
|
||||
"setup_validation_incomplete_warning": "⚠️ Configurazione incompleta! Componenti richiesti mancanti.",
|
||||
"setup_validation_incomplete_help": "Esegui di nuovo 'fabric --setup' per configurare gli elementi mancanti,\noppure esegui 'fabric -U' per scaricare pattern e strategie.",
|
||||
"setup_validation_complete": "✓ Tutti i componenti richiesti sono configurati!",
|
||||
"patterns_not_found_header": "⚠️ Nessun pattern trovato!",
|
||||
"patterns_required_to_work": "I pattern sono richiesti per il funzionamento di Fabric. Per risolvere:",
|
||||
"patterns_option_run_setup": "Opzione 1 (Consigliata): Esegui la configurazione per scaricare i pattern",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "Opzione 2: Scarica/aggiorna i pattern direttamente",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "pattern '%s' non trovato.\n\nNessun pattern installato! Per risolvere:\n • Esegui 'fabric --setup' per configurare e scaricare i pattern\n • Oppure esegui 'fabric -U' per scaricare/aggiornare i pattern direttamente",
|
||||
"pattern_not_found_list_available": "pattern '%s' non trovato. Esegui 'fabric -l' per vedere i pattern disponibili",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ NON CONFIGURATO",
|
||||
"defaults_setup_description": "Fornitore e modello AI predefiniti",
|
||||
"defaults_model_question": "Inserisci l'indice o il nome del tuo modello predefinito",
|
||||
"defaults_model_context_length_question": "Inserisci la lunghezza del contesto del modello",
|
||||
"custom_patterns_label": "Pattern personalizzati",
|
||||
"custom_patterns_setup_description": "Pattern personalizzati - Imposta la directory per i tuoi pattern personalizzati",
|
||||
"custom_patterns_directory_question": "Inserisci il percorso della directory dei tuoi pattern personalizzati",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Servizio Jina AI - per ottenere una pagina web come testo pulito e compatibile con LLM",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - per ottenere trascrizioni video (tramite yt-dlp) e commenti/metadati (tramite API YouTube)",
|
||||
"language_label": "Lingua",
|
||||
"language_setup_description": "Lingua - Lingua di output predefinita del fornitore di IA",
|
||||
"language_output_question": "Inserisci la tua lingua di output predefinita (ad esempio: zh_CN)",
|
||||
"optional_marker": "(opzionale)",
|
||||
"required_marker": "[obbligatorio]",
|
||||
"patterns_loader_label": "Caricatore pattern",
|
||||
"patterns_setup_description": "Pattern - Scarica i pattern",
|
||||
"patterns_git_repo_url_label": "URL repository Git",
|
||||
"patterns_git_repo_url_question": "Inserisci l'URL del repository Git predefinito per i pattern",
|
||||
"patterns_git_repo_folder_label": "Cartella dei pattern nel repository Git",
|
||||
"patterns_git_repo_folder_question": "Inserisci la cartella predefinita nel repository Git dove sono memorizzati i pattern",
|
||||
"patterns_failed_create_temp_folder": "impossibile creare la cartella temporanea dei pattern: %w",
|
||||
"patterns_downloading": "Download dei pattern e popolamento di %s...\\n",
|
||||
"patterns_failed_download_from_git": "impossibile scaricare i pattern dal repository Git: %w",
|
||||
"patterns_saving_updated_configuration": "💾 Salvataggio configurazione aggiornata (percorso cambiato da '%s' a '%s')...\\n",
|
||||
"patterns_failed_move_patterns": "impossibile spostare i pattern nella directory di configurazione: %w",
|
||||
"patterns_download_success": "✅ Pattern scaricati e installati correttamente in %s\\n",
|
||||
"patterns_failed_unique_file": "impossibile creare il file dei pattern univoci: %w",
|
||||
"patterns_failed_access_directory": "impossibile accedere alla directory dei pattern '%s': %w",
|
||||
"patterns_preserve_warning": "Avviso: impossibile conservare il pattern personalizzato '%s': %v\\n",
|
||||
"patterns_preserved_custom_pattern": "Pattern personalizzato conservato: %s\\n",
|
||||
"patterns_failed_create_temp_dir": "impossibile creare la directory temporanea: %w",
|
||||
"patterns_cloning_repository": "Clonazione del repository %s (percorso: %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "impossibile scaricare i pattern da %s: %w",
|
||||
"patterns_failed_read_temp_directory": "impossibile leggere la directory temporanea dei pattern: %w",
|
||||
"patterns_no_patterns_migration_failed": "nessun pattern trovato nel repository al percorso %s e migrazione non riuscita: %w",
|
||||
"patterns_downloaded_temp": "%d pattern scaricati nella directory temporanea\\n",
|
||||
"patterns_detected_old_path": "🔄 Rilevato vecchio percorso 'patterns', tentativo di migrazione a 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "Avviso: impossibile rimuovere la cartella temporanea di test '%s': %v\\n",
|
||||
"patterns_found_new_path": "✅ Trovati %d pattern nel nuovo percorso '%s', aggiornamento configurazione...\\n",
|
||||
"patterns_failed_move_test_patterns": "impossibile spostare i pattern di test nella cartella temporanea: %w",
|
||||
"patterns_unable_to_find_or_migrate": "impossibile trovare pattern nel percorso attuale '%s' o migrare alla nuova struttura",
|
||||
"patterns_failed_read_directory": "impossibile leggere la directory dei pattern: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 Inclusi anche i pattern dalla directory personalizzata: %s\\n",
|
||||
"patterns_warning_custom_directory": "Avviso: impossibile leggere la directory dei pattern personalizzata %s: %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "nessun pattern trovato nelle directory %s e %s",
|
||||
"patterns_no_patterns_found_in_directory": "nessun pattern trovato nella directory %s",
|
||||
"patterns_failed_write_unique_file": "impossibile scrivere il file dei pattern univoci: %w",
|
||||
"patterns_unique_file_created": "📝 File dei pattern univoci creato con %d pattern\\n",
|
||||
"patterns_no_patterns_copied": "nessun pattern copiato correttamente in %s",
|
||||
"patterns_failed_loaded_marker": "impossibile creare il file di marker '%s': %w",
|
||||
"strategies_label": "Strategie di prompt",
|
||||
"strategies_setup_description": "Strategie - Scarica strategie di prompting (come chain of thought)",
|
||||
"strategies_git_repo_url_label": "URL repository Git",
|
||||
"strategies_git_repo_url_question": "Inserisci l'URL del repository Git predefinito per le strategie",
|
||||
"strategies_git_repo_folder_label": "Cartella delle strategie nel repository Git",
|
||||
"strategies_git_repo_folder_question": "Inserisci la cartella predefinita nel repository Git dove sono memorizzate le strategie",
|
||||
"strategies_downloading": "Download delle strategie e popolamento di %s...\\n",
|
||||
"strategies_download_success": "✅ Strategie scaricate e installate correttamente in %s\\n",
|
||||
"strategies_home_dir_error": "impossibile ottenere la home directory: %v",
|
||||
"strategies_failed_create_directory": "impossibile creare la directory delle strategie: %w",
|
||||
"strategies_cloning_repository": "Clonazione del repository %s (percorso: %s)...\\n",
|
||||
"strategies_failed_download": "impossibile scaricare le strategie: %w",
|
||||
"strategies_downloaded_count": "%d strategie scaricate\\n",
|
||||
"strategies_home_dir_fallback": "impossibile ottenere la home directory: %v, uso la directory corrente",
|
||||
"strategy_not_found": "strategia %s non trovata. Esegui 'fabric --liststrategies' per l'elenco",
|
||||
"strategies_none_found": "nessuna strategia trovata. Esegui 'fabric --setup' per scaricare le strategie",
|
||||
"strategies_available_header": "Strategie disponibili:",
|
||||
"plugin_enter_value": "Inserisci il tuo %v %v",
|
||||
"plugin_enable_bool_question": "Abilita %v %v (true/false)",
|
||||
"plugin_setup_skipped": "[%v] saltato\\n",
|
||||
"plugin_question_bool": "%v%v (true/false, lascia vuoto per '%s' o digita '%v' per rimuovere il valore):",
|
||||
"plugin_question_with_default": "%v%v (lascia vuoto per '%s' o digita '%v' per rimuovere il valore):",
|
||||
"plugin_question_optional": "%v%v (lascia vuoto per saltare):",
|
||||
"plugin_invalid_boolean_value": "valore booleano non valido: %v",
|
||||
"plugin_setting_not_valid": "%v=%v non è valido",
|
||||
"plugin_invalid_bool": "bool non valido: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "%s がありません",
|
||||
"no_description_available": "説明がありません",
|
||||
"i18n_download_failed": "言語 '%s' の翻訳のダウンロードに失敗しました: %v",
|
||||
"i18n_load_failed": "翻訳ファイルの読み込みに失敗しました: %v"
|
||||
"i18n_load_failed": "翻訳ファイルの読み込みに失敗しました: %v",
|
||||
"setup_welcome_header": "🎉 Fabricへようこそ!セットアップを始めましょう。",
|
||||
"setup_step_downloading_patterns": "📥 ステップ1: パターンをダウンロード中(Fabricの動作に必要です)...",
|
||||
"setup_step_downloading_strategies": "📥 ステップ2: ストラテジーをダウンロード中(Fabricの動作に必要です)...",
|
||||
"setup_step_configure_ai_provider": "🤖 ステップ3: AIプロバイダーを設定",
|
||||
"setup_ai_provider_required": "Fabricを動作させるには、少なくとも1つのAIプロバイダーが必要です。",
|
||||
"setup_add_more_providers_later": "'fabric --setup'で後からプロバイダーを追加できます",
|
||||
"setup_step_setting_defaults": "⚙️ ステップ4: デフォルトのベンダーとモデルを設定中...",
|
||||
"setup_complete_header": "✅ セットアップ完了!Fabricを使用できます。",
|
||||
"setup_next_steps": "次のステップ:",
|
||||
"setup_list_patterns": "• 利用可能なパターンを一覧表示: fabric -l",
|
||||
"setup_try_pattern": "• パターンを試す: echo 'テキスト' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• その他の設定: fabric --setup",
|
||||
"setup_failed_download_patterns": "パターンのダウンロードに失敗しました: %w",
|
||||
"setup_failed_download_strategies": "ストラテジーのダウンロードに失敗しました: %w",
|
||||
"setup_failed_set_defaults": "デフォルトのベンダーとモデルの設定に失敗しました: %w",
|
||||
"setup_no_ai_provider_selected": "AIプロバイダーが選択されていません - 少なくとも1つは必要です",
|
||||
"setup_invalid_selection": "無効な選択: %s",
|
||||
"setup_available_ai_providers": "利用可能なAIプロバイダー:",
|
||||
"setup_enter_ai_provider_number": "AIプロバイダー番号",
|
||||
"setup_available_plugins": "利用可能なプラグイン:",
|
||||
"setup_plugin_number": "プラグイン番号",
|
||||
"setup_plugin_prompt": "セットアップするプラグインの番号を入力してください",
|
||||
"setup_required_configuration_header": "━━━ 必須設定 ━━━\n\nAIベンダー [少なくとも1つ必要]",
|
||||
"setup_required_tools": "必須ツール",
|
||||
"setup_optional_configuration_header": "━━━ オプション設定 ━━━\n\nオプションツール",
|
||||
"setup_validation_header": "設定状況:",
|
||||
"setup_validation_ai_provider_configured": "✓ AIプロバイダー設定済み",
|
||||
"setup_validation_ai_provider_missing": "✗ AIプロバイダー未設定 - Fabricの動作に必要です",
|
||||
"setup_validation_defaults_configured": "✓ デフォルトのベンダー/モデル設定済み: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ デフォルトのベンダー/モデル未設定 - Fabricの動作に必要です",
|
||||
"setup_validation_patterns_configured": "✓ パターンダウンロード済み",
|
||||
"setup_validation_patterns_missing": "✗ パターンが見つかりません - Fabricの動作に必要です",
|
||||
"setup_validation_strategies_configured": "✓ ストラテジーダウンロード済み",
|
||||
"setup_validation_strategies_missing": "✗ ストラテジーが見つかりません - Fabricの動作に必要です",
|
||||
"setup_validation_incomplete_warning": "⚠️ セットアップ未完了!必要なコンポーネントが不足しています。",
|
||||
"setup_validation_incomplete_help": "'fabric --setup'を再度実行して不足項目を設定するか、\n'fabric -U'を実行してパターンとストラテジーをダウンロードしてください。",
|
||||
"setup_validation_complete": "✓ 必要なコンポーネントがすべて設定されています!",
|
||||
"patterns_not_found_header": "⚠️ パターンが見つかりません!",
|
||||
"patterns_required_to_work": "Fabricを動作させるにはパターンが必要です。解決するには:",
|
||||
"patterns_option_run_setup": "オプション1(推奨): セットアップを実行してパターンをダウンロード",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "オプション2: パターンを直接ダウンロード/更新",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "パターン '%s' が見つかりません。\n\nパターンがインストールされていません!解決するには:\n • 'fabric --setup'を実行してパターンを設定・ダウンロード\n • または'fabric -U'を実行してパターンをダウンロード/更新",
|
||||
"pattern_not_found_list_available": "パターン '%s' が見つかりません。'fabric -l'で利用可能なパターンを確認してください",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ 未設定",
|
||||
"defaults_setup_description": "デフォルトのAIプロバイダーとモデル",
|
||||
"defaults_model_question": "デフォルトモデルのインデックスまたは名前を入力してください",
|
||||
"defaults_model_context_length_question": "モデルのコンテキスト長を入力してください",
|
||||
"custom_patterns_label": "カスタムパターン",
|
||||
"custom_patterns_setup_description": "カスタムパターン - カスタムパターン用のディレクトリを設定",
|
||||
"custom_patterns_directory_question": "カスタムパターンディレクトリのパスを入力してください",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Jina AI サービス - ウェブページをクリーンでLLMフレンドリーなテキストとして取得",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - 動画の転写(yt-dlp経由)とコメント/メタデータ(YouTube API経由)を取得",
|
||||
"language_label": "言語",
|
||||
"language_setup_description": "言語 - AIプロバイダーのデフォルト出力言語",
|
||||
"language_output_question": "デフォルト出力言語を入力してください(例:zh_CN)",
|
||||
"optional_marker": "(オプション)",
|
||||
"required_marker": "【必須】",
|
||||
"patterns_loader_label": "パターンローダー",
|
||||
"patterns_setup_description": "パターン - パターンをダウンロードします",
|
||||
"patterns_git_repo_url_label": "Git リポジトリ URL",
|
||||
"patterns_git_repo_url_question": "パターン用のデフォルト Git リポジトリ URL を入力してください",
|
||||
"patterns_git_repo_folder_label": "Git リポジトリ内のパターンフォルダー",
|
||||
"patterns_git_repo_folder_question": "パターンが格納されている Git リポジトリ内のデフォルトフォルダーを入力してください",
|
||||
"patterns_failed_create_temp_folder": "一時パターンフォルダーの作成に失敗しました: %w",
|
||||
"patterns_downloading": "パターンをダウンロードして %s を構成しています...\\n",
|
||||
"patterns_failed_download_from_git": "Git リポジトリからパターンをダウンロードできませんでした: %w",
|
||||
"patterns_saving_updated_configuration": "💾 更新された設定を保存しています (パスを '%s' から '%s' に変更)...\\n",
|
||||
"patterns_failed_move_patterns": "パターンを設定ディレクトリへ移動できませんでした: %w",
|
||||
"patterns_download_success": "✅ パターンを %s に正常にダウンロードしてインストールしました\\n",
|
||||
"patterns_failed_unique_file": "ユニークパターンファイルの作成に失敗しました: %w",
|
||||
"patterns_failed_access_directory": "パターンディレクトリ '%s' にアクセスできませんでした: %w",
|
||||
"patterns_preserve_warning": "警告: カスタムパターン '%s' を保持できませんでした: %v\\n",
|
||||
"patterns_preserved_custom_pattern": "カスタムパターンを保持しました: %s\\n",
|
||||
"patterns_failed_create_temp_dir": "一時ディレクトリの作成に失敗しました: %w",
|
||||
"patterns_cloning_repository": "リポジトリ %s をクローン中 (パス: %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "%s からパターンをダウンロードできませんでした: %w",
|
||||
"patterns_failed_read_temp_directory": "一時パターンディレクトリの読み取りに失敗しました: %w",
|
||||
"patterns_no_patterns_migration_failed": "リポジトリのパス %s にパターンが見つからず、移行にも失敗しました: %w",
|
||||
"patterns_downloaded_temp": "%d 個のパターンを一時ディレクトリにダウンロードしました\\n",
|
||||
"patterns_detected_old_path": "🔄 旧パス 'patterns' を検出、'data/patterns' への移行を試みます...",
|
||||
"patterns_warning_remove_test_folder": "警告: テスト用の一時フォルダー '%s' を削除できませんでした: %v\\n",
|
||||
"patterns_found_new_path": "✅ 新しいパス '%s' で %d 個のパターンを確認、設定を更新します...\\n",
|
||||
"patterns_failed_move_test_patterns": "テストパターンを一時フォルダーへ移動できませんでした: %w",
|
||||
"patterns_unable_to_find_or_migrate": "現在のパス '%s' でパターンが見つからず、新しい構成への移行もできません",
|
||||
"patterns_failed_read_directory": "パターンディレクトリの読み取りに失敗しました: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 カスタムディレクトリのパターンも含めました: %s\\n",
|
||||
"patterns_warning_custom_directory": "警告: カスタムパターンディレクトリ %s を読み取れませんでした: %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "%s と %s にパターンが見つかりません",
|
||||
"patterns_no_patterns_found_in_directory": "ディレクトリ %s にパターンが見つかりません",
|
||||
"patterns_failed_write_unique_file": "ユニークパターンファイルの書き込みに失敗しました: %w",
|
||||
"patterns_unique_file_created": "📝 %d 個のパターンでユニークパターンファイルを作成しました\\n",
|
||||
"patterns_no_patterns_copied": "%s にパターンをコピーできませんでした",
|
||||
"patterns_failed_loaded_marker": "マーカーファイル '%s' を作成できませんでした: %w",
|
||||
"strategies_label": "プロンプト戦略",
|
||||
"strategies_setup_description": "戦略 - プロンプト戦略(chain of thought など)をダウンロード",
|
||||
"strategies_git_repo_url_label": "Git リポジトリ URL",
|
||||
"strategies_git_repo_url_question": "戦略用のデフォルト Git リポジトリ URL を入力してください",
|
||||
"strategies_git_repo_folder_label": "Git リポジトリ内の戦略フォルダー",
|
||||
"strategies_git_repo_folder_question": "戦略が保存されている Git リポジトリ内のデフォルトフォルダーを入力してください",
|
||||
"strategies_downloading": "戦略をダウンロードして %s を構成しています...\\n",
|
||||
"strategies_download_success": "✅ 戦略を %s に正常にダウンロードしてインストールしました\\n",
|
||||
"strategies_home_dir_error": "ホームディレクトリを取得できませんでした: %v",
|
||||
"strategies_failed_create_directory": "戦略ディレクトリを作成できませんでした: %w",
|
||||
"strategies_cloning_repository": "リポジトリ %s をクローン中 (パス: %s)...\\n",
|
||||
"strategies_failed_download": "戦略のダウンロードに失敗しました: %w",
|
||||
"strategies_downloaded_count": "%d 件の戦略をダウンロードしました\\n",
|
||||
"strategies_home_dir_fallback": "ホームディレクトリを取得できませんでした: %v、代わりにカレントディレクトリを使用します",
|
||||
"strategy_not_found": "戦略 %s が見つかりません。'fabric --liststrategies' を実行して一覧を確認してください",
|
||||
"strategies_none_found": "戦略が見つかりません。'fabric --setup' を実行して戦略をダウンロードしてください",
|
||||
"strategies_available_header": "利用可能な戦略:",
|
||||
"plugin_enter_value": "%v の %v を入力してください",
|
||||
"plugin_enable_bool_question": "%v の %v を有効にしますか (true/false)",
|
||||
"plugin_setup_skipped": "[%v] スキップされました\\n",
|
||||
"plugin_question_bool": "%v%v (true/false、'%s' を使うには空欄のまま、値を削除するには '%v' と入力):",
|
||||
"plugin_question_with_default": "%v%v ('%s' を使うには空欄のまま、値を削除するには '%v' と入力):",
|
||||
"plugin_question_optional": "%v%v (スキップするには空欄のまま):",
|
||||
"plugin_invalid_boolean_value": "無効なブール値です: %v",
|
||||
"plugin_setting_not_valid": "%v=%v は無効です",
|
||||
"plugin_invalid_bool": "無効な bool です: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "Nenhum %s",
|
||||
"no_description_available": "Nenhuma descrição disponível",
|
||||
"i18n_download_failed": "Falha ao baixar tradução para o idioma '%s': %v",
|
||||
"i18n_load_failed": "Falha ao carregar arquivo de tradução: %v"
|
||||
"i18n_load_failed": "Falha ao carregar arquivo de tradução: %v",
|
||||
"setup_welcome_header": "🎉 Bem-vindo ao Fabric! Vamos configurar tudo.",
|
||||
"setup_step_downloading_patterns": "📥 Passo 1: Baixando padrões (necessários para o Fabric funcionar)...",
|
||||
"setup_step_downloading_strategies": "📥 Passo 2: Baixando estratégias (necessárias para o Fabric funcionar)...",
|
||||
"setup_step_configure_ai_provider": "🤖 Passo 3: Configurar um provedor de IA",
|
||||
"setup_ai_provider_required": "O Fabric precisa de pelo menos um provedor de IA para funcionar.",
|
||||
"setup_add_more_providers_later": "Você poderá adicionar mais provedores depois com 'fabric --setup'",
|
||||
"setup_step_setting_defaults": "⚙️ Passo 4: Configurando provedor e modelo padrão...",
|
||||
"setup_complete_header": "✅ Configuração completa! Agora você pode usar o Fabric.",
|
||||
"setup_next_steps": "Próximos passos:",
|
||||
"setup_list_patterns": "• Listar padrões disponíveis: fabric -l",
|
||||
"setup_try_pattern": "• Experimentar um padrão: echo 'seu texto' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• Configurar mais opções: fabric --setup",
|
||||
"setup_failed_download_patterns": "falha ao baixar padrões: %w",
|
||||
"setup_failed_download_strategies": "falha ao baixar estratégias: %w",
|
||||
"setup_failed_set_defaults": "falha ao configurar provedor e modelo padrão: %w",
|
||||
"setup_no_ai_provider_selected": "nenhum provedor de IA selecionado - pelo menos um é necessário",
|
||||
"setup_invalid_selection": "seleção inválida: %s",
|
||||
"setup_available_ai_providers": "Provedores de IA Disponíveis:",
|
||||
"setup_enter_ai_provider_number": "Número do Provedor de IA",
|
||||
"setup_available_plugins": "Plugins disponíveis:",
|
||||
"setup_plugin_number": "Número do Plugin",
|
||||
"setup_plugin_prompt": "Informe o número do plugin a configurar",
|
||||
"setup_required_configuration_header": "━━━ CONFIGURAÇÃO OBRIGATÓRIA ━━━\n\nProvedores de IA [pelo menos um obrigatório]",
|
||||
"setup_required_tools": "Ferramentas Obrigatórias",
|
||||
"setup_optional_configuration_header": "━━━ CONFIGURAÇÃO OPCIONAL ━━━\n\nFerramentas Opcionais",
|
||||
"setup_validation_header": "Status da Configuração:",
|
||||
"setup_validation_ai_provider_configured": "✓ Provedor de IA configurado",
|
||||
"setup_validation_ai_provider_missing": "✗ Provedor de IA não configurado - Necessário para o Fabric funcionar",
|
||||
"setup_validation_defaults_configured": "✓ Provedor/modelo padrão definido: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ Provedor/modelo padrão não definido - Necessário para o Fabric funcionar",
|
||||
"setup_validation_patterns_configured": "✓ Padrões baixados",
|
||||
"setup_validation_patterns_missing": "✗ Padrões não encontrados - Necessários para o Fabric funcionar",
|
||||
"setup_validation_strategies_configured": "✓ Estratégias baixadas",
|
||||
"setup_validation_strategies_missing": "✗ Estratégias não encontradas - Necessárias para o Fabric funcionar",
|
||||
"setup_validation_incomplete_warning": "⚠️ Configuração incompleta! Componentes necessários ausentes.",
|
||||
"setup_validation_incomplete_help": "Execute 'fabric --setup' novamente para configurar itens faltantes,\nou execute 'fabric -U' para baixar padrões e estratégias.",
|
||||
"setup_validation_complete": "✓ Todos os componentes necessários estão configurados!",
|
||||
"patterns_not_found_header": "⚠️ Nenhum padrão encontrado!",
|
||||
"patterns_required_to_work": "Padrões são necessários para o Fabric funcionar. Para resolver:",
|
||||
"patterns_option_run_setup": "Opção 1 (Recomendada): Execute a configuração para baixar padrões",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "Opção 2: Baixar/atualizar padrões diretamente",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "padrão '%s' não encontrado.\n\nNenhum padrão instalado! Para resolver:\n • Execute 'fabric --setup' para configurar e baixar padrões\n • Ou execute 'fabric -U' para baixar/atualizar padrões diretamente",
|
||||
"pattern_not_found_list_available": "padrão '%s' não encontrado. Execute 'fabric -l' para ver os padrões disponíveis",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ NÃO CONFIGURADO",
|
||||
"defaults_setup_description": "Provedor e modelo de IA padrão",
|
||||
"defaults_model_question": "Informe o índice ou o nome do seu modelo padrão",
|
||||
"defaults_model_context_length_question": "Informe o comprimento do contexto do modelo",
|
||||
"custom_patterns_label": "Padrões personalizados",
|
||||
"custom_patterns_setup_description": "Padrões personalizados - Definir diretório para seus padrões personalizados",
|
||||
"custom_patterns_directory_question": "Informe o caminho para seu diretório de padrões personalizados",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Serviço Jina AI - para obter uma página web como texto limpo e compatível com LLM",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - para obter transcrições de vídeo (via yt-dlp) e comentários/metadados (via API do YouTube)",
|
||||
"language_label": "Idioma",
|
||||
"language_setup_description": "Idioma - Idioma de saída padrão do provedor de IA",
|
||||
"language_output_question": "Informe o seu idioma de saída padrão (por exemplo: zh_CN)",
|
||||
"optional_marker": "(opcional)",
|
||||
"required_marker": "[obrigatório]",
|
||||
"patterns_loader_label": "Carregador de padrões",
|
||||
"patterns_setup_description": "Padrões - Baixa os padrões",
|
||||
"patterns_git_repo_url_label": "URL do repositório Git",
|
||||
"patterns_git_repo_url_question": "Informe a URL padrão do repositório Git para os padrões",
|
||||
"patterns_git_repo_folder_label": "Pasta de padrões no repositório Git",
|
||||
"patterns_git_repo_folder_question": "Informe a pasta padrão no repositório Git onde os padrões ficam armazenados",
|
||||
"patterns_failed_create_temp_folder": "falha ao criar a pasta temporária de padrões: %w",
|
||||
"patterns_downloading": "Baixando padrões e populando %s...\\n",
|
||||
"patterns_failed_download_from_git": "falha ao baixar padrões do repositório Git: %w",
|
||||
"patterns_saving_updated_configuration": "💾 Salvando configuração atualizada (caminho alterado de '%s' para '%s')...\\n",
|
||||
"patterns_failed_move_patterns": "falha ao mover os padrões para o diretório de configuração: %w",
|
||||
"patterns_download_success": "✅ Padrões baixados e instalados com sucesso em %s\\n",
|
||||
"patterns_failed_unique_file": "falha ao criar o arquivo de padrões únicos: %w",
|
||||
"patterns_failed_access_directory": "falha ao acessar o diretório de padrões '%s': %w",
|
||||
"patterns_preserve_warning": "Aviso: não foi possível preservar o padrão personalizado '%s': %v\\n",
|
||||
"patterns_preserved_custom_pattern": "Padrão personalizado preservado: %s\\n",
|
||||
"patterns_failed_create_temp_dir": "falha ao criar diretório temporário: %w",
|
||||
"patterns_cloning_repository": "Clonando repositório %s (caminho: %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "falha ao baixar padrões de %s: %w",
|
||||
"patterns_failed_read_temp_directory": "falha ao ler o diretório temporário de padrões: %w",
|
||||
"patterns_no_patterns_migration_failed": "nenhum padrão encontrado no repositório no caminho %s e a migração falhou: %w",
|
||||
"patterns_downloaded_temp": "%d padrões baixados para o diretório temporário\\n",
|
||||
"patterns_detected_old_path": "🔄 Caminho antigo 'patterns' detectado, tentando migrar para 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "Aviso: não foi possível remover a pasta temporária de teste '%s': %v\\n",
|
||||
"patterns_found_new_path": "✅ %d padrões encontrados no novo caminho '%s', atualizando configuração...\\n",
|
||||
"patterns_failed_move_test_patterns": "falha ao mover padrões de teste para a pasta temporária: %w",
|
||||
"patterns_unable_to_find_or_migrate": "não foi possível encontrar padrões no caminho atual '%s' ou migrar para a nova estrutura",
|
||||
"patterns_failed_read_directory": "falha ao ler o diretório de padrões: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 Também incluídos os padrões do diretório personalizado: %s\\n",
|
||||
"patterns_warning_custom_directory": "Aviso: não foi possível ler o diretório de padrões personalizado %s: %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "nenhum padrão encontrado nos diretórios %s e %s",
|
||||
"patterns_no_patterns_found_in_directory": "nenhum padrão encontrado no diretório %s",
|
||||
"patterns_failed_write_unique_file": "falha ao gravar o arquivo de padrões únicos: %w",
|
||||
"patterns_unique_file_created": "📝 Arquivo de padrões únicos criado com %d padrões\\n",
|
||||
"patterns_no_patterns_copied": "nenhum padrão foi copiado com sucesso para %s",
|
||||
"patterns_failed_loaded_marker": "falha ao criar o arquivo marcador '%s': %w",
|
||||
"strategies_label": "Estratégias de prompt",
|
||||
"strategies_setup_description": "Estratégias - Baixa estratégias de prompting (como chain of thought)",
|
||||
"strategies_git_repo_url_label": "URL do repositório Git",
|
||||
"strategies_git_repo_url_question": "Informe a URL padrão do repositório Git para as estratégias",
|
||||
"strategies_git_repo_folder_label": "Pasta de estratégias no repositório Git",
|
||||
"strategies_git_repo_folder_question": "Informe a pasta padrão no repositório Git onde as estratégias ficam armazenadas",
|
||||
"strategies_downloading": "Baixando estratégias e populando %s...\\n",
|
||||
"strategies_download_success": "✅ Estratégias baixadas e instaladas com sucesso em %s\\n",
|
||||
"strategies_home_dir_error": "não foi possível obter o diretório home: %v",
|
||||
"strategies_failed_create_directory": "falha ao criar diretório de estratégias: %w",
|
||||
"strategies_cloning_repository": "Clonando repositório %s (caminho: %s)...\\n",
|
||||
"strategies_failed_download": "falha ao baixar estratégias: %w",
|
||||
"strategies_downloaded_count": "%d estratégias baixadas\\n",
|
||||
"strategies_home_dir_fallback": "não foi possível obter o diretório home: %v, usando o diretório atual",
|
||||
"strategy_not_found": "estratégia %s não encontrada. Execute 'fabric --liststrategies' para ver a lista",
|
||||
"strategies_none_found": "nenhuma estratégia encontrada. Execute 'fabric --setup' para baixar estratégias",
|
||||
"strategies_available_header": "Estratégias disponíveis:",
|
||||
"plugin_enter_value": "Informe seu %v %v",
|
||||
"plugin_enable_bool_question": "Ativar %v %v (true/false)",
|
||||
"plugin_setup_skipped": "[%v] ignorado\\n",
|
||||
"plugin_question_bool": "%v%v (true/false, deixe em branco para '%s' ou digite '%v' para remover o valor):",
|
||||
"plugin_question_with_default": "%v%v (deixe em branco para '%s' ou digite '%v' para remover o valor):",
|
||||
"plugin_question_optional": "%v%v (deixe em branco para pular):",
|
||||
"plugin_invalid_boolean_value": "valor booleano inválido: %v",
|
||||
"plugin_setting_not_valid": "%v=%v não é válido",
|
||||
"plugin_invalid_bool": "bool inválido: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "Nenhum %s",
|
||||
"no_description_available": "Nenhuma descrição disponível",
|
||||
"i18n_download_failed": "Falha ao descarregar tradução para o idioma '%s': %v",
|
||||
"i18n_load_failed": "Falha ao carregar ficheiro de tradução: %v"
|
||||
"i18n_load_failed": "Falha ao carregar ficheiro de tradução: %v",
|
||||
"setup_welcome_header": "🎉 Bem-vindo ao Fabric! Vamos configurar tudo.",
|
||||
"setup_step_downloading_patterns": "📥 Passo 1: A descarregar padrões (necessários para o Fabric funcionar)...",
|
||||
"setup_step_downloading_strategies": "📥 Passo 2: A descarregar estratégias (necessárias para o Fabric funcionar)...",
|
||||
"setup_step_configure_ai_provider": "🤖 Passo 3: Configurar um fornecedor de IA",
|
||||
"setup_ai_provider_required": "O Fabric precisa de pelo menos um fornecedor de IA para funcionar.",
|
||||
"setup_add_more_providers_later": "Poderá adicionar mais fornecedores depois com 'fabric --setup'",
|
||||
"setup_step_setting_defaults": "⚙️ Passo 4: A configurar fornecedor e modelo predefinido...",
|
||||
"setup_complete_header": "✅ Configuração completa! Agora pode usar o Fabric.",
|
||||
"setup_next_steps": "Próximos passos:",
|
||||
"setup_list_patterns": "• Listar padrões disponíveis: fabric -l",
|
||||
"setup_try_pattern": "• Experimentar um padrão: echo 'o seu texto' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• Configurar mais opções: fabric --setup",
|
||||
"setup_failed_download_patterns": "falha ao descarregar padrões: %w",
|
||||
"setup_failed_download_strategies": "falha ao descarregar estratégias: %w",
|
||||
"setup_failed_set_defaults": "falha ao configurar fornecedor e modelo predefinido: %w",
|
||||
"setup_no_ai_provider_selected": "nenhum fornecedor de IA selecionado - pelo menos um é necessário",
|
||||
"setup_invalid_selection": "seleção inválida: %s",
|
||||
"setup_available_ai_providers": "Fornecedores de IA Disponíveis:",
|
||||
"setup_enter_ai_provider_number": "Número do Fornecedor de IA",
|
||||
"setup_available_plugins": "Plugins disponíveis:",
|
||||
"setup_plugin_number": "Número do Plugin",
|
||||
"setup_plugin_prompt": "Indique o número do plugin a configurar",
|
||||
"setup_required_configuration_header": "━━━ CONFIGURAÇÃO OBRIGATÓRIA ━━━\n\nFornecedores de IA [pelo menos um obrigatório]",
|
||||
"setup_required_tools": "Ferramentas Obrigatórias",
|
||||
"setup_optional_configuration_header": "━━━ CONFIGURAÇÃO OPCIONAL ━━━\n\nFerramentas Opcionais",
|
||||
"setup_validation_header": "Estado da Configuração:",
|
||||
"setup_validation_ai_provider_configured": "✓ Fornecedor de IA configurado",
|
||||
"setup_validation_ai_provider_missing": "✗ Fornecedor de IA não configurado - Necessário para o Fabric funcionar",
|
||||
"setup_validation_defaults_configured": "✓ Fornecedor/modelo predefinido definido: %s/%s",
|
||||
"setup_validation_defaults_missing": "✗ Fornecedor/modelo predefinido não definido - Necessário para o Fabric funcionar",
|
||||
"setup_validation_patterns_configured": "✓ Padrões descarregados",
|
||||
"setup_validation_patterns_missing": "✗ Padrões não encontrados - Necessários para o Fabric funcionar",
|
||||
"setup_validation_strategies_configured": "✓ Estratégias descarregadas",
|
||||
"setup_validation_strategies_missing": "✗ Estratégias não encontradas - Necessárias para o Fabric funcionar",
|
||||
"setup_validation_incomplete_warning": "⚠️ Configuração incompleta! Componentes necessários em falta.",
|
||||
"setup_validation_incomplete_help": "Execute 'fabric --setup' novamente para configurar itens em falta,\nou execute 'fabric -U' para descarregar padrões e estratégias.",
|
||||
"setup_validation_complete": "✓ Todos os componentes necessários estão configurados!",
|
||||
"patterns_not_found_header": "⚠️ Nenhum padrão encontrado!",
|
||||
"patterns_required_to_work": "Padrões são necessários para o Fabric funcionar. Para resolver:",
|
||||
"patterns_option_run_setup": "Opção 1 (Recomendada): Execute a configuração para descarregar padrões",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "Opção 2: Descarregar/atualizar padrões diretamente",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "padrão '%s' não encontrado.\n\nNenhum padrão instalado! Para resolver:\n • Execute 'fabric --setup' para configurar e descarregar padrões\n • Ou execute 'fabric -U' para descarregar/atualizar padrões diretamente",
|
||||
"pattern_not_found_list_available": "padrão '%s' não encontrado. Execute 'fabric -l' para ver os padrões disponíveis",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ NÃO CONFIGURADO",
|
||||
"defaults_setup_description": "Fornecedor e modelo de IA padrão",
|
||||
"defaults_model_question": "Indique o índice ou o nome do seu modelo padrão",
|
||||
"defaults_model_context_length_question": "Indique o comprimento do contexto do modelo",
|
||||
"custom_patterns_label": "Padrões personalizados",
|
||||
"custom_patterns_setup_description": "Padrões personalizados - Definir diretório para os seus padrões personalizados",
|
||||
"custom_patterns_directory_question": "Indique o caminho para o seu diretório de padrões personalizados",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Serviço Jina AI - para obter uma página web como texto limpo e compatível com LLM",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - para obter transcrições de vídeo (via yt-dlp) e comentários/metadados (via API do YouTube)",
|
||||
"language_label": "Idioma",
|
||||
"language_setup_description": "Idioma - Idioma de saída predefinido do fornecedor de IA",
|
||||
"language_output_question": "Indique o seu idioma de saída predefinido (por exemplo: zh_CN)",
|
||||
"optional_marker": "(opcional)",
|
||||
"required_marker": "[obrigatório]",
|
||||
"patterns_loader_label": "Carregador de padrões",
|
||||
"patterns_setup_description": "Padrões - Transfere os padrões",
|
||||
"patterns_git_repo_url_label": "URL do repositório Git",
|
||||
"patterns_git_repo_url_question": "Indique o URL padrão do repositório Git para os padrões",
|
||||
"patterns_git_repo_folder_label": "Pasta de padrões no repositório Git",
|
||||
"patterns_git_repo_folder_question": "Indique a pasta padrão no repositório Git onde os padrões estão guardados",
|
||||
"patterns_failed_create_temp_folder": "falha ao criar a pasta temporária de padrões: %w",
|
||||
"patterns_downloading": "A transferir padrões e a preencher %s...\\n",
|
||||
"patterns_failed_download_from_git": "falha ao transferir padrões do repositório Git: %w",
|
||||
"patterns_saving_updated_configuration": "💾 A guardar a configuração actualizada (caminho alterado de '%s' para '%s')...\\n",
|
||||
"patterns_failed_move_patterns": "falha ao mover os padrões para o directório de configuração: %w",
|
||||
"patterns_download_success": "✅ Padrões transferidos e instalados com sucesso em %s\\n",
|
||||
"patterns_failed_unique_file": "falha ao criar o ficheiro de padrões únicos: %w",
|
||||
"patterns_failed_access_directory": "falha ao aceder ao directório de padrões '%s': %w",
|
||||
"patterns_preserve_warning": "Aviso: não foi possível preservar o padrão personalizado '%s': %v\\n",
|
||||
"patterns_preserved_custom_pattern": "Padrão personalizado preservado: %s\\n",
|
||||
"patterns_failed_create_temp_dir": "falha ao criar directório temporário: %w",
|
||||
"patterns_cloning_repository": "A clonar repositório %s (caminho: %s)...\\n",
|
||||
"patterns_failed_download_from_repo": "falha ao transferir padrões de %s: %w",
|
||||
"patterns_failed_read_temp_directory": "falha ao ler o directório temporário de padrões: %w",
|
||||
"patterns_no_patterns_migration_failed": "nenhum padrão encontrado no repositório no caminho %s e a migração falhou: %w",
|
||||
"patterns_downloaded_temp": "%d padrões transferidos para o directório temporário\\n",
|
||||
"patterns_detected_old_path": "🔄 Caminho antigo 'patterns' detectado, a tentar migração para 'data/patterns'...",
|
||||
"patterns_warning_remove_test_folder": "Aviso: não foi possível remover a pasta temporária de teste '%s': %v\\n",
|
||||
"patterns_found_new_path": "✅ %d padrões encontrados no novo caminho '%s', a actualizar configuração...\\n",
|
||||
"patterns_failed_move_test_patterns": "falha ao mover padrões de teste para a pasta temporária: %w",
|
||||
"patterns_unable_to_find_or_migrate": "não foi possível encontrar padrões no caminho actual '%s' nem migrar para a nova estrutura",
|
||||
"patterns_failed_read_directory": "falha ao ler o directório de padrões: %w",
|
||||
"patterns_debug_included_custom_directory": "📂 Padrões do directório personalizado também incluídos: %s\\n",
|
||||
"patterns_warning_custom_directory": "Aviso: não foi possível ler o directório de padrões personalizado %s: %v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "nenhum padrão encontrado nos directórios %s e %s",
|
||||
"patterns_no_patterns_found_in_directory": "nenhum padrão encontrado no directório %s",
|
||||
"patterns_failed_write_unique_file": "falha ao gravar o ficheiro de padrões únicos: %w",
|
||||
"patterns_unique_file_created": "📝 Ficheiro de padrões únicos criado com %d padrões\\n",
|
||||
"patterns_no_patterns_copied": "nenhum padrão foi copiado com sucesso para %s",
|
||||
"patterns_failed_loaded_marker": "falha ao criar o ficheiro marcador '%s': %w",
|
||||
"strategies_label": "Estratégias de prompt",
|
||||
"strategies_setup_description": "Estratégias - Transfere estratégias de prompting (como chain of thought)",
|
||||
"strategies_git_repo_url_label": "URL do repositório Git",
|
||||
"strategies_git_repo_url_question": "Indique o URL padrão do repositório Git para as estratégias",
|
||||
"strategies_git_repo_folder_label": "Pasta de estratégias no repositório Git",
|
||||
"strategies_git_repo_folder_question": "Indique a pasta padrão no repositório Git onde as estratégias estão guardadas",
|
||||
"strategies_downloading": "A transferir estratégias e a preencher %s...\\n",
|
||||
"strategies_download_success": "✅ Estratégias transferidas e instaladas com sucesso em %s\\n",
|
||||
"strategies_home_dir_error": "não foi possível obter o directório home: %v",
|
||||
"strategies_failed_create_directory": "falha ao criar directório de estratégias: %w",
|
||||
"strategies_cloning_repository": "A clonar repositório %s (caminho: %s)...\\n",
|
||||
"strategies_failed_download": "falha ao transferir estratégias: %w",
|
||||
"strategies_downloaded_count": "%d estratégias transferidas\\n",
|
||||
"strategies_home_dir_fallback": "não foi possível obter o directório home: %v, a usar o directório actual",
|
||||
"strategy_not_found": "estratégia %s não encontrada. Execute 'fabric --liststrategies' para ver a lista",
|
||||
"strategies_none_found": "nenhuma estratégia encontrada. Execute 'fabric --setup' para transferir estratégias",
|
||||
"strategies_available_header": "Estratégias disponíveis:",
|
||||
"plugin_enter_value": "Indique o seu %v %v",
|
||||
"plugin_enable_bool_question": "Ativar %v %v (true/false)",
|
||||
"plugin_setup_skipped": "[%v] ignorado\\n",
|
||||
"plugin_question_bool": "%v%v (true/false, deixe em branco para '%s' ou escreva '%v' para remover o valor):",
|
||||
"plugin_question_with_default": "%v%v (deixe em branco para '%s' ou escreva '%v' para remover o valor):",
|
||||
"plugin_question_optional": "%v%v (deixe em branco para ignorar):",
|
||||
"plugin_invalid_boolean_value": "valor booleano inválido: %v",
|
||||
"plugin_setting_not_valid": "%v=%v não é válido",
|
||||
"plugin_invalid_bool": "bool inválido: %q"
|
||||
}
|
||||
|
||||
@@ -161,5 +161,129 @@
|
||||
"no_items_found": "没有 %s",
|
||||
"no_description_available": "没有可用描述",
|
||||
"i18n_download_failed": "下载语言 '%s' 的翻译失败: %v",
|
||||
"i18n_load_failed": "加载翻译文件失败: %v"
|
||||
"i18n_load_failed": "加载翻译文件失败: %v",
|
||||
"setup_welcome_header": "🎉 欢迎使用 Fabric!让我们开始设置。",
|
||||
"setup_step_downloading_patterns": "📥 步骤 1:正在下载模式(Fabric 运行所需)...",
|
||||
"setup_step_downloading_strategies": "📥 步骤 2:正在下载策略(Fabric 运行所需)...",
|
||||
"setup_step_configure_ai_provider": "🤖 步骤 3:配置 AI 提供商",
|
||||
"setup_ai_provider_required": "Fabric 需要至少一个 AI 提供商才能运行。",
|
||||
"setup_add_more_providers_later": "您可以稍后通过 'fabric --setup' 添加更多提供商",
|
||||
"setup_step_setting_defaults": "⚙️ 步骤 4:正在设置默认提供商和模型...",
|
||||
"setup_complete_header": "✅ 设置完成!您现在可以使用 Fabric 了。",
|
||||
"setup_next_steps": "下一步:",
|
||||
"setup_list_patterns": "• 列出可用模式:fabric -l",
|
||||
"setup_try_pattern": "• 尝试一个模式:echo '您的文本' | fabric --pattern summarize",
|
||||
"setup_configure_more": "• 配置更多设置:fabric --setup",
|
||||
"setup_failed_download_patterns": "下载模式失败:%w",
|
||||
"setup_failed_download_strategies": "下载策略失败:%w",
|
||||
"setup_failed_set_defaults": "设置默认提供商和模型失败:%w",
|
||||
"setup_no_ai_provider_selected": "未选择 AI 提供商 - 至少需要一个",
|
||||
"setup_invalid_selection": "无效的选择:%s",
|
||||
"setup_available_ai_providers": "可用的 AI 提供商:",
|
||||
"setup_enter_ai_provider_number": "AI 提供商编号",
|
||||
"setup_available_plugins": "可用的插件:",
|
||||
"setup_plugin_number": "插件编号",
|
||||
"setup_plugin_prompt": "请输入要设置的插件编号",
|
||||
"setup_required_configuration_header": "━━━ 必需配置 ━━━\n\nAI 提供商 [至少需要一个]",
|
||||
"setup_required_tools": "必需工具",
|
||||
"setup_optional_configuration_header": "━━━ 可选配置 ━━━\n\n可选工具",
|
||||
"setup_validation_header": "配置状态:",
|
||||
"setup_validation_ai_provider_configured": "✓ AI 提供商已配置",
|
||||
"setup_validation_ai_provider_missing": "✗ AI 提供商未配置 - Fabric 运行所需",
|
||||
"setup_validation_defaults_configured": "✓ 默认提供商/模型已设置:%s/%s",
|
||||
"setup_validation_defaults_missing": "✗ 默认提供商/模型未设置 - Fabric 运行所需",
|
||||
"setup_validation_patterns_configured": "✓ 模式已下载",
|
||||
"setup_validation_patterns_missing": "✗ 未找到模式 - Fabric 运行所需",
|
||||
"setup_validation_strategies_configured": "✓ 策略已下载",
|
||||
"setup_validation_strategies_missing": "✗ 未找到策略 - Fabric 运行所需",
|
||||
"setup_validation_incomplete_warning": "⚠️ 设置不完整!缺少必需组件。",
|
||||
"setup_validation_incomplete_help": "再次运行 'fabric --setup' 配置缺失项,\n或运行 'fabric -U' 下载模式和策略。",
|
||||
"setup_validation_complete": "✓ 所有必需组件已配置!",
|
||||
"patterns_not_found_header": "⚠️ 未找到模式!",
|
||||
"patterns_required_to_work": "Fabric 需要模式才能运行。要解决此问题:",
|
||||
"patterns_option_run_setup": "选项 1(推荐):运行设置以下载模式",
|
||||
"patterns_option_run_setup_command": "fabric --setup",
|
||||
"patterns_option_run_update": "选项 2:直接下载/更新模式",
|
||||
"patterns_option_run_update_command": "fabric -U",
|
||||
"pattern_not_found_no_patterns": "未找到模式 '%s'。\n\n未安装任何模式!要解决此问题:\n • 运行 'fabric --setup' 配置并下载模式\n • 或运行 'fabric -U' 直接下载/更新模式",
|
||||
"pattern_not_found_list_available": "未找到模式 '%s'。运行 'fabric -l' 查看可用模式",
|
||||
"plugin_configured": " ✓",
|
||||
"plugin_not_configured": " ⚠️ 未配置",
|
||||
"defaults_setup_description": "默认 AI 提供商和模型",
|
||||
"defaults_model_question": "请输入您的默认模型的索引或名称",
|
||||
"defaults_model_context_length_question": "请输入模型上下文长度",
|
||||
"custom_patterns_label": "自定义模式",
|
||||
"custom_patterns_setup_description": "自定义模式 - 设置您的自定义模式目录",
|
||||
"custom_patterns_directory_question": "请输入您的自定义模式目录路径",
|
||||
"jina_label": "Jina AI",
|
||||
"jina_setup_description": "Jina AI 服务 - 将网页获取为干净、LLM 友好的文本",
|
||||
"youtube_label": "YouTube",
|
||||
"youtube_setup_description": "YouTube - 获取视频转录(通过 yt-dlp)和评论/元数据(通过 YouTube API)",
|
||||
"language_label": "语言",
|
||||
"language_setup_description": "语言 - AI 提供商的默认输出语言",
|
||||
"language_output_question": "请输入您的默认输出语言(例如:zh_CN)",
|
||||
"optional_marker": "(可选)",
|
||||
"required_marker": "(必需)",
|
||||
"patterns_loader_label": "模式加载器",
|
||||
"patterns_setup_description": "模式 - 下载模式",
|
||||
"patterns_git_repo_url_label": "Git 仓库 URL",
|
||||
"patterns_git_repo_url_question": "请输入用于模式的默认 Git 仓库 URL",
|
||||
"patterns_git_repo_folder_label": "Git 仓库中的模式文件夹",
|
||||
"patterns_git_repo_folder_question": "请输入存储模式的 Git 仓库默认文件夹",
|
||||
"patterns_failed_create_temp_folder": "创建模式临时文件夹失败:%w",
|
||||
"patterns_downloading": "正在下载模式并填充 %s...\\n",
|
||||
"patterns_failed_download_from_git": "从 Git 仓库下载模式失败:%w",
|
||||
"patterns_saving_updated_configuration": "💾 正在保存更新的配置(路径从 '%s' 更改为 '%s')...\\n",
|
||||
"patterns_failed_move_patterns": "将模式移动到配置目录失败:%w",
|
||||
"patterns_download_success": "✅ 已成功下载并安装模式到 %s\\n",
|
||||
"patterns_failed_unique_file": "创建唯一模式文件失败:%w",
|
||||
"patterns_failed_access_directory": "访问模式目录 '%s' 失败:%w",
|
||||
"patterns_preserve_warning": "警告:未能保留自定义模式 '%s':%v\\n",
|
||||
"patterns_preserved_custom_pattern": "已保留自定义模式:%s\\n",
|
||||
"patterns_failed_create_temp_dir": "创建临时目录失败:%w",
|
||||
"patterns_cloning_repository": "正在克隆仓库 %s(路径:%s)...\\n",
|
||||
"patterns_failed_download_from_repo": "从 %s 下载模式失败:%w",
|
||||
"patterns_failed_read_temp_directory": "读取模式临时目录失败:%w",
|
||||
"patterns_no_patterns_migration_failed": "在仓库路径 %s 未找到模式且迁移失败:%w",
|
||||
"patterns_downloaded_temp": "已将 %d 个模式下载到临时目录\\n",
|
||||
"patterns_detected_old_path": "🔄 检测到旧的模式路径“patterns”,尝试迁移到“data/patterns”...",
|
||||
"patterns_warning_remove_test_folder": "警告:无法删除测试临时文件夹 '%s':%v\\n",
|
||||
"patterns_found_new_path": "✅ 在新路径“%s”找到 %d 个模式,正在更新配置...\\n",
|
||||
"patterns_failed_move_test_patterns": "将测试模式移动到临时文件夹失败:%w",
|
||||
"patterns_unable_to_find_or_migrate": "在当前路径“%s”未找到模式,也无法迁移到新结构",
|
||||
"patterns_failed_read_directory": "读取模式目录失败:%w",
|
||||
"patterns_debug_included_custom_directory": "📂 还包含了自定义目录中的模式:%s\\n",
|
||||
"patterns_warning_custom_directory": "警告:无法读取自定义模式目录 %s:%v\\n",
|
||||
"patterns_no_patterns_found_in_directories": "在目录 %s 和 %s 中未找到模式",
|
||||
"patterns_no_patterns_found_in_directory": "在目录 %s 中未找到模式",
|
||||
"patterns_failed_write_unique_file": "写入唯一模式文件失败:%w",
|
||||
"patterns_unique_file_created": "📝 已创建包含 %d 个模式的唯一模式文件\\n",
|
||||
"patterns_no_patterns_copied": "未能成功将模式复制到 %s",
|
||||
"patterns_failed_loaded_marker": "创建标记文件 '%s' 失败:%w",
|
||||
"strategies_label": "提示策略",
|
||||
"strategies_setup_description": "策略 - 下载提示策略(如 chain of thought)",
|
||||
"strategies_git_repo_url_label": "Git 仓库 URL",
|
||||
"strategies_git_repo_url_question": "请输入用于策略的默认 Git 仓库 URL",
|
||||
"strategies_git_repo_folder_label": "Git 仓库中的策略文件夹",
|
||||
"strategies_git_repo_folder_question": "请输入存储策略的 Git 仓库默认文件夹",
|
||||
"strategies_downloading": "正在下载策略并填充 %s...\\n",
|
||||
"strategies_download_success": "✅ 已成功下载并安装策略到 %s\\n",
|
||||
"strategies_home_dir_error": "无法获取主目录:%v",
|
||||
"strategies_failed_create_directory": "创建策略目录失败:%w",
|
||||
"strategies_cloning_repository": "正在克隆仓库 %s(路径:%s)...\\n",
|
||||
"strategies_failed_download": "下载策略失败:%w",
|
||||
"strategies_downloaded_count": "已下载 %d 个策略\\n",
|
||||
"strategies_home_dir_fallback": "无法获取主目录:%v,改用当前目录",
|
||||
"strategy_not_found": "未找到策略 %s。运行 'fabric --liststrategies' 查看列表",
|
||||
"strategies_none_found": "未找到任何策略。请运行 'fabric --setup' 下载策略",
|
||||
"strategies_available_header": "可用的策略:",
|
||||
"plugin_enter_value": "请输入您的 %v %v",
|
||||
"plugin_enable_bool_question": "启用 %v %v(true/false)",
|
||||
"plugin_setup_skipped": "[%v] 已跳过\\n",
|
||||
"plugin_question_bool": "%v%v(true/false,留空表示使用 '%s',或输入 '%v' 清除值):",
|
||||
"plugin_question_with_default": "%v%v(留空表示使用 '%s',或输入 '%v' 清除值):",
|
||||
"plugin_question_optional": "%v%v(留空以跳过):",
|
||||
"plugin_invalid_boolean_value": "无效的布尔值:%v",
|
||||
"plugin_setting_not_valid": "%v=%v 无效",
|
||||
"plugin_invalid_bool": "无效的 bool:%q"
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func LevelFromInt(i int) Level {
|
||||
}
|
||||
|
||||
// Debug writes a debug message if the global level permits.
|
||||
func Debug(l Level, format string, a ...interface{}) {
|
||||
func Debug(l Level, format string, a ...any) {
|
||||
mu.RLock()
|
||||
current := level
|
||||
w := output
|
||||
@@ -63,7 +63,7 @@ func Debug(l Level, format string, a ...interface{}) {
|
||||
|
||||
// Log writes a message unconditionally to stderr.
|
||||
// This is for important messages that should always be shown regardless of debug level.
|
||||
func Log(format string, a ...interface{}) {
|
||||
func Log(format string, a ...any) {
|
||||
mu.RLock()
|
||||
w := output
|
||||
mu.RUnlock()
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -52,6 +53,8 @@ func NewClient() (ret *Client) {
|
||||
string(anthropic.ModelClaudeSonnet4_5_20250929),
|
||||
string(anthropic.ModelClaudeOpus4_5_20251101),
|
||||
string(anthropic.ModelClaudeOpus4_5),
|
||||
string(anthropic.ModelClaudeHaiku4_5),
|
||||
string(anthropic.ModelClaudeHaiku4_5_20251001),
|
||||
}
|
||||
|
||||
ret.modelBetas = map[string][]string{
|
||||
@@ -214,7 +217,7 @@ func (an *Client) SendStream(
|
||||
}
|
||||
|
||||
if stream.Err() != nil {
|
||||
fmt.Printf("Messages stream error: %v\n", stream.Err())
|
||||
fmt.Fprintf(os.Stderr, "Messages stream error: %v\n", stream.Err())
|
||||
}
|
||||
close(channel)
|
||||
return
|
||||
|
||||
@@ -52,7 +52,7 @@ func createExpiredToken(accessToken, refreshToken string) *util.OAuthToken {
|
||||
}
|
||||
|
||||
// mockTokenServer creates a mock OAuth token server for testing
|
||||
func mockTokenServer(_ *testing.T, responses map[string]interface{}) *httptest.Server {
|
||||
func mockTokenServer(_ *testing.T, responses map[string]any) *httptest.Server {
|
||||
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/v1/oauth/token" {
|
||||
http.NotFound(w, r)
|
||||
@@ -80,7 +80,7 @@ func mockTokenServer(_ *testing.T, responses map[string]interface{}) *httptest.S
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
if errorResp, ok := response.(map[string]interface{}); ok && errorResp["error"] != nil {
|
||||
if errorResp, ok := response.(map[string]any); ok && errorResp["error"] != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ func TestGeneratePKCE(t *testing.T) {
|
||||
|
||||
func TestExchangeToken_Success(t *testing.T) {
|
||||
// Create mock server
|
||||
server := mockTokenServer(t, map[string]interface{}{
|
||||
"authorization_code": map[string]interface{}{
|
||||
server := mockTokenServer(t, map[string]any{
|
||||
"authorization_code": map[string]any{
|
||||
"access_token": "test_access_token",
|
||||
"refresh_token": "test_refresh_token",
|
||||
"expires_in": 3600,
|
||||
@@ -161,8 +161,8 @@ func TestRefreshToken_Success(t *testing.T) {
|
||||
os.WriteFile(tokenPath, data, 0600)
|
||||
|
||||
// Create mock server for refresh
|
||||
server := mockTokenServer(t, map[string]interface{}{
|
||||
"refresh_token": map[string]interface{}{
|
||||
server := mockTokenServer(t, map[string]any{
|
||||
"refresh_token": map[string]any{
|
||||
"access_token": "new_access_token",
|
||||
"refresh_token": "new_refresh_token",
|
||||
"expires_in": 3600,
|
||||
@@ -416,7 +416,7 @@ func TestGetValidTokenWithValidToken(t *testing.T) {
|
||||
|
||||
// Benchmark tests
|
||||
func BenchmarkGeneratePKCE(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
for b.Loop() {
|
||||
_, _, err := generatePKCE()
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
@@ -427,8 +427,7 @@ func BenchmarkGeneratePKCE(b *testing.B) {
|
||||
func BenchmarkTokenIsExpired(b *testing.B) {
|
||||
token := createTestToken("access", "refresh", 3600)
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for b.Loop() {
|
||||
token.IsExpired(5)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package gemini
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GeminiVoice represents a Gemini TTS voice with its characteristics
|
||||
@@ -126,16 +127,17 @@ func ListGeminiVoices(shellCompleteMode bool) string {
|
||||
if shellCompleteMode {
|
||||
// For shell completion, just return voice names
|
||||
names := GetGeminiVoiceNames()
|
||||
result := ""
|
||||
var result strings.Builder
|
||||
for _, name := range names {
|
||||
result += name + "\n"
|
||||
result.WriteString(name + "\n")
|
||||
}
|
||||
return result
|
||||
return result.String()
|
||||
}
|
||||
|
||||
// For human-readable output
|
||||
voices := GetGeminiVoices()
|
||||
result := "Available Gemini Text-to-Speech voices:\n\n"
|
||||
var result strings.Builder
|
||||
result.WriteString("Available Gemini Text-to-Speech voices:\n\n")
|
||||
|
||||
// Group by characteristics for better readability
|
||||
groups := map[string][]GeminiVoice{
|
||||
@@ -186,22 +188,22 @@ func ListGeminiVoices(shellCompleteMode bool) string {
|
||||
// Output grouped voices
|
||||
for groupName, groupVoices := range groups {
|
||||
if len(groupVoices) > 0 {
|
||||
result += fmt.Sprintf("%s:\n", groupName)
|
||||
result.WriteString(fmt.Sprintf("%s:\n", groupName))
|
||||
for _, voice := range groupVoices {
|
||||
defaultStr := ""
|
||||
if voice.Name == "Kore" {
|
||||
defaultStr = " (default)"
|
||||
}
|
||||
result += fmt.Sprintf(" %-15s - %s%s\n", voice.Name, voice.Description, defaultStr)
|
||||
result.WriteString(fmt.Sprintf(" %-15s - %s%s\n", voice.Name, voice.Description, defaultStr))
|
||||
}
|
||||
result += "\n"
|
||||
result.WriteString("\n")
|
||||
}
|
||||
}
|
||||
|
||||
result += "Use --voice <voice_name> to select a specific voice.\n"
|
||||
result += "Example: fabric --voice Charon -m gemini-2.5-flash-preview-tts -o output.wav \"Hello world\"\n"
|
||||
result.WriteString("Use --voice <voice_name> to select a specific voice.\n")
|
||||
result.WriteString("Example: fabric --voice Charon -m gemini-2.5-flash-preview-tts -o output.wav \"Hello world\"\n")
|
||||
|
||||
return result
|
||||
return result.String()
|
||||
}
|
||||
|
||||
// NOTE: This implementation maintains a curated list based on official Google documentation.
|
||||
|
||||
@@ -90,7 +90,7 @@ func (c *Client) ListModels() ([]string, error) {
|
||||
func (c *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan string) (err error) {
|
||||
url := fmt.Sprintf("%s/chat/completions", c.ApiUrl.Value)
|
||||
|
||||
payload := map[string]interface{}{
|
||||
payload := map[string]any{
|
||||
"messages": msgs,
|
||||
"model": opts.Model,
|
||||
"stream": true, // Enable streaming
|
||||
@@ -140,27 +140,27 @@ func (c *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.Cha
|
||||
continue
|
||||
}
|
||||
|
||||
if bytes.HasPrefix(line, []byte("data: ")) {
|
||||
line = bytes.TrimPrefix(line, []byte("data: "))
|
||||
if after, ok := bytes.CutPrefix(line, []byte("data: ")); ok {
|
||||
line = after
|
||||
}
|
||||
|
||||
if string(line) == "[DONE]" {
|
||||
break
|
||||
}
|
||||
|
||||
var result map[string]interface{}
|
||||
var result map[string]any
|
||||
if err = json.Unmarshal(line, &result); err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
var choices []interface{}
|
||||
var choices []any
|
||||
var ok bool
|
||||
if choices, ok = result["choices"].([]interface{}); !ok || len(choices) == 0 {
|
||||
if choices, ok = result["choices"].([]any); !ok || len(choices) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
var delta map[string]interface{}
|
||||
if delta, ok = choices[0].(map[string]interface{})["delta"].(map[string]interface{}); !ok {
|
||||
var delta map[string]any
|
||||
if delta, ok = choices[0].(map[string]any)["delta"].(map[string]any); !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func (c *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.Cha
|
||||
func (c *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (content string, err error) {
|
||||
url := fmt.Sprintf("%s/chat/completions", c.ApiUrl.Value)
|
||||
|
||||
payload := map[string]interface{}{
|
||||
payload := map[string]any{
|
||||
"messages": msgs,
|
||||
"model": opts.Model,
|
||||
// Add other options from opts if supported by LM Studio
|
||||
@@ -208,21 +208,21 @@ func (c *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, o
|
||||
return
|
||||
}
|
||||
|
||||
var result map[string]interface{}
|
||||
var result map[string]any
|
||||
if err = json.NewDecoder(resp.Body).Decode(&result); err != nil {
|
||||
err = fmt.Errorf("failed to decode response: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
var choices []interface{}
|
||||
var choices []any
|
||||
var ok bool
|
||||
if choices, ok = result["choices"].([]interface{}); !ok || len(choices) == 0 {
|
||||
if choices, ok = result["choices"].([]any); !ok || len(choices) == 0 {
|
||||
err = fmt.Errorf("invalid response format: missing or empty choices")
|
||||
return
|
||||
}
|
||||
|
||||
var message map[string]interface{}
|
||||
if message, ok = choices[0].(map[string]interface{})["message"].(map[string]interface{}); !ok {
|
||||
var message map[string]any
|
||||
if message, ok = choices[0].(map[string]any)["message"].(map[string]any); !ok {
|
||||
err = fmt.Errorf("invalid response format: missing message in first choice")
|
||||
return
|
||||
}
|
||||
@@ -238,7 +238,7 @@ func (c *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, o
|
||||
func (c *Client) Complete(ctx context.Context, prompt string, opts *domain.ChatOptions) (text string, err error) {
|
||||
url := fmt.Sprintf("%s/completions", c.ApiUrl.Value)
|
||||
|
||||
payload := map[string]interface{}{
|
||||
payload := map[string]any{
|
||||
"prompt": prompt,
|
||||
"model": opts.Model,
|
||||
// Add other options from opts if supported by LM Studio
|
||||
@@ -270,20 +270,20 @@ func (c *Client) Complete(ctx context.Context, prompt string, opts *domain.ChatO
|
||||
return
|
||||
}
|
||||
|
||||
var result map[string]interface{}
|
||||
var result map[string]any
|
||||
if err = json.NewDecoder(resp.Body).Decode(&result); err != nil {
|
||||
err = fmt.Errorf("failed to decode response: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
var choices []interface{}
|
||||
var choices []any
|
||||
var ok bool
|
||||
if choices, ok = result["choices"].([]interface{}); !ok || len(choices) == 0 {
|
||||
if choices, ok = result["choices"].([]any); !ok || len(choices) == 0 {
|
||||
err = fmt.Errorf("invalid response format: missing or empty choices")
|
||||
return
|
||||
}
|
||||
|
||||
if text, ok = choices[0].(map[string]interface{})["text"].(string); !ok {
|
||||
if text, ok = choices[0].(map[string]any)["text"].(string); !ok {
|
||||
err = fmt.Errorf("invalid response format: missing or non-string text in first choice")
|
||||
return
|
||||
}
|
||||
@@ -294,7 +294,7 @@ func (c *Client) Complete(ctx context.Context, prompt string, opts *domain.ChatO
|
||||
func (c *Client) GetEmbeddings(ctx context.Context, input string, opts *domain.ChatOptions) (embeddings []float64, err error) {
|
||||
url := fmt.Sprintf("%s/embeddings", c.ApiUrl.Value)
|
||||
|
||||
payload := map[string]interface{}{
|
||||
payload := map[string]any{
|
||||
"input": input,
|
||||
"model": opts.Model,
|
||||
// Add other options from opts if supported by LM Studio
|
||||
|
||||
@@ -2,7 +2,9 @@ package ollama
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -10,11 +12,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/chat"
|
||||
ollamaapi "github.com/ollama/ollama/api"
|
||||
"github.com/samber/lo"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/domain"
|
||||
debuglog "github.com/danielmiessler/fabric/internal/log"
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
ollamaapi "github.com/ollama/ollama/api"
|
||||
)
|
||||
|
||||
const defaultBaseUrl = "http://localhost:11434"
|
||||
@@ -48,6 +49,7 @@ type Client struct {
|
||||
apiUrl *url.URL
|
||||
client *ollamaapi.Client
|
||||
ApiHttpTimeout *plugins.SetupQuestion
|
||||
httpClient *http.Client
|
||||
}
|
||||
|
||||
type transport_sec struct {
|
||||
@@ -84,7 +86,8 @@ func (o *Client) configure() (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
o.client = ollamaapi.NewClient(o.apiUrl, &http.Client{Timeout: timeout, Transport: &transport_sec{underlyingTransport: http.DefaultTransport, ApiKey: o.ApiKey}})
|
||||
o.httpClient = &http.Client{Timeout: timeout, Transport: &transport_sec{underlyingTransport: http.DefaultTransport, ApiKey: o.ApiKey}}
|
||||
o.client = ollamaapi.NewClient(o.apiUrl, o.httpClient)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -104,15 +107,18 @@ func (o *Client) ListModels() (ret []string, err error) {
|
||||
}
|
||||
|
||||
func (o *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan string) (err error) {
|
||||
req := o.createChatRequest(msgs, opts)
|
||||
ctx := context.Background()
|
||||
|
||||
var req ollamaapi.ChatRequest
|
||||
if req, err = o.createChatRequest(ctx, msgs, opts); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
respFunc := func(resp ollamaapi.ChatResponse) (streamErr error) {
|
||||
channel <- resp.Message.Content
|
||||
return
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
if err = o.client.Chat(ctx, &req, respFunc); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -124,7 +130,10 @@ func (o *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.Cha
|
||||
func (o *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (ret string, err error) {
|
||||
bf := false
|
||||
|
||||
req := o.createChatRequest(msgs, opts)
|
||||
var req ollamaapi.ChatRequest
|
||||
if req, err = o.createChatRequest(ctx, msgs, opts); err != nil {
|
||||
return
|
||||
}
|
||||
req.Stream = &bf
|
||||
|
||||
respFunc := func(resp ollamaapi.ChatResponse) (streamErr error) {
|
||||
@@ -133,17 +142,20 @@ func (o *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, o
|
||||
}
|
||||
|
||||
if err = o.client.Chat(ctx, &req, respFunc); err != nil {
|
||||
fmt.Printf("FRED --> %s\n", err)
|
||||
debuglog.Debug(debuglog.Basic, "Ollama chat request failed: %v\n", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (o *Client) createChatRequest(msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (ret ollamaapi.ChatRequest) {
|
||||
messages := lo.Map(msgs, func(message *chat.ChatCompletionMessage, _ int) (ret ollamaapi.Message) {
|
||||
return ollamaapi.Message{Role: message.Role, Content: message.Content}
|
||||
})
|
||||
func (o *Client) createChatRequest(ctx context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (ret ollamaapi.ChatRequest, err error) {
|
||||
messages := make([]ollamaapi.Message, len(msgs))
|
||||
for i, message := range msgs {
|
||||
if messages[i], err = o.convertMessage(ctx, message); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
options := map[string]interface{}{
|
||||
options := map[string]any{
|
||||
"temperature": opts.Temperature,
|
||||
"presence_penalty": opts.PresencePenalty,
|
||||
"frequency_penalty": opts.FrequencyPenalty,
|
||||
@@ -162,6 +174,77 @@ func (o *Client) createChatRequest(msgs []*chat.ChatCompletionMessage, opts *dom
|
||||
return
|
||||
}
|
||||
|
||||
func (o *Client) convertMessage(ctx context.Context, message *chat.ChatCompletionMessage) (ret ollamaapi.Message, err error) {
|
||||
ret = ollamaapi.Message{Role: message.Role, Content: message.Content}
|
||||
|
||||
if len(message.MultiContent) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// Pre-allocate with capacity hint
|
||||
textParts := make([]string, 0, len(message.MultiContent))
|
||||
if strings.TrimSpace(ret.Content) != "" {
|
||||
textParts = append(textParts, strings.TrimSpace(ret.Content))
|
||||
}
|
||||
|
||||
for _, part := range message.MultiContent {
|
||||
switch part.Type {
|
||||
case chat.ChatMessagePartTypeText:
|
||||
if trimmed := strings.TrimSpace(part.Text); trimmed != "" {
|
||||
textParts = append(textParts, trimmed)
|
||||
}
|
||||
case chat.ChatMessagePartTypeImageURL:
|
||||
// Nil guard
|
||||
if part.ImageURL == nil || part.ImageURL.URL == "" {
|
||||
continue
|
||||
}
|
||||
var img []byte
|
||||
if img, err = o.loadImageBytes(ctx, part.ImageURL.URL); err != nil {
|
||||
return
|
||||
}
|
||||
ret.Images = append(ret.Images, ollamaapi.ImageData(img))
|
||||
}
|
||||
}
|
||||
|
||||
ret.Content = strings.Join(textParts, "\n")
|
||||
return
|
||||
}
|
||||
|
||||
func (o *Client) loadImageBytes(ctx context.Context, imageURL string) (ret []byte, err error) {
|
||||
// Handle data URLs (base64 encoded)
|
||||
if strings.HasPrefix(imageURL, "data:") {
|
||||
parts := strings.SplitN(imageURL, ",", 2)
|
||||
if len(parts) != 2 {
|
||||
err = fmt.Errorf("invalid data URL format")
|
||||
return
|
||||
}
|
||||
if ret, err = base64.StdEncoding.DecodeString(parts[1]); err != nil {
|
||||
err = fmt.Errorf("failed to decode data URL: %w", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Handle HTTP URLs with context
|
||||
var req *http.Request
|
||||
if req, err = http.NewRequestWithContext(ctx, http.MethodGet, imageURL, nil); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var resp *http.Response
|
||||
if resp, err = o.httpClient.Do(req); err != nil {
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode >= http.StatusBadRequest {
|
||||
err = fmt.Errorf("failed to fetch image %s: %s", imageURL, resp.Status)
|
||||
return
|
||||
}
|
||||
|
||||
ret, err = io.ReadAll(resp.Body)
|
||||
return
|
||||
}
|
||||
|
||||
func (o *Client) NeedsRawMode(modelName string) bool {
|
||||
ollamaSearchStrings := []string{
|
||||
"llama3",
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/domain"
|
||||
@@ -31,12 +32,7 @@ var ImageGenerationSupportedModels = []string{
|
||||
|
||||
// supportsImageGeneration checks if the given model supports the image_generation tool
|
||||
func supportsImageGeneration(model string) bool {
|
||||
for _, supportedModel := range ImageGenerationSupportedModels {
|
||||
if model == supportedModel {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(ImageGenerationSupportedModels, model)
|
||||
}
|
||||
|
||||
// getOutputFormatFromExtension determines the API output format based on file extension
|
||||
|
||||
@@ -345,7 +345,7 @@ func TestAddImageGenerationToolWithUserParameters(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
opts *domain.ChatOptions
|
||||
expected map[string]interface{}
|
||||
expected map[string]any
|
||||
}{
|
||||
{
|
||||
name: "All parameters specified",
|
||||
@@ -356,7 +356,7 @@ func TestAddImageGenerationToolWithUserParameters(t *testing.T) {
|
||||
ImageBackground: "transparent",
|
||||
ImageCompression: 0, // Not applicable for PNG
|
||||
},
|
||||
expected: map[string]interface{}{
|
||||
expected: map[string]any{
|
||||
"size": "1536x1024",
|
||||
"quality": "high",
|
||||
"background": "transparent",
|
||||
@@ -372,7 +372,7 @@ func TestAddImageGenerationToolWithUserParameters(t *testing.T) {
|
||||
ImageBackground: "opaque",
|
||||
ImageCompression: 75,
|
||||
},
|
||||
expected: map[string]interface{}{
|
||||
expected: map[string]any{
|
||||
"size": "1024x1024",
|
||||
"quality": "medium",
|
||||
"background": "opaque",
|
||||
@@ -386,7 +386,7 @@ func TestAddImageGenerationToolWithUserParameters(t *testing.T) {
|
||||
ImageFile: "/tmp/test.webp",
|
||||
ImageQuality: "low",
|
||||
},
|
||||
expected: map[string]interface{}{
|
||||
expected: map[string]any{
|
||||
"quality": "low",
|
||||
"output_format": "webp",
|
||||
},
|
||||
@@ -396,7 +396,7 @@ func TestAddImageGenerationToolWithUserParameters(t *testing.T) {
|
||||
opts: &domain.ChatOptions{
|
||||
ImageFile: "/tmp/test.png",
|
||||
},
|
||||
expected: map[string]interface{}{
|
||||
expected: map[string]any{
|
||||
"output_format": "png",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestBuildResponseRequestWithMaxTokens(t *testing.T) {
|
||||
|
||||
var msgs []*chat.ChatCompletionMessage
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
for range 2 {
|
||||
msgs = append(msgs, &chat.ChatCompletionMessage{
|
||||
Role: "User",
|
||||
Content: "My msg",
|
||||
@@ -42,7 +42,7 @@ func TestBuildResponseRequestNoMaxTokens(t *testing.T) {
|
||||
|
||||
var msgs []*chat.ChatCompletionMessage
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
for range 2 {
|
||||
msgs = append(msgs, &chat.ChatCompletionMessage{
|
||||
Role: "User",
|
||||
Content: "My msg",
|
||||
|
||||
@@ -165,6 +165,11 @@ var ProviderMap = map[string]ProviderConfig{
|
||||
BaseURL: "http://localhost:4000",
|
||||
ImplementsResponses: false,
|
||||
},
|
||||
"MiniMax": {
|
||||
Name: "MiniMax",
|
||||
BaseURL: "https://api.minimaxi.com/v1",
|
||||
ImplementsResponses: false,
|
||||
},
|
||||
"Mistral": {
|
||||
Name: "Mistral",
|
||||
BaseURL: "https://api.mistral.ai/v1",
|
||||
|
||||
@@ -30,6 +30,11 @@ func TestCreateClient(t *testing.T) {
|
||||
provider: "Abacus",
|
||||
exists: true,
|
||||
},
|
||||
{
|
||||
name: "Existing provider - MiniMax",
|
||||
provider: "MiniMax",
|
||||
exists: true,
|
||||
},
|
||||
{
|
||||
name: "Non-existent provider",
|
||||
provider: "NonExistent",
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/domain"
|
||||
@@ -107,18 +108,19 @@ func (c *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, o
|
||||
return "", fmt.Errorf("perplexity API request failed: %w", err) // Corrected capitalization
|
||||
}
|
||||
|
||||
content := resp.GetLastContent()
|
||||
var content strings.Builder
|
||||
content.WriteString(resp.GetLastContent())
|
||||
|
||||
// Append citations if available
|
||||
citations := resp.GetCitations()
|
||||
if len(citations) > 0 {
|
||||
content += "\n\n# CITATIONS\n\n"
|
||||
content.WriteString("\n\n# CITATIONS\n\n")
|
||||
for i, citation := range citations {
|
||||
content += fmt.Sprintf("- [%d] %s\n", i+1, citation)
|
||||
content.WriteString(fmt.Sprintf("- [%d] %s\n", i+1, citation))
|
||||
}
|
||||
}
|
||||
|
||||
return content, nil
|
||||
return content.String(), nil
|
||||
}
|
||||
|
||||
func (c *Client) SendStream(msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan string) error {
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
"github.com/danielmiessler/fabric/internal/plugins/template"
|
||||
"github.com/danielmiessler/fabric/internal/util"
|
||||
)
|
||||
@@ -128,7 +129,16 @@ func (o *PatternsEntity) getFromDB(name string) (ret *Pattern, err error) {
|
||||
|
||||
var pattern []byte
|
||||
if pattern, err = os.ReadFile(patternPath); err != nil {
|
||||
return
|
||||
// Check if the patterns directory is empty to provide helpful error message
|
||||
if os.IsNotExist(err) {
|
||||
var entries []os.DirEntry
|
||||
entries, _ = os.ReadDir(o.Dir)
|
||||
if len(entries) == 0 || (len(entries) == 1 && entries[0].Name() == "loaded") {
|
||||
// Patterns directory is empty or only has 'loaded' file
|
||||
return nil, fmt.Errorf(i18n.T("pattern_not_found_no_patterns"), name)
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf(i18n.T("pattern_not_found_list_available"), name)
|
||||
}
|
||||
|
||||
patternStr := string(pattern)
|
||||
|
||||
@@ -134,7 +134,7 @@ func (o *StorageEntity) buildFileName(name string) string {
|
||||
return fmt.Sprintf("%s%v", name, o.FileExtension)
|
||||
}
|
||||
|
||||
func (o *StorageEntity) SaveAsJson(name string, item interface{}) (err error) {
|
||||
func (o *StorageEntity) SaveAsJson(name string, item any) (err error) {
|
||||
var jsonString []byte
|
||||
if jsonString, err = json.Marshal(item); err == nil {
|
||||
err = o.Save(name, jsonString)
|
||||
@@ -145,7 +145,7 @@ func (o *StorageEntity) SaveAsJson(name string, item interface{}) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (o *StorageEntity) LoadAsJson(name string, item interface{}) (err error) {
|
||||
func (o *StorageEntity) LoadAsJson(name string, item any) (err error) {
|
||||
var content []byte
|
||||
if content, err = o.Load(name); err != nil {
|
||||
return
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
)
|
||||
|
||||
const AnswerReset = "reset"
|
||||
@@ -55,12 +57,22 @@ func (o *PluginBase) AddSetupQuestionCustom(name string, required bool, question
|
||||
setting := o.AddSetting(name, required)
|
||||
ret = &SetupQuestion{Setting: setting, Question: question}
|
||||
if ret.Question == "" {
|
||||
ret.Question = fmt.Sprintf("Enter your %v %v", o.Name, strings.ToUpper(name))
|
||||
ret.Question = fmt.Sprintf(i18n.T("plugin_enter_value"), o.Name, strings.ToUpper(name))
|
||||
}
|
||||
o.SetupQuestions = append(o.SetupQuestions, ret)
|
||||
return
|
||||
}
|
||||
|
||||
// AddSetupQuestionWithEnvName creates a setup question with an explicit environment variable name.
|
||||
// This is useful when you want the environment variable name to remain constant across languages.
|
||||
// The envVarName is used for the environment variable, while the question is localized.
|
||||
func (o *PluginBase) AddSetupQuestionWithEnvName(envVarName string, required bool, question string) (ret *SetupQuestion) {
|
||||
setting := o.AddSetting(envVarName, required)
|
||||
ret = &SetupQuestion{Setting: setting, Question: question}
|
||||
o.SetupQuestions = append(o.SetupQuestions, ret)
|
||||
return
|
||||
}
|
||||
|
||||
func (o *PluginBase) AddSetupQuestionBool(name string, required bool) (ret *SetupQuestion) {
|
||||
return o.AddSetupQuestionCustomBool(name, required, "")
|
||||
}
|
||||
@@ -70,7 +82,7 @@ func (o *PluginBase) AddSetupQuestionCustomBool(name string, required bool, ques
|
||||
setting.Type = SettingTypeBool
|
||||
ret = &SetupQuestion{Setting: setting, Question: question}
|
||||
if ret.Question == "" {
|
||||
ret.Question = fmt.Sprintf("Enable %v %v (true/false)", o.Name, strings.ToUpper(name))
|
||||
ret.Question = fmt.Sprintf(i18n.T("plugin_enable_bool_question"), o.Name, strings.ToUpper(name))
|
||||
}
|
||||
o.SetupQuestions = append(o.SetupQuestions, ret)
|
||||
return
|
||||
@@ -92,13 +104,17 @@ func (o *PluginBase) Setup() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
err = o.Configure()
|
||||
// After Setup, run ConfigureCustom if present, but skip re-validation
|
||||
// since Ask() already validated user input (or allowed explicit reset)
|
||||
if o.ConfigureCustom != nil {
|
||||
err = o.ConfigureCustom()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (o *PluginBase) SetupOrSkip() (err error) {
|
||||
if err = o.Setup(); err != nil {
|
||||
fmt.Printf("[%v] skipped\n", o.GetName())
|
||||
fmt.Printf(i18n.T("plugin_setup_skipped"), o.GetName())
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -166,7 +182,7 @@ func ParseBool(val string) (bool, error) {
|
||||
case "0", "false", "no", "off":
|
||||
return false, nil
|
||||
}
|
||||
return false, fmt.Errorf("invalid bool: %q", val)
|
||||
return false, fmt.Errorf(i18n.T("plugin_invalid_bool"), val)
|
||||
}
|
||||
|
||||
type SetupQuestion struct {
|
||||
@@ -187,34 +203,37 @@ func (o *SetupQuestion) Ask(label string) (err error) {
|
||||
if v, err := ParseBool(o.Value); err == nil && v {
|
||||
current = "true"
|
||||
}
|
||||
fmt.Printf("%v%v (true/false, leave empty for '%s' or type '%v' to remove the value):\n",
|
||||
prefix, o.Question, current, AnswerReset)
|
||||
fmt.Printf(i18n.T("plugin_question_bool"), prefix, o.Question, current, AnswerReset)
|
||||
} else if o.Value != "" {
|
||||
fmt.Printf("%v%v (leave empty for '%s' or type '%v' to remove the value):\n",
|
||||
prefix, o.Question, o.Value, AnswerReset)
|
||||
fmt.Printf(i18n.T("plugin_question_with_default"), prefix, o.Question, o.Value, AnswerReset)
|
||||
} else {
|
||||
fmt.Printf("%v%v (leave empty to skip):\n", prefix, o.Question)
|
||||
fmt.Printf(i18n.T("plugin_question_optional"), prefix, o.Question)
|
||||
}
|
||||
var answer string
|
||||
fmt.Scanln(&answer)
|
||||
answer = strings.TrimRight(answer, "\n")
|
||||
isReset := strings.ToLower(answer) == AnswerReset
|
||||
if answer == "" {
|
||||
answer = o.Value
|
||||
} else if strings.ToLower(answer) == AnswerReset {
|
||||
} else if isReset {
|
||||
answer = ""
|
||||
}
|
||||
err = o.OnAnswer(answer)
|
||||
err = o.OnAnswerWithReset(answer, isReset)
|
||||
return
|
||||
}
|
||||
|
||||
func (o *SetupQuestion) OnAnswer(answer string) (err error) {
|
||||
return o.OnAnswerWithReset(answer, false)
|
||||
}
|
||||
|
||||
func (o *SetupQuestion) OnAnswerWithReset(answer string, isReset bool) (err error) {
|
||||
if o.Type == SettingTypeBool {
|
||||
if answer == "" {
|
||||
o.Value = ""
|
||||
} else {
|
||||
_, err := ParseBool(answer)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid boolean value: %v", answer)
|
||||
return fmt.Errorf(i18n.T("plugin_invalid_boolean_value"), answer)
|
||||
}
|
||||
o.Value = strings.ToLower(answer)
|
||||
}
|
||||
@@ -226,13 +245,18 @@ func (o *SetupQuestion) OnAnswer(answer string) (err error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Skip validation when explicitly resetting a value - the user intentionally
|
||||
// wants to clear the value even if it's required
|
||||
if isReset {
|
||||
return nil
|
||||
}
|
||||
err = o.IsValidErr()
|
||||
return
|
||||
}
|
||||
|
||||
func (o *Setting) IsValidErr() (err error) {
|
||||
if !o.IsValid() {
|
||||
err = fmt.Errorf("%v=%v, is not valid", o.EnvVariable, o.Value)
|
||||
err = fmt.Errorf(i18n.T("plugin_setting_not_valid"), o.EnvVariable, o.Value)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -303,5 +327,8 @@ func BuildEnvVariablePrefix(name string) (ret string) {
|
||||
|
||||
func BuildEnvVariable(name string) string {
|
||||
name = strings.TrimSpace(name)
|
||||
return strings.ReplaceAll(strings.ToUpper(name), " ", "_")
|
||||
name = strings.ToUpper(name)
|
||||
name = strings.ReplaceAll(name, " ", "_")
|
||||
name = strings.ReplaceAll(name, "-", "_")
|
||||
return name
|
||||
}
|
||||
|
||||
@@ -116,6 +116,91 @@ func TestSetupQuestion_Ask(t *testing.T) {
|
||||
assert.Equal(t, "user_value", setting.Value)
|
||||
}
|
||||
|
||||
func TestSetupQuestion_Ask_Reset(t *testing.T) {
|
||||
// Test that resetting a required field doesn't produce an error
|
||||
setting := &Setting{
|
||||
EnvVariable: "TEST_RESET_SETTING",
|
||||
Value: "existing_value",
|
||||
Required: true,
|
||||
}
|
||||
question := &SetupQuestion{
|
||||
Setting: setting,
|
||||
Question: "Enter test setting:",
|
||||
}
|
||||
input := "reset\n"
|
||||
fmtInput := captureInput(input)
|
||||
defer fmtInput()
|
||||
err := question.Ask("TestConfigurable")
|
||||
// Should NOT return an error even though the field is required
|
||||
assert.NoError(t, err)
|
||||
// Value should be cleared
|
||||
assert.Equal(t, "", setting.Value)
|
||||
}
|
||||
|
||||
func TestSetupQuestion_OnAnswerWithReset(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
setting *Setting
|
||||
answer string
|
||||
isReset bool
|
||||
expectError bool
|
||||
expectValue string
|
||||
}{
|
||||
{
|
||||
name: "reset required field should not error",
|
||||
setting: &Setting{
|
||||
EnvVariable: "TEST_SETTING",
|
||||
Value: "old_value",
|
||||
Required: true,
|
||||
},
|
||||
answer: "",
|
||||
isReset: true,
|
||||
expectError: false,
|
||||
expectValue: "",
|
||||
},
|
||||
{
|
||||
name: "empty answer on required field should error",
|
||||
setting: &Setting{
|
||||
EnvVariable: "TEST_SETTING",
|
||||
Value: "",
|
||||
Required: true,
|
||||
},
|
||||
answer: "",
|
||||
isReset: false,
|
||||
expectError: true,
|
||||
expectValue: "",
|
||||
},
|
||||
{
|
||||
name: "valid answer on required field should not error",
|
||||
setting: &Setting{
|
||||
EnvVariable: "TEST_SETTING",
|
||||
Value: "",
|
||||
Required: true,
|
||||
},
|
||||
answer: "new_value",
|
||||
isReset: false,
|
||||
expectError: false,
|
||||
expectValue: "new_value",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
question := &SetupQuestion{
|
||||
Setting: tt.setting,
|
||||
Question: "Test question",
|
||||
}
|
||||
err := question.OnAnswerWithReset(tt.answer, tt.isReset)
|
||||
if tt.expectError {
|
||||
assert.Error(t, err)
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
assert.Equal(t, tt.expectValue, tt.setting.Value)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSettings_IsConfigured(t *testing.T) {
|
||||
settings := Settings{
|
||||
{EnvVariable: "TEST_SETTING1", Value: "value1", Required: true},
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
"github.com/danielmiessler/fabric/internal/tools/githelper"
|
||||
)
|
||||
@@ -26,18 +27,18 @@ func NewStrategiesManager() (sm *StrategiesManager) {
|
||||
Strategies: strategies,
|
||||
}
|
||||
sm.PluginBase = &plugins.PluginBase{
|
||||
Name: label,
|
||||
SetupDescription: "Strategies - Downloads Prompting Strategies (like chain of thought) [required]",
|
||||
Name: i18n.T("strategies_label"),
|
||||
SetupDescription: i18n.T("strategies_setup_description") + " " + i18n.T("required_marker"),
|
||||
EnvNamePrefix: plugins.BuildEnvVariablePrefix(label),
|
||||
ConfigureCustom: sm.configure,
|
||||
}
|
||||
|
||||
sm.DefaultGitRepoUrl = sm.AddSetupQuestionCustom("Git Repo Url", true,
|
||||
"Enter the default Git repository URL for the strategies")
|
||||
sm.DefaultGitRepoUrl = sm.AddSetupQuestionWithEnvName("Git Repo Url", true,
|
||||
i18n.T("strategies_git_repo_url_question"))
|
||||
sm.DefaultGitRepoUrl.Value = DefaultStrategiesGitRepoUrl
|
||||
|
||||
sm.DefaultFolder = sm.AddSetupQuestionCustom("Git Repo Strategies Folder", true,
|
||||
"Enter the default folder in the Git repository where strategies are stored")
|
||||
sm.DefaultFolder = sm.AddSetupQuestionWithEnvName("Git Repo Strategies Folder", true,
|
||||
i18n.T("strategies_git_repo_folder_question"))
|
||||
sm.DefaultFolder.Value = DefaultStrategiesGitRepoFolder
|
||||
|
||||
return
|
||||
@@ -103,33 +104,39 @@ func (sm *StrategiesManager) Setup() (err error) {
|
||||
if err = sm.PopulateDB(); err != nil {
|
||||
return
|
||||
}
|
||||
// Reload strategies after downloading so IsConfigured() reflects the new state
|
||||
sm.Strategies, _ = LoadAllFiles()
|
||||
return
|
||||
}
|
||||
|
||||
// PopulateDB downloads strategies from the internet and populates the strategies folder
|
||||
func (sm *StrategiesManager) PopulateDB() (err error) {
|
||||
stageDir, _ := getStrategyDir()
|
||||
fmt.Printf("Downloading strategies and Populating %s...\n", stageDir)
|
||||
strategyDir, _ := getStrategyDir()
|
||||
fmt.Printf(i18n.T("strategies_downloading"), strategyDir)
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
if err = sm.gitCloneAndCopy(); err != nil {
|
||||
return
|
||||
}
|
||||
fmt.Printf(i18n.T("strategies_download_success"), strategyDir)
|
||||
return
|
||||
}
|
||||
|
||||
func (sm *StrategiesManager) gitCloneAndCopy() (err error) {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not get home directory: %v", err)
|
||||
err = fmt.Errorf(i18n.T("strategies_home_dir_error"), err)
|
||||
return
|
||||
}
|
||||
strategyDir := filepath.Join(homeDir, ".config", "fabric", "strategies")
|
||||
|
||||
// Create the directory if it doesn't exist
|
||||
if err = os.MkdirAll(strategyDir, os.ModePerm); err != nil {
|
||||
return fmt.Errorf("failed to create strategies directory: %w", err)
|
||||
return fmt.Errorf(i18n.T("strategies_failed_create_directory"), err)
|
||||
}
|
||||
|
||||
fmt.Printf(i18n.T("strategies_cloning_repository"), sm.DefaultGitRepoUrl.Value, sm.DefaultFolder.Value)
|
||||
|
||||
// Use the helper to fetch files
|
||||
err = githelper.FetchFilesFromRepo(githelper.FetchOptions{
|
||||
RepoURL: sm.DefaultGitRepoUrl.Value,
|
||||
@@ -138,7 +145,19 @@ func (sm *StrategiesManager) gitCloneAndCopy() (err error) {
|
||||
SingleDirectory: true,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to download strategies: %w", err)
|
||||
return fmt.Errorf(i18n.T("strategies_failed_download"), err)
|
||||
}
|
||||
|
||||
// Count downloaded strategies
|
||||
entries, readErr := os.ReadDir(strategyDir)
|
||||
if readErr == nil {
|
||||
strategyCount := 0
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir() && filepath.Ext(entry.Name()) == ".json" {
|
||||
strategyCount++
|
||||
}
|
||||
}
|
||||
fmt.Printf(i18n.T("strategies_downloaded_count"), strategyCount)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -153,7 +172,7 @@ func (sm *StrategiesManager) configure() (err error) {
|
||||
func getStrategyDir() (ret string, err error) {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not get home directory: %v, using current directory instead", err)
|
||||
err = fmt.Errorf(i18n.T("strategies_home_dir_fallback"), err)
|
||||
ret = filepath.Join(".", "data/strategies")
|
||||
return
|
||||
}
|
||||
@@ -178,7 +197,7 @@ func LoadStrategy(filename string) (*Strategy, error) {
|
||||
// Try without extension
|
||||
strategyPath = filepath.Join(strategyDir, filename)
|
||||
if _, err := os.Stat(strategyPath); os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("strategy %s not found. Please run 'fabric --liststrategies' for list", filename)
|
||||
return nil, fmt.Errorf(i18n.T("strategy_not_found"), filename)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,10 +218,10 @@ func LoadStrategy(filename string) (*Strategy, error) {
|
||||
// ListStrategies prints available strategies
|
||||
func (sm *StrategiesManager) ListStrategies(shellCompleteList bool) error {
|
||||
if len(sm.Strategies) == 0 {
|
||||
return fmt.Errorf("no strategies found. Please run 'fabric --setup' to download strategies")
|
||||
return fmt.Errorf("%s", i18n.T("strategies_none_found"))
|
||||
}
|
||||
if !shellCompleteList {
|
||||
fmt.Print("Available Strategies:\n\n")
|
||||
fmt.Print(i18n.T("strategies_available_header"), "\n\n")
|
||||
}
|
||||
// Get all strategy names for sorting
|
||||
names := []string{}
|
||||
|
||||
@@ -187,9 +187,10 @@ esac`
|
||||
executor := NewExtensionExecutor(registry)
|
||||
|
||||
// Helper function to create and register extension
|
||||
createExtension := func(name, opName, cmdTemplate string, config map[string]interface{}) error {
|
||||
createExtension := func(name, opName, cmdTemplate string, config map[string]any) error {
|
||||
configPath := filepath.Join(tmpDir, name+".yaml")
|
||||
configContent := `name: ` + name + `
|
||||
var configContent strings.Builder
|
||||
configContent.WriteString(`name: ` + name + `
|
||||
executable: ` + testScript + `
|
||||
type: executable
|
||||
timeout: 30s
|
||||
@@ -199,14 +200,14 @@ operations:
|
||||
config:
|
||||
output:
|
||||
method: file
|
||||
file_config:`
|
||||
file_config:`)
|
||||
|
||||
// Add config options
|
||||
for k, v := range config {
|
||||
configContent += "\n " + k + ": " + strings.TrimSpace(v.(string))
|
||||
configContent.WriteString("\n " + k + ": " + strings.TrimSpace(v.(string)))
|
||||
}
|
||||
|
||||
if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil {
|
||||
if err := os.WriteFile(configPath, []byte(configContent.String()), 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ config:
|
||||
// Test basic fixed file output
|
||||
t.Run("BasicFixedFile", func(t *testing.T) {
|
||||
outputFile := filepath.Join(tmpDir, "output.txt")
|
||||
config := map[string]interface{}{
|
||||
config := map[string]any{
|
||||
"output_file": `"output.txt"`,
|
||||
"work_dir": `"` + tmpDir + `"`,
|
||||
"cleanup": "true",
|
||||
@@ -241,7 +242,7 @@ config:
|
||||
|
||||
// Test no work_dir specified
|
||||
t.Run("NoWorkDir", func(t *testing.T) {
|
||||
config := map[string]interface{}{
|
||||
config := map[string]any{
|
||||
"output_file": `"direct-output.txt"`,
|
||||
"cleanup": "true",
|
||||
}
|
||||
@@ -263,7 +264,7 @@ config:
|
||||
outputFile := filepath.Join(tmpDir, "cleanup-test.txt")
|
||||
|
||||
// Test with cleanup enabled
|
||||
config := map[string]interface{}{
|
||||
config := map[string]any{
|
||||
"output_file": `"cleanup-test.txt"`,
|
||||
"work_dir": `"` + tmpDir + `"`,
|
||||
"cleanup": "true",
|
||||
@@ -307,7 +308,7 @@ config:
|
||||
// Test error cases
|
||||
t.Run("ErrorCases", func(t *testing.T) {
|
||||
outputFile := filepath.Join(tmpDir, "error-test.txt")
|
||||
config := map[string]interface{}{
|
||||
config := map[string]any{
|
||||
"output_file": `"error-test.txt"`,
|
||||
"work_dir": `"` + tmpDir + `"`,
|
||||
"cleanup": "true",
|
||||
@@ -341,7 +342,7 @@ config:
|
||||
|
||||
// Test with missing output_file
|
||||
t.Run("MissingOutputFile", func(t *testing.T) {
|
||||
config := map[string]interface{}{
|
||||
config := map[string]any{
|
||||
"work_dir": `"` + tmpDir + `"`,
|
||||
"cleanup": "true",
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type ExtensionDefinition struct {
|
||||
Operations map[string]OperationConfig `yaml:"operations"`
|
||||
|
||||
// Additional config
|
||||
Config map[string]interface{} `yaml:"config"`
|
||||
Config map[string]any `yaml:"config"`
|
||||
}
|
||||
|
||||
type OperationConfig struct {
|
||||
@@ -53,7 +53,7 @@ type ExtensionRegistry struct {
|
||||
|
||||
// Helper methods for Config access
|
||||
func (e *ExtensionDefinition) GetOutputMethod() string {
|
||||
if output, ok := e.Config["output"].(map[string]interface{}); ok {
|
||||
if output, ok := e.Config["output"].(map[string]any); ok {
|
||||
if method, ok := output["method"].(string); ok {
|
||||
return method
|
||||
}
|
||||
@@ -61,9 +61,9 @@ func (e *ExtensionDefinition) GetOutputMethod() string {
|
||||
return "stdout" // default to stdout if not specified
|
||||
}
|
||||
|
||||
func (e *ExtensionDefinition) GetFileConfig() map[string]interface{} {
|
||||
if output, ok := e.Config["output"].(map[string]interface{}); ok {
|
||||
if fileConfig, ok := output["file_config"].(map[string]interface{}); ok {
|
||||
func (e *ExtensionDefinition) GetFileConfig() map[string]any {
|
||||
if output, ok := e.Config["output"].(map[string]any); ok {
|
||||
if fileConfig, ok := output["file_config"].(map[string]any); ok {
|
||||
return fileConfig
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func init() {
|
||||
var pluginPattern = regexp.MustCompile(`\{\{plugin:([^:]+):([^:]+)(?::([^}]+))?\}\}`)
|
||||
var extensionPattern = regexp.MustCompile(`\{\{ext:([^:]+):([^:]+)(?::([^}]+))?\}\}`)
|
||||
|
||||
func debugf(format string, a ...interface{}) {
|
||||
func debugf(format string, a ...any) {
|
||||
debuglog.Debug(debuglog.Trace, format, a...)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ func toTitle(s string) string {
|
||||
lower := strings.ToLower(s)
|
||||
runes := []rune(lower)
|
||||
|
||||
for i := 0; i < len(runes); i++ {
|
||||
for i := range runes {
|
||||
// Capitalize if previous char is non-letter AND
|
||||
// (we're at the end OR next char is not space)
|
||||
if i == 0 || !unicode.IsLetter(runes[i-1]) {
|
||||
|
||||
@@ -2,14 +2,25 @@ package restapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
const APIKeyHeader = "X-API-Key"
|
||||
|
||||
// APIKeyMiddleware validates API key for protected endpoints.
|
||||
// Swagger documentation endpoints (/swagger/*) are exempt from authentication
|
||||
// to allow users to browse and test the API documentation freely.
|
||||
func APIKeyMiddleware(apiKey string) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// Skip authentication for Swagger documentation endpoints
|
||||
// This allows public access to API docs even when authentication is enabled
|
||||
if strings.HasPrefix(c.Request.URL.Path, "/swagger/") {
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
||||
headerApiKey := c.GetHeader(APIKeyHeader)
|
||||
|
||||
if headerApiKey == "" {
|
||||
|
||||
@@ -55,6 +55,17 @@ func NewChatHandler(r *gin.Engine, registry *core.PluginRegistry, db *fsdb.Db) *
|
||||
return handler
|
||||
}
|
||||
|
||||
// HandleChat godoc
|
||||
// @Summary Stream chat completions
|
||||
// @Description Stream AI responses using Server-Sent Events (SSE)
|
||||
// @Tags chat
|
||||
// @Accept json
|
||||
// @Produce text/event-stream
|
||||
// @Param request body ChatRequest true "Chat request with prompts and options"
|
||||
// @Success 200 {object} StreamResponse "Streaming response"
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /chat [post]
|
||||
func (h *ChatHandler) HandleChat(c *gin.Context) {
|
||||
var request ChatRequest
|
||||
|
||||
|
||||
@@ -17,6 +17,15 @@ func NewModelsHandler(r *gin.Engine, vendorManager *ai.VendorsManager) {
|
||||
r.GET("/models/names", handler.GetModelNames)
|
||||
}
|
||||
|
||||
// GetModelNames godoc
|
||||
// @Summary List all available models
|
||||
// @Description Get a list of all available AI models grouped by vendor
|
||||
// @Tags models
|
||||
// @Produce json
|
||||
// @Success 200 {object} map[string]interface{} "Returns models (array) and vendors (map)"
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /models/names [get]
|
||||
func (h *ModelsHandler) GetModelNames(c *gin.Context) {
|
||||
vendorsModels, err := h.vendorManager.GetModels()
|
||||
if err != nil {
|
||||
@@ -24,7 +33,7 @@ func (h *ModelsHandler) GetModelNames(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response := make(map[string]interface{})
|
||||
response := make(map[string]any)
|
||||
vendors := make(map[string][]string)
|
||||
|
||||
for _, groupItems := range vendorsModels.GroupsItems {
|
||||
|
||||
@@ -102,7 +102,7 @@ func ServeOllama(registry *core.PluginRegistry, address string, version string)
|
||||
// Ollama Endpoints
|
||||
r.GET("/api/tags", typeConversion.ollamaTags)
|
||||
r.GET("/api/version", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", []byte(fmt.Sprintf("{\"%s\"}", version)))
|
||||
c.Data(200, "application/json", fmt.Appendf(nil, "{\"%s\"}", version))
|
||||
})
|
||||
r.POST("/api/chat", typeConversion.ollamaChat)
|
||||
|
||||
@@ -224,7 +224,7 @@ func (f APIConvert) ollamaChat(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "testing endpoint"})
|
||||
return
|
||||
}
|
||||
for _, word := range strings.Split(fabricResponse.Content, " ") {
|
||||
for word := range strings.SplitSeq(fabricResponse.Content, " ") {
|
||||
forwardedResponse = OllamaResponse{
|
||||
Model: "",
|
||||
CreatedAt: "",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package restapi
|
||||
|
||||
import (
|
||||
"maps"
|
||||
"net/http"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/plugins/db/fsdb"
|
||||
@@ -32,6 +33,16 @@ func NewPatternsHandler(r *gin.Engine, patterns *fsdb.PatternsEntity) (ret *Patt
|
||||
}
|
||||
|
||||
// Get handles the GET /patterns/:name route - returns raw pattern without variable processing
|
||||
// @Summary Get a pattern
|
||||
// @Description Retrieve a pattern by name
|
||||
// @Tags patterns
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param name path string true "Pattern name"
|
||||
// @Success 200 {object} fsdb.Pattern
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /patterns/{name} [get]
|
||||
func (h *PatternsHandler) Get(c *gin.Context) {
|
||||
name := c.Param("name")
|
||||
|
||||
@@ -58,6 +69,18 @@ type PatternApplyRequest struct {
|
||||
}
|
||||
|
||||
// ApplyPattern handles the POST /patterns/:name/apply route
|
||||
// @Summary Apply pattern with variables
|
||||
// @Description Apply a pattern with variable substitution
|
||||
// @Tags patterns
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param name path string true "Pattern name"
|
||||
// @Param request body PatternApplyRequest true "Pattern application request"
|
||||
// @Success 200 {object} fsdb.Pattern
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /patterns/{name}/apply [post]
|
||||
func (h *PatternsHandler) ApplyPattern(c *gin.Context) {
|
||||
name := c.Param("name")
|
||||
|
||||
@@ -74,9 +97,7 @@ func (h *PatternsHandler) ApplyPattern(c *gin.Context) {
|
||||
variables[key] = values[0]
|
||||
}
|
||||
}
|
||||
for key, value := range request.Variables {
|
||||
variables[key] = value
|
||||
}
|
||||
maps.Copy(variables, request.Variables)
|
||||
|
||||
pattern, err := h.patterns.GetApplyVariables(name, variables, request.Input)
|
||||
if err != nil {
|
||||
|
||||
@@ -2,11 +2,30 @@ package restapi
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/core"
|
||||
"github.com/gin-gonic/gin"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
|
||||
_ "github.com/danielmiessler/fabric/docs" // swagger docs
|
||||
)
|
||||
|
||||
// @title Fabric REST API
|
||||
// @version 1.0
|
||||
// @description REST API for Fabric AI augmentation framework. Provides endpoints for chat completions, pattern management, contexts, sessions, and more.
|
||||
// @contact.name Fabric Support
|
||||
// @contact.url https://github.com/danielmiessler/fabric
|
||||
// @license.name MIT
|
||||
// @license.url https://opensource.org/licenses/MIT
|
||||
// @host localhost:8080
|
||||
// @BasePath /
|
||||
// @securityDefinitions.apikey ApiKeyAuth
|
||||
// @in header
|
||||
// @name X-API-Key
|
||||
func Serve(registry *core.PluginRegistry, address string, apiKey string) (err error) {
|
||||
r := gin.New()
|
||||
|
||||
@@ -20,6 +39,32 @@ func Serve(registry *core.PluginRegistry, address string, apiKey string) (err er
|
||||
slog.Warn("Starting REST API server without API key authentication. This may pose security risks.")
|
||||
}
|
||||
|
||||
// Swagger UI and documentation endpoint with custom YAML handler
|
||||
r.GET("/swagger/*any", func(c *gin.Context) {
|
||||
// Check if request is for swagger.yaml
|
||||
if c.Param("any") == "/swagger.yaml" {
|
||||
// Try to find swagger.yaml relative to current directory or executable
|
||||
yamlPath := "docs/swagger.yaml"
|
||||
if _, err := os.Stat(yamlPath); os.IsNotExist(err) {
|
||||
// Try relative to executable
|
||||
if exePath, err := os.Executable(); err == nil {
|
||||
yamlPath = filepath.Join(filepath.Dir(exePath), "docs", "swagger.yaml")
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Stat(yamlPath); err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "swagger.yaml not found - generate it with: swag init -g internal/server/serve.go -o docs"})
|
||||
return
|
||||
}
|
||||
|
||||
c.File(yamlPath)
|
||||
return
|
||||
}
|
||||
|
||||
// For all other swagger paths, use the default handler
|
||||
ginSwagger.WrapHandler(swaggerFiles.Handler)(c)
|
||||
})
|
||||
|
||||
// Register routes
|
||||
fabricDb := registry.Db
|
||||
NewPatternsHandler(r, fabricDb.Patterns)
|
||||
|
||||
@@ -12,15 +12,19 @@ type YouTubeHandler struct {
|
||||
yt *youtube.YouTube
|
||||
}
|
||||
|
||||
// YouTubeRequest represents a request to get a YouTube video transcript
|
||||
type YouTubeRequest struct {
|
||||
URL string `json:"url"`
|
||||
Language string `json:"language"`
|
||||
Timestamps bool `json:"timestamps"`
|
||||
URL string `json:"url" binding:"required" example:"https://www.youtube.com/watch?v=dQw4w9WgXcQ"` // YouTube video URL (required)
|
||||
Language string `json:"language,omitempty" example:"en"` // Language code for transcript (default: "en")
|
||||
Timestamps bool `json:"timestamps,omitempty" example:"false"` // Include timestamps in the transcript (default: false)
|
||||
}
|
||||
|
||||
// YouTubeResponse represents the response containing video transcript and metadata
|
||||
type YouTubeResponse struct {
|
||||
Transcript string `json:"transcript"`
|
||||
Title string `json:"title"`
|
||||
Transcript string `json:"transcript" example:"This is the video transcript..."` // The video transcript text
|
||||
VideoId string `json:"videoId" example:"dQw4w9WgXcQ"` // YouTube video ID
|
||||
Title string `json:"title" example:"Example Video Title"` // Video title from YouTube metadata
|
||||
Description string `json:"description" example:"This is the video description from YouTube..."` // Video description from YouTube metadata
|
||||
}
|
||||
|
||||
func NewYouTubeHandler(r *gin.Engine, registry *core.PluginRegistry) *YouTubeHandler {
|
||||
@@ -29,6 +33,18 @@ func NewYouTubeHandler(r *gin.Engine, registry *core.PluginRegistry) *YouTubeHan
|
||||
return handler
|
||||
}
|
||||
|
||||
// Transcript godoc
|
||||
// @Summary Get YouTube video transcript
|
||||
// @Description Retrieves the transcript of a YouTube video along with video metadata (title and description)
|
||||
// @Tags youtube
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body YouTubeRequest true "YouTube transcript request with URL, language, and timestamp options"
|
||||
// @Success 200 {object} YouTubeResponse "Successful response with transcript and metadata"
|
||||
// @Failure 400 {object} map[string]string "Bad request - invalid URL or playlist URL provided"
|
||||
// @Failure 500 {object} map[string]string "Internal server error - failed to retrieve transcript or metadata"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /youtube/transcript [post]
|
||||
func (h *YouTubeHandler) Transcript(c *gin.Context) {
|
||||
var req YouTubeRequest
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
@@ -55,6 +71,20 @@ func (h *YouTubeHandler) Transcript(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Try to get metadata (requires valid YouTube API key), but don't fail if unavailable
|
||||
// This allows the endpoint to work for transcript extraction even without API key
|
||||
var metadata *youtube.VideoMetadata
|
||||
var title, description string
|
||||
if metadata, err = h.yt.GrabMetadata(videoID); err == nil {
|
||||
// Metadata available - use title and description from API
|
||||
title = metadata.Title
|
||||
description = metadata.Description
|
||||
} else {
|
||||
// No valid API key or metadata fetch failed - fallback to videoID as title
|
||||
title = videoID
|
||||
description = ""
|
||||
}
|
||||
|
||||
var transcript string
|
||||
if req.Timestamps {
|
||||
transcript, err = h.yt.GrabTranscriptWithTimestamps(videoID, language)
|
||||
@@ -66,5 +96,5 @@ func (h *YouTubeHandler) Transcript(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, YouTubeResponse{Transcript: transcript, Title: videoID})
|
||||
c.JSON(http.StatusOK, YouTubeResponse{Transcript: transcript, VideoId: videoID, Title: title, Description: description})
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
)
|
||||
|
||||
@@ -14,14 +15,14 @@ func NewCustomPatterns() (ret *CustomPatterns) {
|
||||
ret = &CustomPatterns{}
|
||||
|
||||
ret.PluginBase = &plugins.PluginBase{
|
||||
Name: label,
|
||||
SetupDescription: "Custom Patterns - Set directory for your custom patterns (optional)",
|
||||
Name: i18n.T("custom_patterns_label"),
|
||||
SetupDescription: i18n.T("custom_patterns_setup_description") + " " + i18n.T("optional_marker"),
|
||||
EnvNamePrefix: plugins.BuildEnvVariablePrefix(label),
|
||||
ConfigureCustom: ret.configure,
|
||||
}
|
||||
|
||||
ret.CustomPatternsDir = ret.AddSetupQuestionCustom("Directory", false,
|
||||
"Enter the path to your custom patterns directory (leave empty to skip)")
|
||||
ret.CustomPatternsDir = ret.AddSetupQuestionWithEnvName("Directory", false,
|
||||
i18n.T("custom_patterns_directory_question"))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
"github.com/danielmiessler/fabric/internal/plugins/ai"
|
||||
)
|
||||
@@ -15,7 +16,7 @@ func NeeDefaults(getVendorsModels func() (*ai.VendorsModels, error)) (ret *Defau
|
||||
ret = &Defaults{
|
||||
PluginBase: &plugins.PluginBase{
|
||||
Name: vendorName,
|
||||
SetupDescription: "Default AI Vendor and Model [required]",
|
||||
SetupDescription: i18n.T("defaults_setup_description") + " " + i18n.T("required_marker"),
|
||||
EnvNamePrefix: plugins.BuildEnvVariablePrefix(vendorName),
|
||||
},
|
||||
GetVendorsModels: getVendorsModels,
|
||||
@@ -23,11 +24,11 @@ func NeeDefaults(getVendorsModels func() (*ai.VendorsModels, error)) (ret *Defau
|
||||
|
||||
ret.Vendor = ret.AddSetting("Vendor", true)
|
||||
|
||||
ret.Model = ret.AddSetupQuestionCustom("Model", true,
|
||||
"Enter the index the name of your default model")
|
||||
ret.Model = ret.AddSetupQuestionWithEnvName("Model", true,
|
||||
i18n.T("defaults_model_question"))
|
||||
|
||||
ret.ModelContextLength = ret.AddSetupQuestionCustom("Model Context Length", false,
|
||||
"Enter model context length")
|
||||
ret.ModelContextLength = ret.AddSetupQuestionWithEnvName("Model Context Length", false,
|
||||
i18n.T("defaults_model_context_length_question"))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
)
|
||||
|
||||
@@ -21,8 +22,8 @@ func NewClient() (ret *Client) {
|
||||
|
||||
ret = &Client{
|
||||
PluginBase: &plugins.PluginBase{
|
||||
Name: label,
|
||||
SetupDescription: "Jina AI Service - to grab a webpage as clean, LLM-friendly text",
|
||||
Name: i18n.T("jina_label"),
|
||||
SetupDescription: i18n.T("jina_setup_description") + " " + i18n.T("optional_marker"),
|
||||
EnvNamePrefix: plugins.BuildEnvVariablePrefix(label),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package lang
|
||||
|
||||
import (
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
@@ -11,14 +12,14 @@ func NewLanguage() (ret *Language) {
|
||||
ret = &Language{}
|
||||
|
||||
ret.PluginBase = &plugins.PluginBase{
|
||||
Name: label,
|
||||
SetupDescription: "Language - Default AI Vendor Output Language",
|
||||
Name: i18n.T("language_label"),
|
||||
SetupDescription: i18n.T("language_setup_description") + " " + i18n.T("optional_marker"),
|
||||
EnvNamePrefix: plugins.BuildEnvVariablePrefix(label),
|
||||
ConfigureCustom: ret.configure,
|
||||
}
|
||||
|
||||
ret.DefaultLanguage = ret.AddSetupQuestionCustom("Output", false,
|
||||
"Enter your default output language (for example: zh_CN)")
|
||||
ret.DefaultLanguage = ret.AddSetupQuestionWithEnvName("Output", false,
|
||||
i18n.T("language_output_question"))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/danielmiessler/fabric/internal/i18n"
|
||||
debuglog "github.com/danielmiessler/fabric/internal/log"
|
||||
"github.com/danielmiessler/fabric/internal/plugins"
|
||||
"github.com/danielmiessler/fabric/internal/plugins/db/fsdb"
|
||||
@@ -26,18 +27,18 @@ func NewPatternsLoader(patterns *fsdb.PatternsEntity) (ret *PatternsLoader) {
|
||||
}
|
||||
|
||||
ret.PluginBase = &plugins.PluginBase{
|
||||
Name: label,
|
||||
SetupDescription: "Patterns - Downloads patterns [required]",
|
||||
Name: i18n.T("patterns_loader_label"),
|
||||
SetupDescription: i18n.T("patterns_setup_description") + " " + i18n.T("required_marker"),
|
||||
EnvNamePrefix: plugins.BuildEnvVariablePrefix(label),
|
||||
ConfigureCustom: ret.configure,
|
||||
}
|
||||
|
||||
ret.DefaultGitRepoUrl = ret.AddSetupQuestionCustom("Git Repo Url", true,
|
||||
"Enter the default Git repository URL for the patterns")
|
||||
ret.DefaultGitRepoUrl = ret.AddSetupQuestionWithEnvName("Git Repo Url", true,
|
||||
i18n.T("patterns_git_repo_url_question"))
|
||||
ret.DefaultGitRepoUrl.Value = DefaultPatternsGitRepoUrl
|
||||
|
||||
ret.DefaultFolder = ret.AddSetupQuestionCustom("Git Repo Patterns Folder", true,
|
||||
"Enter the default folder in the Git repository where patterns are stored")
|
||||
ret.DefaultFolder = ret.AddSetupQuestionWithEnvName("Git Repo Patterns Folder", true,
|
||||
i18n.T("patterns_git_repo_folder_question"))
|
||||
ret.DefaultFolder.Value = DefaultPatternsGitRepoFolder
|
||||
|
||||
return
|
||||
@@ -61,7 +62,7 @@ func (o *PatternsLoader) configure() (err error) {
|
||||
// Use a consistent temp folder name regardless of the source path structure
|
||||
tempDir, err := os.MkdirTemp("", "fabric-patterns-")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create temporary patterns folder: %w", err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_create_temp_folder"), err)
|
||||
}
|
||||
o.tempPatternsFolder = tempDir
|
||||
|
||||
@@ -91,29 +92,30 @@ func (o *PatternsLoader) Setup() (err error) {
|
||||
|
||||
// PopulateDB downloads patterns from the internet and populates the patterns folder
|
||||
func (o *PatternsLoader) PopulateDB() (err error) {
|
||||
fmt.Printf("Downloading patterns and Populating %s...\n", o.Patterns.Dir)
|
||||
fmt.Printf(i18n.T("patterns_downloading"), o.Patterns.Dir)
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
|
||||
originalPath := o.DefaultFolder.Value
|
||||
if err = o.gitCloneAndCopy(); err != nil {
|
||||
return fmt.Errorf("failed to download patterns from git repository: %w", err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_download_from_git"), err)
|
||||
}
|
||||
|
||||
// If the path was migrated during gitCloneAndCopy, we need to save the updated configuration
|
||||
if o.DefaultFolder.Value != originalPath {
|
||||
fmt.Printf("💾 Saving updated configuration (path changed from '%s' to '%s')...\n", originalPath, o.DefaultFolder.Value)
|
||||
fmt.Printf(i18n.T("patterns_saving_updated_configuration"), originalPath, o.DefaultFolder.Value)
|
||||
// The configuration will be saved by the calling code after this returns successfully
|
||||
}
|
||||
|
||||
if err = o.movePatterns(); err != nil {
|
||||
return fmt.Errorf("failed to move patterns to config directory: %w", err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_move_patterns"), err)
|
||||
}
|
||||
|
||||
fmt.Printf("✅ Successfully downloaded and installed patterns to %s\n", o.Patterns.Dir)
|
||||
fmt.Printf(i18n.T("patterns_download_success"), o.Patterns.Dir)
|
||||
|
||||
// Create the unique patterns file after patterns are successfully moved
|
||||
if err = o.createUniquePatternsFile(); err != nil {
|
||||
return fmt.Errorf("failed to create unique patterns file: %w", err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_unique_file"), err)
|
||||
}
|
||||
|
||||
return
|
||||
@@ -128,7 +130,7 @@ func (o *PatternsLoader) PersistPatterns() (err error) {
|
||||
return nil
|
||||
}
|
||||
// Return unexpected errors (e.g., permission issues)
|
||||
return fmt.Errorf("failed to access patterns directory '%s': %w", o.Patterns.Dir, err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_access_directory"), o.Patterns.Dir, err)
|
||||
}
|
||||
|
||||
var currentPatterns []os.DirEntry
|
||||
@@ -157,9 +159,9 @@ func (o *PatternsLoader) PersistPatterns() (err error) {
|
||||
src := filepath.Join(o.Patterns.Dir, currentPattern.Name())
|
||||
dst := filepath.Join(newPatternsFolder, currentPattern.Name())
|
||||
if copyErr := copy.Copy(src, dst); copyErr != nil {
|
||||
fmt.Printf("Warning: failed to preserve custom pattern '%s': %v\n", currentPattern.Name(), copyErr)
|
||||
fmt.Printf(i18n.T("patterns_preserve_warning"), currentPattern.Name(), copyErr)
|
||||
} else {
|
||||
fmt.Printf("Preserved custom pattern: %s\n", currentPattern.Name())
|
||||
fmt.Printf(i18n.T("patterns_preserved_custom_pattern"), currentPattern.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,13 +198,13 @@ func (o *PatternsLoader) movePatterns() (err error) {
|
||||
}
|
||||
|
||||
if patternCount == 0 {
|
||||
err = fmt.Errorf("no patterns were successfully copied to %s", o.Patterns.Dir)
|
||||
err = fmt.Errorf(i18n.T("patterns_no_patterns_copied"), o.Patterns.Dir)
|
||||
return
|
||||
}
|
||||
|
||||
//create an empty file to indicate that the patterns have been updated if not exists
|
||||
if _, err = os.Create(o.loadedFilePath); err != nil {
|
||||
return fmt.Errorf("failed to create loaded marker file '%s': %w", o.loadedFilePath, err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_loaded_marker"), o.loadedFilePath, err)
|
||||
}
|
||||
|
||||
err = os.RemoveAll(patternsDir)
|
||||
@@ -212,10 +214,10 @@ func (o *PatternsLoader) movePatterns() (err error) {
|
||||
func (o *PatternsLoader) gitCloneAndCopy() (err error) {
|
||||
// Create temp folder if it doesn't exist
|
||||
if err = os.MkdirAll(filepath.Dir(o.tempPatternsFolder), os.ModePerm); err != nil {
|
||||
return fmt.Errorf("failed to create temp directory: %w", err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_create_temp_dir"), err)
|
||||
}
|
||||
|
||||
fmt.Printf("Cloning repository %s (path: %s)...\n", o.DefaultGitRepoUrl.Value, o.DefaultFolder.Value)
|
||||
fmt.Printf(i18n.T("patterns_cloning_repository"), o.DefaultGitRepoUrl.Value, o.DefaultFolder.Value)
|
||||
|
||||
// Try to fetch files with the current path
|
||||
err = githelper.FetchFilesFromRepo(githelper.FetchOptions{
|
||||
@@ -224,21 +226,21 @@ func (o *PatternsLoader) gitCloneAndCopy() (err error) {
|
||||
DestDir: o.tempPatternsFolder,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to download patterns from %s: %w", o.DefaultGitRepoUrl.Value, err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_download_from_repo"), o.DefaultGitRepoUrl.Value, err)
|
||||
}
|
||||
|
||||
// Check if patterns were downloaded
|
||||
if patternCount, checkErr := o.countPatternsInDirectory(o.tempPatternsFolder); checkErr != nil {
|
||||
return fmt.Errorf("failed to read temp patterns directory: %w", checkErr)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_read_temp_directory"), checkErr)
|
||||
} else if patternCount == 0 {
|
||||
// No patterns found with current path, try automatic migration
|
||||
if migrationErr := o.tryPathMigration(); migrationErr != nil {
|
||||
return fmt.Errorf("no patterns found in repository at path %s and migration failed: %w", o.DefaultFolder.Value, migrationErr)
|
||||
return fmt.Errorf(i18n.T("patterns_no_patterns_migration_failed"), o.DefaultFolder.Value, migrationErr)
|
||||
}
|
||||
// Migration successful, try downloading again
|
||||
return o.gitCloneAndCopy()
|
||||
} else {
|
||||
fmt.Printf("Downloaded %d patterns to temporary directory\n", patternCount)
|
||||
fmt.Printf(i18n.T("patterns_downloaded_temp"), patternCount)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -248,7 +250,7 @@ func (o *PatternsLoader) gitCloneAndCopy() (err error) {
|
||||
func (o *PatternsLoader) tryPathMigration() (err error) {
|
||||
// Check if current path is the old "patterns" path
|
||||
if o.DefaultFolder.Value == "patterns" {
|
||||
fmt.Println("🔄 Detected old pattern path 'patterns', trying migration to 'data/patterns'...")
|
||||
fmt.Println(i18n.T("patterns_detected_old_path"))
|
||||
|
||||
// Try the new restructured path
|
||||
newPath := "data/patterns"
|
||||
@@ -256,7 +258,7 @@ func (o *PatternsLoader) tryPathMigration() (err error) {
|
||||
|
||||
// Clean up any existing test temp folder
|
||||
if err := os.RemoveAll(testTempFolder); err != nil {
|
||||
fmt.Printf("Warning: failed to remove test temporary folder '%s': %v\n", testTempFolder, err)
|
||||
fmt.Printf(i18n.T("patterns_warning_remove_test_folder"), testTempFolder, err)
|
||||
}
|
||||
|
||||
// Test if the new path works
|
||||
@@ -269,7 +271,7 @@ func (o *PatternsLoader) tryPathMigration() (err error) {
|
||||
if testErr == nil {
|
||||
// Check if patterns exist in the new path
|
||||
if patternCount, countErr := o.countPatternsInDirectory(testTempFolder); countErr == nil && patternCount > 0 {
|
||||
fmt.Printf("✅ Found %d patterns at new path '%s', updating configuration...\n", patternCount, newPath)
|
||||
fmt.Printf(i18n.T("patterns_found_new_path"), patternCount, newPath)
|
||||
|
||||
// Update the configuration
|
||||
o.DefaultFolder.Value = newPath
|
||||
@@ -278,7 +280,7 @@ func (o *PatternsLoader) tryPathMigration() (err error) {
|
||||
if renameErr := os.Rename(testTempFolder, o.tempPatternsFolder); renameErr != nil {
|
||||
// If rename fails, try copy
|
||||
if copyErr := copy.Copy(testTempFolder, o.tempPatternsFolder); copyErr != nil {
|
||||
return fmt.Errorf("failed to move test patterns to temp folder: %w", copyErr)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_move_test_patterns"), copyErr)
|
||||
}
|
||||
os.RemoveAll(testTempFolder)
|
||||
}
|
||||
@@ -291,7 +293,7 @@ func (o *PatternsLoader) tryPathMigration() (err error) {
|
||||
os.RemoveAll(testTempFolder)
|
||||
}
|
||||
|
||||
return fmt.Errorf("unable to find patterns at current path '%s' or migrate to new structure", o.DefaultFolder.Value)
|
||||
return fmt.Errorf(i18n.T("patterns_unable_to_find_or_migrate"), o.DefaultFolder.Value)
|
||||
}
|
||||
|
||||
// countPatternsInDirectory counts the number of pattern directories in a given directory
|
||||
@@ -316,7 +318,7 @@ func (o *PatternsLoader) createUniquePatternsFile() (err error) {
|
||||
// Read patterns from the main patterns directory
|
||||
entries, err := os.ReadDir(o.Patterns.Dir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read patterns directory: %w", err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_read_directory"), err)
|
||||
}
|
||||
|
||||
patternNamesMap := make(map[string]bool) // Use map to avoid duplicates
|
||||
@@ -336,17 +338,17 @@ func (o *PatternsLoader) createUniquePatternsFile() (err error) {
|
||||
patternNamesMap[entry.Name()] = true
|
||||
}
|
||||
}
|
||||
debuglog.Log("📂 Also included patterns from custom directory: %s\n", o.Patterns.CustomPatternsDir)
|
||||
debuglog.Log(i18n.T("patterns_debug_included_custom_directory"), o.Patterns.CustomPatternsDir)
|
||||
} else {
|
||||
debuglog.Log("Warning: Could not read custom patterns directory %s: %v\n", o.Patterns.CustomPatternsDir, customErr)
|
||||
debuglog.Log(i18n.T("patterns_warning_custom_directory"), o.Patterns.CustomPatternsDir, customErr)
|
||||
}
|
||||
}
|
||||
|
||||
if len(patternNamesMap) == 0 {
|
||||
if o.Patterns.CustomPatternsDir != "" {
|
||||
return fmt.Errorf("no patterns found in directories %s and %s", o.Patterns.Dir, o.Patterns.CustomPatternsDir)
|
||||
return fmt.Errorf(i18n.T("patterns_no_patterns_found_in_directories"), o.Patterns.Dir, o.Patterns.CustomPatternsDir)
|
||||
}
|
||||
return fmt.Errorf("no patterns found in directory %s", o.Patterns.Dir)
|
||||
return fmt.Errorf(i18n.T("patterns_no_patterns_found_in_directory"), o.Patterns.Dir)
|
||||
}
|
||||
|
||||
// Convert map to sorted slice
|
||||
@@ -361,9 +363,9 @@ func (o *PatternsLoader) createUniquePatternsFile() (err error) {
|
||||
// Join pattern names with newlines
|
||||
content := strings.Join(patternNames, "\n") + "\n"
|
||||
if err = os.WriteFile(o.Patterns.UniquePatternsFilePath, []byte(content), 0644); err != nil {
|
||||
return fmt.Errorf("failed to write unique patterns file: %w", err)
|
||||
return fmt.Errorf(i18n.T("patterns_failed_write_unique_file"), err)
|
||||
}
|
||||
|
||||
fmt.Printf("📝 Created unique patterns file with %d patterns\n", len(patternNames))
|
||||
fmt.Printf(i18n.T("patterns_unique_file_created"), len(patternNames))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ func NewYouTube() (ret *YouTube) {
|
||||
ret = &YouTube{}
|
||||
|
||||
ret.PluginBase = &plugins.PluginBase{
|
||||
Name: label,
|
||||
SetupDescription: label + " - to grab video transcripts (via yt-dlp) and comments/metadata (via YouTube API)",
|
||||
Name: i18n.T("youtube_label"),
|
||||
SetupDescription: i18n.T("youtube_setup_description") + " " + i18n.T("optional_marker"),
|
||||
EnvNamePrefix: plugins.BuildEnvVariablePrefix(label),
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ schema = 3
|
||||
[mod."github.com/Azure/azure-sdk-for-go/sdk/internal"]
|
||||
version = "v1.11.2"
|
||||
hash = "sha256-O4Vo6D/fus3Qhs/Te644+jh2LfiG5PpiMkW0YWIbLCs="
|
||||
[mod."github.com/KyleBanks/depth"]
|
||||
version = "v1.2.1"
|
||||
hash = "sha256-czR52MfeKA2FdStXCebTMQRKT8jaWQcbV214O3j49qU="
|
||||
[mod."github.com/Microsoft/go-winio"]
|
||||
version = "v0.6.2"
|
||||
hash = "sha256-tVNWDUMILZbJvarcl/E7tpSnkn7urqgSHa2Eaka5vSU="
|
||||
@@ -88,18 +91,21 @@ schema = 3
|
||||
[mod."github.com/aws/smithy-go"]
|
||||
version = "v1.23.0"
|
||||
hash = "sha256-75k+gn1lbQB1TzjV3HeEJeuyPPfX2huKhONXo98SUKg="
|
||||
[mod."github.com/bytedance/gopkg"]
|
||||
version = "v0.1.3"
|
||||
hash = "sha256-GyUbPfn41y/mgj0cQOa4tm+aj70C2K50VBZxZc/tcZE="
|
||||
[mod."github.com/bytedance/sonic"]
|
||||
version = "v1.13.3"
|
||||
hash = "sha256-Nnt5b2NkIvSXhGERQmyI0ka28hbWi7A7Zn3dsAjPcEA="
|
||||
version = "v1.14.2"
|
||||
hash = "sha256-S6EGwzt3TaTUjU1SdtorTdAq3xwROzSGZT6ynfLNq8o="
|
||||
[mod."github.com/bytedance/sonic/loader"]
|
||||
version = "v0.2.4"
|
||||
hash = "sha256-rv9LnePpm4OspSVbfSoVbohXzhu+dxE1BH1gm3mTmTc="
|
||||
version = "v0.4.0"
|
||||
hash = "sha256-Hc2bB9nLEFhyipIVHKnJmi6WMoWPCe0REK3bmQThO4A="
|
||||
[mod."github.com/cloudflare/circl"]
|
||||
version = "v1.6.1"
|
||||
hash = "sha256-Dc69V12eIFnJoUNmwg6VKXHfAMijbAeEVSDe8AiOaLo="
|
||||
[mod."github.com/cloudwego/base64x"]
|
||||
version = "v0.1.5"
|
||||
hash = "sha256-MyUYTveN48DhnL8mwAgCRuMExLct98uzSPsmYlfaa4I="
|
||||
version = "v0.1.6"
|
||||
hash = "sha256-VzYJsGubsDk3FAMH6e0Xk0Cl4HtUFHHmWkVASUYidsI="
|
||||
[mod."github.com/coder/websocket"]
|
||||
version = "v1.8.13"
|
||||
hash = "sha256-NbF0aPhy8YR3jRM6LMMQTtkeGTFba0eIBPAUsqI9KOk="
|
||||
@@ -116,14 +122,14 @@ schema = 3
|
||||
version = "v1.0.4"
|
||||
hash = "sha256-c1JKoRSndwwOyOxq9ddCe+8qn7mG9uRq2o/822x5O/c="
|
||||
[mod."github.com/gabriel-vasile/mimetype"]
|
||||
version = "v1.4.9"
|
||||
hash = "sha256-75uELLqb01djHTe7KdXvUidBK7SuejarYouEUuxaj8Q="
|
||||
version = "v1.4.12"
|
||||
hash = "sha256-vY2g58yUrkT//8fttRKhS9rbg89YSae/BzOARS5uH30="
|
||||
[mod."github.com/gin-contrib/sse"]
|
||||
version = "v1.1.0"
|
||||
hash = "sha256-2VP6zHEsPi0u2ZYpOTcLulwj1Gsmb6oA19qcP2/AzVM="
|
||||
[mod."github.com/gin-gonic/gin"]
|
||||
version = "v1.10.1"
|
||||
hash = "sha256-D98+chAdjb6JcLPkscOr8TgTW87UqA4h3cnY0XIr16c="
|
||||
version = "v1.11.0"
|
||||
hash = "sha256-tFP0u7TZyB1V8b1mdnTWMrfdcwzf9yO86RZr026K8Ao="
|
||||
[mod."github.com/go-git/gcfg"]
|
||||
version = "v1.5.1-0.20230307220236-3a3c6141e376"
|
||||
hash = "sha256-f4k0gSYuo0/q3WOoTxl2eFaj7WZpdz29ih6CKc8Ude8="
|
||||
@@ -139,6 +145,36 @@ schema = 3
|
||||
[mod."github.com/go-logr/stdr"]
|
||||
version = "v1.2.2"
|
||||
hash = "sha256-rRweAP7XIb4egtT1f2gkz4sYOu7LDHmcJ5iNsJUd0sE="
|
||||
[mod."github.com/go-openapi/jsonpointer"]
|
||||
version = "v0.22.4"
|
||||
hash = "sha256-V76k+oQUyqkWcpa64bOirteoCfdn1Xm9TLH0/7W4Uxc="
|
||||
[mod."github.com/go-openapi/jsonreference"]
|
||||
version = "v0.21.4"
|
||||
hash = "sha256-R+Q/MOSRTMiOaZutRmjv/qwbU9/cUWN59Hwr2LgDz2U="
|
||||
[mod."github.com/go-openapi/spec"]
|
||||
version = "v0.22.2"
|
||||
hash = "sha256-o9A6ZVaVPUVP2ssO0I4CDTuGyRuhL/VCM28jU0l32ps="
|
||||
[mod."github.com/go-openapi/swag/conv"]
|
||||
version = "v0.25.4"
|
||||
hash = "sha256-uHgTdZC76LMSsq+x+RyeclnOgBsS0ID2cLgfjzFk0KQ="
|
||||
[mod."github.com/go-openapi/swag/jsonname"]
|
||||
version = "v0.25.4"
|
||||
hash = "sha256-Z6uETeudh8W+/SGxFBnOB/VlJeRPRkFgCyJmntpz7bc="
|
||||
[mod."github.com/go-openapi/swag/jsonutils"]
|
||||
version = "v0.25.4"
|
||||
hash = "sha256-TQGeMImUuL5BWDoBHKAjZ1BvvxPXkFrV3TMgb82IrLk="
|
||||
[mod."github.com/go-openapi/swag/loading"]
|
||||
version = "v0.25.4"
|
||||
hash = "sha256-xr8OnFqB/kwBj3yf9HiLJwDcpL7I3/qJYlKb6VWbVFA="
|
||||
[mod."github.com/go-openapi/swag/stringutils"]
|
||||
version = "v0.25.4"
|
||||
hash = "sha256-rVo5NBH+oLLX9kaemUYWILd+TKw/TDTB8UdSz+mn3m8="
|
||||
[mod."github.com/go-openapi/swag/typeutils"]
|
||||
version = "v0.25.4"
|
||||
hash = "sha256-59RHnK6ugsAUc+A8DZCj7gZ3bJnt01Al7T/1kzM9PpA="
|
||||
[mod."github.com/go-openapi/swag/yamlutils"]
|
||||
version = "v0.25.4"
|
||||
hash = "sha256-zba7QX7Ds05oZq1opP/vwRSBEDaJ1pKm+9DgrsOuR9w="
|
||||
[mod."github.com/go-playground/locales"]
|
||||
version = "v0.14.1"
|
||||
hash = "sha256-BMJGAexq96waZn60DJXZfByRHb8zA/JP/i6f/YrW9oQ="
|
||||
@@ -146,8 +182,8 @@ schema = 3
|
||||
version = "v0.18.1"
|
||||
hash = "sha256-2/B2qP51zfiY+k8G0w0D03KXUc7XpWj6wKY7NjNP/9E="
|
||||
[mod."github.com/go-playground/validator/v10"]
|
||||
version = "v10.26.0"
|
||||
hash = "sha256-/jMKICp8LTcJVt+b4YRTnJM84r7HK6aT0oqO7Q8SRs8="
|
||||
version = "v10.29.0"
|
||||
hash = "sha256-HFiWBwxNlzoyMlRwA92rAiEGjBy9Dz/ZUKSRp8pXB2Y="
|
||||
[mod."github.com/go-shiori/dom"]
|
||||
version = "v0.0.0-20230515143342-73569d674e1c"
|
||||
hash = "sha256-4lm9KZfR2XnfZU9KTG+4jqLYZqbfL74AMO4y3dKpIbg="
|
||||
@@ -157,6 +193,9 @@ schema = 3
|
||||
[mod."github.com/goccy/go-json"]
|
||||
version = "v0.10.5"
|
||||
hash = "sha256-/EtlGihP0/7oInzMC5E0InZ4b5Ad3s4xOpqotloi3xw="
|
||||
[mod."github.com/goccy/go-yaml"]
|
||||
version = "v1.19.1"
|
||||
hash = "sha256-zlT9y4wkvyv7RBv48jdJqOM2lrDMLrC6Z6hCl90c5hQ="
|
||||
[mod."github.com/gogs/chardet"]
|
||||
version = "v0.0.0-20211120154057-b7413eaefb8f"
|
||||
hash = "sha256-4MeqBJsh4U+ZEbfdDwdciTYMlQWkCil2KJbUxHjBSIo="
|
||||
@@ -212,8 +251,8 @@ schema = 3
|
||||
version = "v1.2.0"
|
||||
hash = "sha256-Ta7ZOmyX8gG5tzWbY2oES70EJPfI90U7CIJS9EAce0s="
|
||||
[mod."github.com/klauspost/cpuid/v2"]
|
||||
version = "v2.2.10"
|
||||
hash = "sha256-o21Tk5sD7WhhLUoqSkymnjLbzxl0mDJCTC1ApfZJrC0="
|
||||
version = "v2.3.0"
|
||||
hash = "sha256-50JhbQyT67BK38HIdJihPtjV7orYp96HknI2VP7A9Yc="
|
||||
[mod."github.com/leodido/go-urn"]
|
||||
version = "v1.4.0"
|
||||
hash = "sha256-Q6kplWkY37Tzy6GOme3Wut40jFK4Izun+ij/BJvcEu0="
|
||||
@@ -233,8 +272,8 @@ schema = 3
|
||||
version = "v2.6.0"
|
||||
hash = "sha256-UrSECFbpCIg5avJ+f3LkJy/ncZFHa4q8sDqDIQ3YZJM="
|
||||
[mod."github.com/ollama/ollama"]
|
||||
version = "v0.11.7"
|
||||
hash = "sha256-3Wn1JWmil0aQQ2I/r398HbnUsi8ADoroqNyPziuxn/c="
|
||||
version = "v0.12.4"
|
||||
hash = "sha256-5Ubp36Ywbt3TtIhqhHkrm+xo1/RT1EePexQzF84jeVo="
|
||||
[mod."github.com/openai/openai-go"]
|
||||
version = "v1.12.0"
|
||||
hash = "sha256-JHLlKvDwERPf728GUXBsKU58ODgCxcxEe9TKJTGAG1w="
|
||||
@@ -256,6 +295,12 @@ schema = 3
|
||||
[mod."github.com/pmezard/go-difflib"]
|
||||
version = "v1.0.1-0.20181226105442-5d4384ee4fb2"
|
||||
hash = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90="
|
||||
[mod."github.com/quic-go/qpack"]
|
||||
version = "v0.6.0"
|
||||
hash = "sha256-xaxHnTKIZt1cHK5ZqTuSTOt5RNSjQB37GlrIgEGBskM="
|
||||
[mod."github.com/quic-go/quic-go"]
|
||||
version = "v0.57.1"
|
||||
hash = "sha256-MdXc0GRVp3YuN9XFoGFOjgIcIMp7yoLqwfEikZp1i4w="
|
||||
[mod."github.com/samber/lo"]
|
||||
version = "v1.50.0"
|
||||
hash = "sha256-KDFks82BKu39sGt0f972IyOkohV2U0r1YvsnlNLdugY="
|
||||
@@ -277,6 +322,15 @@ schema = 3
|
||||
[mod."github.com/stretchr/testify"]
|
||||
version = "v1.11.1"
|
||||
hash = "sha256-sWfjkuKJyDllDEtnM8sb/pdLzPQmUYWYtmeWz/5suUc="
|
||||
[mod."github.com/swaggo/files"]
|
||||
version = "v1.0.1"
|
||||
hash = "sha256-bNBmpJaM7g1BNwd7VxNIRSdY35NKSXhYHGfnZsSEUZ8="
|
||||
[mod."github.com/swaggo/gin-swagger"]
|
||||
version = "v1.6.1"
|
||||
hash = "sha256-9TQuEmPpDO2QL0c9VwjK9uwB1jka08Ox6fje2RwVpUc="
|
||||
[mod."github.com/swaggo/swag"]
|
||||
version = "v1.16.6"
|
||||
hash = "sha256-na5+ZylxPFKoMJcgx8nmSJXMMkKFCyuh1qSkb7Qth/I="
|
||||
[mod."github.com/tidwall/gjson"]
|
||||
version = "v1.18.0"
|
||||
hash = "sha256-CO6hqDu8Y58Po6A01e5iTpwiUBQ5khUZsw7czaJHw0I="
|
||||
@@ -293,8 +347,8 @@ schema = 3
|
||||
version = "v0.15.1"
|
||||
hash = "sha256-HLk6oUe7EoITrNvP0y8D6BtIgIcmDZYtb/xl/dufIoY="
|
||||
[mod."github.com/ugorji/go/codec"]
|
||||
version = "v1.2.14"
|
||||
hash = "sha256-PoVXlCBE8SvMWpXx9FRsQOSAmE/+5SnPGr4m5BGoyIo="
|
||||
version = "v1.3.1"
|
||||
hash = "sha256-VQtXVaKxXjm5Q60hCgVKZxNywl6SJFPqju6JNjADp4w="
|
||||
[mod."github.com/xanzy/ssh-agent"]
|
||||
version = "v0.3.3"
|
||||
hash = "sha256-l3pGB6IdzcPA/HLk93sSN6NM2pKPy+bVOoacR5RC2+c="
|
||||
@@ -313,30 +367,42 @@ schema = 3
|
||||
[mod."go.opentelemetry.io/otel/trace"]
|
||||
version = "v1.36.0"
|
||||
hash = "sha256-owWD9x1lp8aIJqYt058BXPUsIMHdk3RI0escso0BxwA="
|
||||
[mod."go.uber.org/mock"]
|
||||
version = "v0.6.0"
|
||||
hash = "sha256-m11cxIbrvOowa6xj11AztzfFk86DwR6SNO1lStcKzvo="
|
||||
[mod."go.yaml.in/yaml/v3"]
|
||||
version = "v3.0.4"
|
||||
hash = "sha256-NkGFiDPoCxbr3LFsI6OCygjjkY0rdmg5ggvVVwpyDQ4="
|
||||
[mod."golang.org/x/arch"]
|
||||
version = "v0.18.0"
|
||||
hash = "sha256-tUpUPERjmRi7zldj0oPlnbnBhEkcI9iQGvP1HqlsK10="
|
||||
version = "v0.23.0"
|
||||
hash = "sha256-ynvhsw8ZYgKTzFn1wnIj3/p+1O/Ty5PX1Lnj+NMTAQQ="
|
||||
[mod."golang.org/x/crypto"]
|
||||
version = "v0.45.0"
|
||||
hash = "sha256-IpNesJYxFcs2jGvagwJrUD/gsJfA3UiETjQwYByXxSY="
|
||||
version = "v0.46.0"
|
||||
hash = "sha256-I8N/spcw3/h0DFA+V1WK38HctckWIB9ep93DEVCALxU="
|
||||
[mod."golang.org/x/exp"]
|
||||
version = "v0.0.0-20250531010427-b6e5de432a8b"
|
||||
hash = "sha256-QaFfjyB+pogCkUkJskR9xnXwkCOU828XJRrzwwLm6Ms="
|
||||
[mod."golang.org/x/mod"]
|
||||
version = "v0.31.0"
|
||||
hash = "sha256-ZVNmaZADgM3+30q9rW8q4gP6ySkT7r1eb4vrHIlpCjM="
|
||||
[mod."golang.org/x/net"]
|
||||
version = "v0.47.0"
|
||||
hash = "sha256-2qFgCd0YfNCGkLrf+xvnhQtKjSe8CymMdLlN3svUYTg="
|
||||
version = "v0.48.0"
|
||||
hash = "sha256-oZpddsiJwWCH3Aipa+XXpy7G/xHY5fEagUSok7T0bXE="
|
||||
[mod."golang.org/x/oauth2"]
|
||||
version = "v0.30.0"
|
||||
hash = "sha256-btD7BUtQpOswusZY5qIU90uDo38buVrQ0tmmQ8qNHDg="
|
||||
[mod."golang.org/x/sync"]
|
||||
version = "v0.18.0"
|
||||
hash = "sha256-S8o6y7GOaYWeq+TzT8BB6T+1mg82Mu08V0TL3ukJprg="
|
||||
version = "v0.19.0"
|
||||
hash = "sha256-RbRZ+sKZUurOczGhhzOoY/sojTlta3H9XjL4PXX/cno="
|
||||
[mod."golang.org/x/sys"]
|
||||
version = "v0.38.0"
|
||||
hash = "sha256-1+i5EaG3JwH3KMtefzJLG5R6jbOeJM4GK3/LHBVnSy0="
|
||||
version = "v0.39.0"
|
||||
hash = "sha256-dxTBu/JAWUkPbjFIXXRFdhQWyn+YyEpIC+tWqGo0Y6U="
|
||||
[mod."golang.org/x/text"]
|
||||
version = "v0.31.0"
|
||||
hash = "sha256-AT46RrSmV6+/d5FDhs9fPwYzmQ7WSo+YL9tPfhREwLw="
|
||||
version = "v0.32.0"
|
||||
hash = "sha256-9PXtWBKKY9rG4AgjSP4N+I1DhepXhy8SF/vWSIDIoWs="
|
||||
[mod."golang.org/x/tools"]
|
||||
version = "v0.40.0"
|
||||
hash = "sha256-ksmhTnH9btXKiRbbE0KGh02nbeNqNBQKcfwvx9dE7t0="
|
||||
[mod."google.golang.org/api"]
|
||||
version = "v0.247.0"
|
||||
hash = "sha256-UzTtydHmNqh1OXbxcN5qNKQxb5dV6h2Mo6DH4P219Ec="
|
||||
@@ -353,8 +419,8 @@ schema = 3
|
||||
version = "v1.74.2"
|
||||
hash = "sha256-tvYMdfu/ZQZRPZNmnQI4CZpg46CM8+mD49hw0gFheGs="
|
||||
[mod."google.golang.org/protobuf"]
|
||||
version = "v1.36.7"
|
||||
hash = "sha256-6xCU+t2AVPcscMKenVs4etGqutYGPDXCQ3DCD3PpTq4="
|
||||
version = "v1.36.11"
|
||||
hash = "sha256-7W+6jntfI/awWL3JP6yQedxqP5S9o3XvPgJ2XxxsIeE="
|
||||
[mod."gopkg.in/warnings.v0"]
|
||||
version = "v0.1.2"
|
||||
hash = "sha256-ATVL9yEmgYbkJ1DkltDGRn/auGAjqGOfjQyBYyUo8s8="
|
||||
|
||||
@@ -1 +1 @@
|
||||
"1.4.338"
|
||||
"1.4.358"
|
||||
|
||||
@@ -18,7 +18,7 @@ FROM alpine:latest
|
||||
|
||||
LABEL org.opencontainers.image.description="A Docker image for running the Fabric CLI. See https://github.com/danielmiessler/Fabric/tree/main/scripts/docker for details."
|
||||
|
||||
RUN apk add --no-cache ca-certificates \
|
||||
RUN apk add --no-cache ca-certificates yt-dlp \
|
||||
&& mkdir -p /root/.config/fabric
|
||||
|
||||
COPY --from=builder /fabric /usr/local/bin/fabric
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
"eslint-plugin-svelte": "^2.46.1",
|
||||
"lucide-svelte": "^0.309.0",
|
||||
"mdsvex": "^0.11.2",
|
||||
"patch-package": "^8.0.0",
|
||||
"patch-package": "^8.0.1",
|
||||
"pdf-to-markdown-core": "github:jzillmann/pdf-to-markdown#modularize",
|
||||
"pdfjs-dist": "^4.2.67",
|
||||
"pdfjs-dist": "^5.4.449",
|
||||
"postcss": "^8.5.3",
|
||||
"postcss-load-config": "^6.0.1",
|
||||
"rehype-autolink-headings": "^7.1.0",
|
||||
|
||||
565
web/pnpm-lock.yaml
generated
565
web/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,239 +1,284 @@
|
||||
import { get } from "svelte/store";
|
||||
import type {
|
||||
ChatRequest,
|
||||
StreamResponse,
|
||||
ChatError as IChatError,
|
||||
ChatPrompt
|
||||
} from '$lib/interfaces/chat-interface';
|
||||
import { get } from 'svelte/store';
|
||||
import { modelConfig } from '$lib/store/model-store';
|
||||
import { systemPrompt, selectedPatternName, patternVariables } from '$lib/store/pattern-store';
|
||||
import { chatConfig } from '$lib/store/chat-config';
|
||||
import { messageStore } from '$lib/store/chat-store';
|
||||
import { languageStore } from '$lib/store/language-store';
|
||||
import { selectedStrategy } from '$lib/store/strategy-store';
|
||||
ChatPrompt,
|
||||
ChatRequest,
|
||||
ChatError as IChatError,
|
||||
StreamResponse,
|
||||
} from "$lib/interfaces/chat-interface";
|
||||
import { chatConfig } from "$lib/store/chat-config";
|
||||
import { languageStore } from "$lib/store/language-store";
|
||||
import { modelConfig } from "$lib/store/model-store";
|
||||
import {
|
||||
patternVariables,
|
||||
selectedPatternName,
|
||||
systemPrompt,
|
||||
} from "$lib/store/pattern-store";
|
||||
import { selectedStrategy } from "$lib/store/strategy-store";
|
||||
|
||||
class LanguageValidator {
|
||||
constructor(private targetLanguage: string) {}
|
||||
constructor(private targetLanguage: string) {}
|
||||
|
||||
enforceLanguage(content: string): string {
|
||||
if (this.targetLanguage === 'en') return content;
|
||||
return `[Language: ${this.targetLanguage}]\n${content}`;
|
||||
}
|
||||
enforceLanguage(content: string): string {
|
||||
if (this.targetLanguage === "en") return content;
|
||||
return `[Language: ${this.targetLanguage}]\n${content}`;
|
||||
}
|
||||
}
|
||||
|
||||
export class ChatError extends Error implements IChatError {
|
||||
constructor(
|
||||
message: string,
|
||||
public readonly code: string = 'CHAT_ERROR',
|
||||
public readonly details?: unknown
|
||||
) {
|
||||
super(message);
|
||||
this.name = 'ChatError';
|
||||
}
|
||||
constructor(
|
||||
message: string,
|
||||
public readonly code: string = "CHAT_ERROR",
|
||||
public readonly details?: unknown,
|
||||
) {
|
||||
super(message);
|
||||
this.name = "ChatError";
|
||||
}
|
||||
}
|
||||
|
||||
export class ChatService {
|
||||
private validator: LanguageValidator;
|
||||
private validator: LanguageValidator;
|
||||
|
||||
constructor() {
|
||||
this.validator = new LanguageValidator(get(languageStore));
|
||||
}
|
||||
constructor() {
|
||||
this.validator = new LanguageValidator(get(languageStore));
|
||||
}
|
||||
|
||||
private async fetchStream(request: ChatRequest): Promise<ReadableStream<StreamResponse>> {
|
||||
try {
|
||||
console.log('\n=== ChatService Request Start ===');
|
||||
console.log('1. Request details:', {
|
||||
language: get(languageStore),
|
||||
pattern: get(selectedPatternName),
|
||||
promptCount: request.prompts?.length,
|
||||
messageCount: request.messages?.length
|
||||
});
|
||||
// NEW: Log the full payload before sending to backend
|
||||
console.log('Final ChatRequest payload:', JSON.stringify(request, null, 2));
|
||||
private async fetchStream(
|
||||
request: ChatRequest,
|
||||
): Promise<ReadableStream<StreamResponse>> {
|
||||
try {
|
||||
console.log("\n=== ChatService Request Start ===");
|
||||
console.log("1. Request details:", {
|
||||
language: get(languageStore),
|
||||
pattern: get(selectedPatternName),
|
||||
promptCount: request.prompts?.length,
|
||||
messageCount: request.messages?.length,
|
||||
});
|
||||
// NEW: Log the full payload before sending to backend
|
||||
console.log(
|
||||
"Final ChatRequest payload:",
|
||||
JSON.stringify(request, null, 2),
|
||||
);
|
||||
|
||||
const response = await fetch('/api/chat', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(request),
|
||||
});
|
||||
const response = await fetch("/api/chat", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(request),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new ChatError(`HTTP error! status: ${response.status}`, 'HTTP_ERROR', { status: response.status });
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new ChatError(
|
||||
`HTTP error! status: ${response.status}`,
|
||||
"HTTP_ERROR",
|
||||
{ status: response.status },
|
||||
);
|
||||
}
|
||||
|
||||
const reader = response.body?.getReader();
|
||||
if (!reader) {
|
||||
throw new ChatError('Response body is null', 'NULL_RESPONSE');
|
||||
}
|
||||
const reader = response.body?.getReader();
|
||||
if (!reader) {
|
||||
throw new ChatError("Response body is null", "NULL_RESPONSE");
|
||||
}
|
||||
|
||||
return this.createMessageStream(reader);
|
||||
} catch (error) {
|
||||
if (error instanceof ChatError) throw error;
|
||||
throw new ChatError('Failed to fetch chat stream', 'FETCH_ERROR', error);
|
||||
}
|
||||
}
|
||||
return this.createMessageStream(reader);
|
||||
} catch (error) {
|
||||
if (error instanceof ChatError) throw error;
|
||||
throw new ChatError("Failed to fetch chat stream", "FETCH_ERROR", error);
|
||||
}
|
||||
}
|
||||
|
||||
private cleanPatternOutput(content: string): string {
|
||||
// Remove markdown fence if present
|
||||
let cleaned = content.replace(/^```markdown\n/, '');
|
||||
cleaned = cleaned.replace(/\n```$/, '');
|
||||
private cleanPatternOutput(content: string): string {
|
||||
// Remove markdown fence if present
|
||||
let cleaned = content.replace(/^```markdown\n/, "");
|
||||
cleaned = cleaned.replace(/\n```$/, "");
|
||||
|
||||
// Existing cleaning
|
||||
cleaned = cleaned.replace(/^# OUTPUT\s*\n/, '');
|
||||
cleaned = cleaned.replace(/^\s*\n/, '');
|
||||
cleaned = cleaned.replace(/\n\s*$/, '');
|
||||
cleaned = cleaned.replace(/^#\s+([A-Z]+):/gm, '$1:');
|
||||
cleaned = cleaned.replace(/^#\s+([A-Z]+)\s*$/gm, '$1');
|
||||
cleaned = cleaned.trim();
|
||||
cleaned = cleaned.replace(/\n{3,}/g, '\n\n');
|
||||
return cleaned;
|
||||
}
|
||||
// Existing cleaning
|
||||
cleaned = cleaned.replace(/^# OUTPUT\s*\n/, "");
|
||||
cleaned = cleaned.replace(/^\s*\n/, "");
|
||||
cleaned = cleaned.replace(/\n\s*$/, "");
|
||||
cleaned = cleaned.replace(/^#\s+([A-Z]+):/gm, "$1:");
|
||||
cleaned = cleaned.replace(/^#\s+([A-Z]+)\s*$/gm, "$1");
|
||||
cleaned = cleaned.trim();
|
||||
cleaned = cleaned.replace(/\n{3,}/g, "\n\n");
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
private createMessageStream(reader: ReadableStreamDefaultReader<Uint8Array>): ReadableStream<StreamResponse> {
|
||||
let buffer = '';
|
||||
const cleanPatternOutput = this.cleanPatternOutput.bind(this);
|
||||
const language = get(languageStore);
|
||||
const validator = new LanguageValidator(language);
|
||||
private createMessageStream(
|
||||
reader: ReadableStreamDefaultReader<Uint8Array>,
|
||||
): ReadableStream<StreamResponse> {
|
||||
let buffer = "";
|
||||
const cleanPatternOutput = this.cleanPatternOutput.bind(this);
|
||||
const language = get(languageStore);
|
||||
const validator = new LanguageValidator(language);
|
||||
|
||||
const processResponse = (response: StreamResponse) => {
|
||||
const pattern = get(selectedPatternName);
|
||||
const processResponse = (response: StreamResponse) => {
|
||||
const pattern = get(selectedPatternName);
|
||||
|
||||
if (pattern) {
|
||||
response.content = cleanPatternOutput(response.content);
|
||||
// Simplified format determination - always markdown unless mermaid
|
||||
const isMermaid = [
|
||||
'graph TD', 'gantt', 'flowchart',
|
||||
'sequenceDiagram', 'classDiagram', 'stateDiagram'
|
||||
].some(starter => response.content.trim().startsWith(starter));
|
||||
if (pattern) {
|
||||
response.content = cleanPatternOutput(response.content);
|
||||
// Simplified format determination - always markdown unless mermaid
|
||||
const isMermaid = [
|
||||
"graph TD",
|
||||
"gantt",
|
||||
"flowchart",
|
||||
"sequenceDiagram",
|
||||
"classDiagram",
|
||||
"stateDiagram",
|
||||
].some((starter) => response.content.trim().startsWith(starter));
|
||||
|
||||
response.format = isMermaid ? 'mermaid' : 'markdown';
|
||||
}
|
||||
response.format = isMermaid ? "mermaid" : "markdown";
|
||||
}
|
||||
|
||||
if (response.type === 'content') {
|
||||
response.content = validator.enforceLanguage(response.content);
|
||||
}
|
||||
if (response.type === "content") {
|
||||
response.content = validator.enforceLanguage(response.content);
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
return new ReadableStream({
|
||||
async start(controller) {
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
return response;
|
||||
};
|
||||
return new ReadableStream({
|
||||
async start(controller) {
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
buffer += new TextDecoder().decode(value);
|
||||
const messages = buffer.split('\n\n').filter(msg => msg.startsWith('data: '));
|
||||
buffer += new TextDecoder().decode(value);
|
||||
const messages = buffer
|
||||
.split("\n\n")
|
||||
.filter((msg) => msg.startsWith("data: "));
|
||||
|
||||
if (messages.length > 1) {
|
||||
buffer = messages.pop() || '';
|
||||
for (const msg of messages) {
|
||||
try {
|
||||
let response = JSON.parse(msg.slice(6)) as StreamResponse;
|
||||
response = processResponse(response);
|
||||
controller.enqueue(response);
|
||||
} catch (parseError) {
|
||||
console.error('Error parsing stream message:', parseError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messages.length > 1) {
|
||||
buffer = messages.pop() || "";
|
||||
for (const msg of messages) {
|
||||
try {
|
||||
let response = JSON.parse(msg.slice(6)) as StreamResponse;
|
||||
response = processResponse(response);
|
||||
controller.enqueue(response);
|
||||
} catch (parseError) {
|
||||
console.error("Error parsing stream message:", parseError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.startsWith('data: ')) {
|
||||
try {
|
||||
let response = JSON.parse(buffer.slice(6)) as StreamResponse;
|
||||
response = processResponse(response);
|
||||
controller.enqueue(response);
|
||||
} catch (parseError) {
|
||||
console.error('Error parsing final message:', parseError);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(new ChatError('Stream processing error', 'STREAM_ERROR', error));
|
||||
} finally {
|
||||
reader.releaseLock();
|
||||
controller.close();
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
reader.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (buffer.startsWith("data: ")) {
|
||||
try {
|
||||
let response = JSON.parse(buffer.slice(6)) as StreamResponse;
|
||||
response = processResponse(response);
|
||||
controller.enqueue(response);
|
||||
} catch (parseError) {
|
||||
console.error("Error parsing final message:", parseError);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(
|
||||
new ChatError("Stream processing error", "STREAM_ERROR", error),
|
||||
);
|
||||
} finally {
|
||||
reader.releaseLock();
|
||||
controller.close();
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
reader.cancel();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private createChatPrompt(userInput: string, systemPromptText?: string): ChatPrompt {
|
||||
const config = get(modelConfig);
|
||||
const language = get(languageStore);
|
||||
private createChatPrompt(
|
||||
userInput: string,
|
||||
systemPromptText?: string,
|
||||
): ChatPrompt {
|
||||
const config = get(modelConfig);
|
||||
const language = get(languageStore);
|
||||
|
||||
const languageInstruction = language !== 'en'
|
||||
? `You MUST respond in ${language} language. All output must be in ${language}. `
|
||||
// ? `You MUST respond in ${language} language. ALL output, including section headers, titles, and formatting, MUST be translated into ${language}. It is CRITICAL that you translate ALL headers, such as SUMMARY, IDEAS, QUOTES, TAKEAWAYS, MAIN POINTS, etc., into ${language}. Maintain markdown formatting in the response. Do not output any English headers.`
|
||||
: '';
|
||||
const languageInstruction =
|
||||
language !== "en"
|
||||
? `You MUST respond in ${language} language. All output must be in ${language}. `
|
||||
: // ? `You MUST respond in ${language} language. ALL output, including section headers, titles, and formatting, MUST be translated into ${language}. It is CRITICAL that you translate ALL headers, such as SUMMARY, IDEAS, QUOTES, TAKEAWAYS, MAIN POINTS, etc., into ${language}. Maintain markdown formatting in the response. Do not output any English headers.`
|
||||
"";
|
||||
|
||||
const finalSystemPrompt = languageInstruction + (systemPromptText ?? get(systemPrompt));
|
||||
const finalSystemPrompt =
|
||||
languageInstruction + (systemPromptText ?? get(systemPrompt));
|
||||
|
||||
const finalUserInput = language !== 'en'
|
||||
? `${userInput}\n\nIMPORTANT: Respond in ${language} language only.`
|
||||
: userInput;
|
||||
const finalUserInput =
|
||||
language !== "en"
|
||||
? `${userInput}\n\nIMPORTANT: Respond in ${language} language only.`
|
||||
: userInput;
|
||||
|
||||
return {
|
||||
userInput: finalUserInput,
|
||||
systemPrompt: finalSystemPrompt,
|
||||
model: config.model,
|
||||
patternName: get(selectedPatternName),
|
||||
strategyName: get(selectedStrategy), // Add selected strategy to prompt
|
||||
variables: get(patternVariables) // Add pattern variables
|
||||
};
|
||||
}
|
||||
|
||||
public async createChatRequest(userInput: string, systemPromptText?: string, isPattern: boolean = false): Promise<ChatRequest> {
|
||||
const prompt = this.createChatPrompt(userInput, systemPromptText);
|
||||
const config = get(chatConfig);
|
||||
const language = get(languageStore);
|
||||
|
||||
return {
|
||||
prompts: [prompt],
|
||||
messages: [],
|
||||
language: language, // Add language at the top level for backend compatibility
|
||||
...config
|
||||
};
|
||||
}
|
||||
|
||||
public async streamPattern(userInput: string, systemPromptText?: string): Promise<ReadableStream<StreamResponse>> {
|
||||
const request = await this.createChatRequest(userInput, systemPromptText, true);
|
||||
return this.fetchStream(request);
|
||||
}
|
||||
|
||||
public async streamChat(userInput: string, systemPromptText?: string): Promise<ReadableStream<StreamResponse>> {
|
||||
const request = await this.createChatRequest(userInput, systemPromptText);
|
||||
return this.fetchStream(request);
|
||||
}
|
||||
|
||||
public async processStream(
|
||||
stream: ReadableStream<StreamResponse>,
|
||||
onContent: (content: string, response?: StreamResponse) => void,
|
||||
onError: (error: Error) => void
|
||||
): Promise<void> {
|
||||
const reader = stream.getReader();
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
if (value.type === 'error') {
|
||||
throw new ChatError(value.content, 'STREAM_CONTENT_ERROR');
|
||||
}
|
||||
|
||||
if (value.type === 'content') {
|
||||
onContent(value.content, value);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
onError(error instanceof ChatError ? error : new ChatError('Stream processing error', 'STREAM_ERROR', error));
|
||||
} finally {
|
||||
reader.releaseLock();
|
||||
|
||||
}
|
||||
}
|
||||
return {
|
||||
userInput: finalUserInput,
|
||||
systemPrompt: finalSystemPrompt,
|
||||
model: config.model,
|
||||
patternName: get(selectedPatternName),
|
||||
strategyName: get(selectedStrategy), // Add selected strategy to prompt
|
||||
variables: get(patternVariables), // Add pattern variables
|
||||
};
|
||||
}
|
||||
|
||||
public async createChatRequest(
|
||||
userInput: string,
|
||||
systemPromptText?: string,
|
||||
isPattern: boolean = false,
|
||||
): Promise<ChatRequest> {
|
||||
const prompt = this.createChatPrompt(userInput, systemPromptText);
|
||||
const config = get(chatConfig);
|
||||
const language = get(languageStore);
|
||||
|
||||
return {
|
||||
prompts: [prompt],
|
||||
messages: [],
|
||||
language: language, // Add language at the top level for backend compatibility
|
||||
...config,
|
||||
};
|
||||
}
|
||||
|
||||
public async streamPattern(
|
||||
userInput: string,
|
||||
systemPromptText?: string,
|
||||
): Promise<ReadableStream<StreamResponse>> {
|
||||
const request = await this.createChatRequest(
|
||||
userInput,
|
||||
systemPromptText,
|
||||
true,
|
||||
);
|
||||
return this.fetchStream(request);
|
||||
}
|
||||
|
||||
public async streamChat(
|
||||
userInput: string,
|
||||
systemPromptText?: string,
|
||||
): Promise<ReadableStream<StreamResponse>> {
|
||||
const request = await this.createChatRequest(userInput, systemPromptText);
|
||||
return this.fetchStream(request);
|
||||
}
|
||||
|
||||
public async processStream(
|
||||
stream: ReadableStream<StreamResponse>,
|
||||
onContent: (content: string, response?: StreamResponse) => void,
|
||||
onError: (error: Error) => void,
|
||||
): Promise<void> {
|
||||
const reader = stream.getReader();
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
if (value.type === "error") {
|
||||
throw new ChatError(value.content, "STREAM_CONTENT_ERROR");
|
||||
}
|
||||
|
||||
if (value.type === "content") {
|
||||
onContent(value.content, value);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
onError(
|
||||
error instanceof ChatError
|
||||
? error
|
||||
: new ChatError("Stream processing error", "STREAM_ERROR", error),
|
||||
);
|
||||
} finally {
|
||||
reader.releaseLock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,78 +1,74 @@
|
||||
import { createPipeline, transformers } from 'pdf-to-markdown-core/lib/src';
|
||||
import { PARSE_SCHEMA } from 'pdf-to-markdown-core/lib/src/PdfParser';
|
||||
import * as pdfjs from 'pdfjs-dist';
|
||||
import pdfConfig from './pdf-config';
|
||||
import { createPipeline, transformers } from "pdf-to-markdown-core/lib/src";
|
||||
import { PARSE_SCHEMA } from "pdf-to-markdown-core/lib/src/PdfParser";
|
||||
|
||||
// pdfjs-dist v5+ requires browser APIs at import time, so we use dynamic imports
|
||||
let pdfjs: typeof import("pdfjs-dist") | null = null;
|
||||
|
||||
export class PdfConversionService {
|
||||
constructor() {
|
||||
if (typeof window !== 'undefined') {
|
||||
console.log('PDF.js version:', pdfjs.version);
|
||||
// Initialize PDF.js configuration from the shared config
|
||||
pdfConfig.initialize();
|
||||
console.log('Worker configuration complete');
|
||||
}
|
||||
}
|
||||
private async ensureInitialized(): Promise<typeof import("pdfjs-dist")> {
|
||||
if (!pdfjs) {
|
||||
// Dynamic import to avoid SSR issues with pdfjs-dist v5+
|
||||
pdfjs = await import("pdfjs-dist");
|
||||
const pdfConfig = (await import("./pdf-config")).default;
|
||||
console.log("PDF.js version:", pdfjs.version);
|
||||
await pdfConfig.initialize();
|
||||
console.log("Worker configuration complete");
|
||||
}
|
||||
return pdfjs;
|
||||
}
|
||||
|
||||
async convertToMarkdown(file: File): Promise<string> {
|
||||
console.log('Starting PDF conversion:', {
|
||||
fileName: file.name,
|
||||
fileSize: file.size
|
||||
});
|
||||
async convertToMarkdown(file: File): Promise<string> {
|
||||
console.log("Starting PDF conversion:", {
|
||||
fileName: file.name,
|
||||
fileSize: file.size,
|
||||
});
|
||||
|
||||
const buffer = await file.arrayBuffer();
|
||||
console.log('Buffer created:', buffer.byteLength);
|
||||
const pdfjsLib = await this.ensureInitialized();
|
||||
|
||||
const pipeline = createPipeline(pdfjs, {
|
||||
transformConfig: {
|
||||
transformers
|
||||
}
|
||||
});
|
||||
console.log('Pipeline created');
|
||||
const buffer = await file.arrayBuffer();
|
||||
console.log("Buffer created:", buffer.byteLength);
|
||||
|
||||
const result = await pipeline.parse(
|
||||
buffer,
|
||||
(progress) => console.log('Processing:', {
|
||||
stage: progress.stages,
|
||||
details: progress.stageDetails,
|
||||
progress: progress.stageProgress
|
||||
})
|
||||
);
|
||||
console.log('Parse complete, validating result');
|
||||
const pipeline = createPipeline(pdfjsLib, {
|
||||
transformConfig: {
|
||||
transformers,
|
||||
},
|
||||
});
|
||||
console.log("Pipeline created");
|
||||
|
||||
const transformed = result.transform();
|
||||
console.log('Transform applied:', transformed);
|
||||
const result = await pipeline.parse(buffer, (progress) =>
|
||||
console.log("Processing:", {
|
||||
stage: progress.stages,
|
||||
details: progress.stageDetails,
|
||||
progress: progress.stageProgress,
|
||||
}),
|
||||
);
|
||||
console.log("Parse complete, validating result");
|
||||
|
||||
const markdown = transformed.convert({
|
||||
convert: (items) => {
|
||||
console.log('PDF Structure:', {
|
||||
itemCount: items.length,
|
||||
firstItem: items[0],
|
||||
schema: PARSE_SCHEMA // ['transform', 'width', 'height', 'str', 'fontName', 'dir']
|
||||
});
|
||||
|
||||
const text = items
|
||||
.map(item => item.value('str')) // Using 'str' instead of 'text' based on PARSE_SCHEMA
|
||||
.filter(Boolean)
|
||||
.join('\n');
|
||||
|
||||
console.log('Converted text:', {
|
||||
length: text.length,
|
||||
preview: text.substring(0, 100)
|
||||
});
|
||||
|
||||
return text;
|
||||
}
|
||||
});
|
||||
|
||||
const transformed = result.transform();
|
||||
console.log("Transform applied:", transformed);
|
||||
|
||||
return markdown;
|
||||
}
|
||||
const markdown = transformed.convert({
|
||||
convert: (items) => {
|
||||
console.log("PDF Structure:", {
|
||||
itemCount: items.length,
|
||||
firstItem: items[0],
|
||||
schema: PARSE_SCHEMA, // ['transform', 'width', 'height', 'str', 'fontName', 'dir']
|
||||
});
|
||||
|
||||
const text = items
|
||||
.map((item) => item.value("str")) // Using 'str' instead of 'text' based on PARSE_SCHEMA
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
|
||||
console.log("Converted text:", {
|
||||
length: text.length,
|
||||
preview: text.substring(0, 100),
|
||||
});
|
||||
|
||||
return text;
|
||||
},
|
||||
});
|
||||
|
||||
return markdown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { GlobalWorkerOptions } from 'pdfjs-dist';
|
||||
import { browser } from "$app/environment";
|
||||
|
||||
// Set up the worker source location - point to static file in public directory
|
||||
const workerSrc = '/pdf.worker.min.mjs';
|
||||
|
||||
// Configure the worker options only on the client side
|
||||
if (browser) {
|
||||
GlobalWorkerOptions.workerSrc = workerSrc;
|
||||
}
|
||||
|
||||
// Export the configuration
|
||||
// Export the configuration - accepts pdfjs module to avoid top-level import
|
||||
// This is necessary because pdfjs-dist v5+ uses browser APIs at import time
|
||||
export default {
|
||||
initialize: () => {
|
||||
if (browser) {
|
||||
console.log('PDF.js worker initialized at', workerSrc);
|
||||
}
|
||||
}
|
||||
};
|
||||
initialize: async () => {
|
||||
if (browser) {
|
||||
// Dynamic import to avoid SSR issues
|
||||
const pdfjs = await import("pdfjs-dist");
|
||||
const { GlobalWorkerOptions, version } = pdfjs;
|
||||
|
||||
// Use CDN-hosted worker to avoid bundling third-party minified code in the repo
|
||||
const workerSrc = `https://unpkg.com/pdfjs-dist@${version}/build/pdf.worker.min.mjs`;
|
||||
GlobalWorkerOptions.workerSrc = workerSrc;
|
||||
|
||||
console.log(`PDF.js worker v${version} initialized from CDN`);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
import { writable, derived, get } from 'svelte/store';
|
||||
import type { ChatState, Message, StreamResponse } from '$lib/interfaces/chat-interface';
|
||||
import { ChatService, ChatError } from '$lib/services/ChatService';
|
||||
import { languageStore } from '$lib/store/language-store';
|
||||
import { selectedPatternName } from '$lib/store/pattern-store';
|
||||
import { derived, get, writable } from "svelte/store";
|
||||
import { browser } from "$app/environment";
|
||||
import type {
|
||||
ChatState,
|
||||
Message,
|
||||
StreamResponse,
|
||||
} from "$lib/interfaces/chat-interface";
|
||||
import { ChatError, ChatService } from "$lib/services/ChatService";
|
||||
import { languageStore } from "$lib/store/language-store";
|
||||
import { selectedPatternName } from "$lib/store/pattern-store";
|
||||
|
||||
// Initialize chat service
|
||||
const chatService = new ChatService();
|
||||
|
||||
// Local storage key for persisting messages
|
||||
const MESSAGES_STORAGE_KEY = 'chat_messages';
|
||||
const MESSAGES_STORAGE_KEY = "chat_messages";
|
||||
|
||||
// Load initial messages from local storage
|
||||
const initialMessages = typeof localStorage !== 'undefined'
|
||||
? JSON.parse(localStorage.getItem(MESSAGES_STORAGE_KEY) || '[]')
|
||||
: [];
|
||||
// Load initial messages from local storage (only in browser)
|
||||
const initialMessages = browser
|
||||
? JSON.parse(localStorage.getItem(MESSAGES_STORAGE_KEY) || "[]")
|
||||
: [];
|
||||
|
||||
// Separate stores for different concerns
|
||||
export const messageStore = writable<Message[]>(initialMessages);
|
||||
@@ -21,134 +26,144 @@ export const streamingStore = writable<boolean>(false);
|
||||
export const errorStore = writable<string | null>(null);
|
||||
export const currentSession = writable<string | null>(null);
|
||||
|
||||
// Subscribe to messageStore changes to persist messages
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
messageStore.subscribe($messages => {
|
||||
localStorage.setItem(MESSAGES_STORAGE_KEY, JSON.stringify($messages));
|
||||
});
|
||||
// Subscribe to messageStore changes to persist messages (only in browser)
|
||||
if (browser) {
|
||||
messageStore.subscribe(($messages) => {
|
||||
localStorage.setItem(MESSAGES_STORAGE_KEY, JSON.stringify($messages));
|
||||
});
|
||||
}
|
||||
|
||||
// Derived store for chat state
|
||||
export const chatState = derived(
|
||||
[messageStore, streamingStore],
|
||||
([$messages, $streaming]) => ({
|
||||
messages: $messages,
|
||||
isStreaming: $streaming
|
||||
})
|
||||
[messageStore, streamingStore],
|
||||
([$messages, $streaming]) => ({
|
||||
messages: $messages,
|
||||
isStreaming: $streaming,
|
||||
}),
|
||||
);
|
||||
|
||||
// Error handling utility
|
||||
function handleError(error: Error | string) {
|
||||
const errorMessage = error instanceof ChatError
|
||||
? `${error.code}: ${error.message}`
|
||||
: error instanceof Error
|
||||
? error.message
|
||||
: error;
|
||||
const errorMessage =
|
||||
error instanceof ChatError
|
||||
? `${error.code}: ${error.message}`
|
||||
: error instanceof Error
|
||||
? error.message
|
||||
: error;
|
||||
|
||||
errorStore.set(errorMessage);
|
||||
streamingStore.set(false);
|
||||
return errorMessage;
|
||||
errorStore.set(errorMessage);
|
||||
streamingStore.set(false);
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
export const setSession = (sessionName: string | null) => {
|
||||
currentSession.set(sessionName);
|
||||
if (!sessionName) {
|
||||
clearMessages();
|
||||
}
|
||||
currentSession.set(sessionName);
|
||||
if (!sessionName) {
|
||||
clearMessages();
|
||||
}
|
||||
};
|
||||
|
||||
export const clearMessages = () => {
|
||||
messageStore.set([]);
|
||||
errorStore.set(null);
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.removeItem(MESSAGES_STORAGE_KEY);
|
||||
}
|
||||
messageStore.set([]);
|
||||
errorStore.set(null);
|
||||
if (typeof localStorage !== "undefined") {
|
||||
localStorage.removeItem(MESSAGES_STORAGE_KEY);
|
||||
}
|
||||
};
|
||||
|
||||
export const revertLastMessage = () => {
|
||||
messageStore.update(messages => messages.slice(0, -1));
|
||||
messageStore.update((messages) => messages.slice(0, -1));
|
||||
};
|
||||
|
||||
export async function sendMessage(
|
||||
content: string,
|
||||
systemPromptText?: string,
|
||||
isSystem: boolean = false,
|
||||
) {
|
||||
try {
|
||||
console.log("\n=== Message Processing Start ===");
|
||||
console.log("1. Initial state:", {
|
||||
isSystem,
|
||||
hasSystemPrompt: !!systemPromptText,
|
||||
currentLanguage: get(languageStore),
|
||||
pattern: get(selectedPatternName),
|
||||
});
|
||||
|
||||
export async function sendMessage(content: string, systemPromptText?: string, isSystem: boolean = false) {
|
||||
try {
|
||||
console.log('\n=== Message Processing Start ===');
|
||||
console.log('1. Initial state:', {
|
||||
isSystem,
|
||||
hasSystemPrompt: !!systemPromptText,
|
||||
currentLanguage: get(languageStore),
|
||||
pattern: get(selectedPatternName)
|
||||
});
|
||||
const $streaming = get(streamingStore);
|
||||
if ($streaming) {
|
||||
throw new ChatError(
|
||||
"Message submission blocked - already streaming",
|
||||
"STREAMING_BLOCKED",
|
||||
);
|
||||
}
|
||||
|
||||
const $streaming = get(streamingStore);
|
||||
if ($streaming) {
|
||||
throw new ChatError('Message submission blocked - already streaming', 'STREAMING_BLOCKED');
|
||||
}
|
||||
streamingStore.set(true);
|
||||
errorStore.set(null);
|
||||
|
||||
streamingStore.set(true);
|
||||
errorStore.set(null);
|
||||
// Add message
|
||||
messageStore.update((messages) => [
|
||||
...messages,
|
||||
{
|
||||
role: isSystem ? "system" : "user",
|
||||
content,
|
||||
},
|
||||
]);
|
||||
|
||||
// Add message
|
||||
messageStore.update(messages => [...messages, {
|
||||
role: isSystem ? 'system' : 'user',
|
||||
content
|
||||
}]);
|
||||
console.log("2. Message added:", {
|
||||
role: isSystem ? "system" : "user",
|
||||
language: get(languageStore),
|
||||
});
|
||||
|
||||
console.log('2. Message added:', {
|
||||
role: isSystem ? 'system' : 'user',
|
||||
language: get(languageStore)
|
||||
});
|
||||
if (!isSystem) {
|
||||
console.log("3. Preparing chat stream:", {
|
||||
language: get(languageStore),
|
||||
pattern: get(selectedPatternName),
|
||||
hasSystemPrompt: !!systemPromptText,
|
||||
});
|
||||
|
||||
if (!isSystem) {
|
||||
console.log('3. Preparing chat stream:', {
|
||||
language: get(languageStore),
|
||||
pattern: get(selectedPatternName),
|
||||
hasSystemPrompt: !!systemPromptText
|
||||
});
|
||||
const stream = await chatService.streamChat(content, systemPromptText);
|
||||
console.log("4. Stream created");
|
||||
|
||||
const stream = await chatService.streamChat(content, systemPromptText);
|
||||
console.log('4. Stream created');
|
||||
await chatService.processStream(
|
||||
stream,
|
||||
(content: string, response?: StreamResponse) => {
|
||||
messageStore.update((messages) => {
|
||||
const newMessages = [...messages];
|
||||
const lastMessage = newMessages[newMessages.length - 1];
|
||||
|
||||
await chatService.processStream(
|
||||
stream,
|
||||
(content: string, response?: StreamResponse) => {
|
||||
messageStore.update(messages => {
|
||||
const newMessages = [...messages];
|
||||
const lastMessage = newMessages[newMessages.length - 1];
|
||||
if (lastMessage?.role === "assistant") {
|
||||
lastMessage.content = content;
|
||||
lastMessage.format = response?.format;
|
||||
console.log("Message updated:", {
|
||||
role: "assistant",
|
||||
format: lastMessage.format,
|
||||
});
|
||||
} else {
|
||||
newMessages.push({
|
||||
role: "assistant",
|
||||
content,
|
||||
format: response?.format,
|
||||
});
|
||||
}
|
||||
|
||||
if (lastMessage?.role === 'assistant') {
|
||||
lastMessage.content = content;
|
||||
lastMessage.format = response?.format;
|
||||
console.log('Message updated:', {
|
||||
role: 'assistant',
|
||||
format: lastMessage.format
|
||||
});
|
||||
} else {
|
||||
newMessages.push({
|
||||
role: 'assistant',
|
||||
content,
|
||||
format: response?.format
|
||||
});
|
||||
}
|
||||
return newMessages;
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
handleError(error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return newMessages;
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
handleError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
streamingStore.set(false);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
handleError(error);
|
||||
} else {
|
||||
handleError(String(error));
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
streamingStore.set(false);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
handleError(error);
|
||||
} else {
|
||||
handleError(String(error));
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Re-export types for convenience
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user