Skip to content

Commit

Permalink
Add hugging-face-ai extension
Browse files Browse the repository at this point in the history
- removed old imports
- not satisfied with icons yet, removed them (and also updated readme)
- added free icons from flaticon for now (will create custom ones later)
- added comment
- improved error handling in generateResponse + generateStreamedResponse
- improved error handling in storage
- added confirmation for importing data (irreversible)
- updated changelog
- added searchBarPlaceholders
- improved token creation instructions
- added to readme
- updated deps
- changed extension icon to png
- added assistant context to messages (to prevent redundant responses)
- import/export data workingg
- added file-type validation
- promisified export data
- fixed bugs for no selected folder
- auto-open in finder
- successfully exporting data
- Create LICENSE
- chores
- added hugging fact extension icon
- renamed extension
- refactored update in useConversations
- refactored update in useModels
- added disclaimer for updating models
- able to update models now, but dropdown value is incorrect
- somewhat abandoned ai-description, but fixed recent-questions in conversations
- added non-stream response boilerplate and updated types
- added word count
- fixed question ordering
- fixed abortControlled reset bug
- integrated AbortController to stop web-stream (really cool feature)
- fixed streaming bug (on esc)
- renamed files to kebab-case
- Merge pull request raycast#6 from wderocco8/feat/custom-models
- added selectedModelId (not updating ui though???)
- updated pr template
- removed markdown label
- added link to hf model
- added model detail and delete
- rendered metadata with model information
- holy cow models are working in ask-question wohoo
- model creation set up
- added boilerplate for useModels
- renamed chat to ask-question
- added toggle
- added some metadata (with toggle)
- added copy action
- added empty state for conversations
- refactored converations ActionPanels for organization
- put bandaid on bug (potentially a Raycast issue)
- added empty state images
- swapped comments
- cleanup
- fixed duplicate question bug with Rich Text Input (still has performance bug though)
- added delete question functionality
- rich text input working (some minor bugs)
- added boilerplate for isAskingQuestion (to be fixed...)
- added delete convo confirmation
- added new convo functionality
- added refresh to useQuestions to ensure conversations get latest data
- added refresh mechanism
- some pretty significant refactors to how useConversations is handled (mainly abandoning functional setData in order to properly await saveToLocalStorage
- removed markdown header (maybe will bring back, it looks overwhelming tho)
- conversations enriched with questions in hook
- cleaned types a bit
- remove all questions by conversation implemented
- added metadata to conversations detail
- added sorting to convos
- added new command for viewing conversations
- successfully created conversation
- Merge pull request raycast#5 from wderocco8/refactor/generate-response-conversation
- cleared question on submit
- Merge pull request raycast#4 from wderocco8/refactor/generate-response-conversation
- filtered questions up until questionId
- fixed questions to filter by matching convo
- added dot for to track isStreaming
- Merge pull request raycast#3 from wderocco8/feat/multiple-questions
- holy somehow things are finally coming together (streaming properly integrated with multiple questions)
- still broken, but better stopping point
- selectedQuestionId is synced (but has weird issue on submit)
- fixed bug with searchQuestion
- Merge pull request raycast#2 from wderocco8/refactor/ui-chat-form
- good stopping point (can ask questions, just can\'t see results respectively
- can ask questions again now
- more refactoreds to initializing questions and data handling
- refactored questions
- updated eslint and refactored conversatons
- added hook for conversations and installed uuid:
- refactored useQuestions a bit
- added boilerplate for questions hook
- started wroking on SQL integration
- actions panel is WORKING yuh yuh yuh
- making some refactors (action panel won\'t show up?)
- initial refactors -> moved chat to AskQuestionForm
- renamed ouptu
- added loading states with toasts
- added form validation
- Merge pull request raycast#1 from wderocco8/feat/stream-chat-completion
- added PR template
- STREAM AND CHAT are BOTH working 🌝
- refactoring approach (was accidentally using text-generation instead of chat-completion)
- able to interact with chat using raycast form
- stream finally working 🙏
- made some stream progress..
- new approach
- stream still not working 🥲
- hugging face chatCompletion working (without stream)
- added boilerplate for chat command
- initialized repo
  • Loading branch information
wderocco8 committed Jan 12, 2025
1 parent cf48b28 commit aecd545
Show file tree
Hide file tree
Showing 34 changed files with 7,470 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extensions/hugging-face-ai/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"root": true,
"extends": ["@raycast"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "warn"

}
}
13 changes: 13 additions & 0 deletions extensions/hugging-face-ai/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# Raycast specific files
raycast-env.d.ts
.raycast-swift-build
.swiftpm
compiled_raycast_swift

# misc
.DS_Store
4 changes: 4 additions & 0 deletions extensions/hugging-face-ai/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 120,
"singleQuote": false
}
11 changes: 11 additions & 0 deletions extensions/hugging-face-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Hugging Face AI Changelog

## [Initial Version] - {PR_MERGE_DATE}

Initial version of Hugging Face AI for Raycast. Seamlessly interact with a variety of Hugging Face models via 5 commands:

1. **Ask Question**: Chat with Hugging Face models directly from Raycast.
2. **Conversations**: View and manage your conversation history.
3. **Models**: Create and manage personalized AI models.
4. **Import Data**: Backup your data to a JSON file.
5. **Export Data**: Import your data from a previously-generated JSON file.
21 changes: 21 additions & 0 deletions extensions/hugging-face-ai/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 William De Rocco

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
71 changes: 71 additions & 0 deletions extensions/hugging-face-ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Hugging Face AI

## Overview

The **Hugging Face AI** extension for Raycast allows users to interact with the Hugging Face Inference API seamlessly. With features like asking questions, tracking conversations, creating custom models, and exporting/importing data, this extension is a powerful tool for developers and AI enthusiasts. **All you need is a _free_ access token!**

![Extension Commands](media/extension-commands.png)

## Features

- **Ask Questions**: Chat with Hugging Face models directly from Raycast.
- **Conversations**: View and manage your conversation history.
- **Custom Models**: Create and manage personalized AI models.
- **Data Import/Export**: Backup or transfer your data with JSON files.

## Getting Started

### Prerequisites

- A free [Hugging Face account](https://huggingface.co/join).
- A valid Hugging Face Inference API token.
- Raycast installed on your device.

### Installation

1. Download the Hugging Face AI extension from the Raycast Store.
2. Follow the setup instructions provided by Raycast.

### Configuring Your Access Token

To use the extension, you need to configure your Hugging Face API token:

1. Log in to your Hugging Face account.
2. Navigate to [Hugging Face Tokens](https://huggingface.co/settings/tokens).
3. Click **Create new token**
4. Enter a name (optional)
5. Select the checkbox **Make calls to the serverless Inference API** under **Inference**
6. Scroll down and click **Create token**
7. Copy your newly created access token.
8. Open the Hugging Face AI extension in Raycast.
9. Paste the token into the **Access Token** field in the preferences.

## Screenshots

![Ask Question Screenshot](metadata/ask-question-1.png)
![Conversations Screenshot](metadata/conversations-2.png)
![Custom Models Screenshot](metadata/models-3.png)

## Dependencies

The extension requires the following packages:

- `@huggingface/inference`
- `@raycast/api`
- `@raycast/utils`
- `node-fetch`
- `uuid`

## Attibutions

This extension was made from scratch, but was inspired by the [ChatGPT extension](https://www.raycast.com/abielzulio/chatgpt) by [Abiel Zulio M](https://www.raycast.com/abielzulio). While these extensions are similar, Hugging Face AI is designed to be **free** since it utilizes a variety of unpaid models from Hugging Face's [Inference API](https://huggingface.co/learn/cookbook/en/enterprise_cookbook_overview#inference-api-serverless).

Nonetheless, if you want access to the latest models with more powerful capabilities, I would recommend either subcribing to [Hugging Face Pro](https://huggingface.co/pricing) (more advanced/paid models will be supported in this extension ASAP), or to use Abiel's [ChatGPT extension](https://www.raycast.com/abielzulio/chatgpt)!

## License

This extension is licensed under the [MIT License](LICENSE).

## Author

Developed by **William De Rocco**. For questions or issues, feel free to open a GitHub issue or contact me directly.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/hugging-face-ai/metadata/models-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit aecd545

Please sign in to comment.