- Minor bugfixes
This commit is contained in:
12
CHANGELOG.md
12
CHANGELOG.md
@@ -32,21 +32,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Introduction of dynamic Processors
|
- Introduction of dynamic Processors
|
||||||
- Introduction of caching system
|
- Introduction of caching system
|
||||||
- Introduction of a better template manager
|
- Introduction of a better template manager
|
||||||
|
- Modernisation of external API/Socket authentication using projects
|
||||||
|
- Creation of new eveai_chat WordPress plugin to support specialists
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- For changes in existing functionality.
|
- Update of eveai_sync WordPress plugin
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
- For soon-to-be removed features.
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
- For now removed features.
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Set default language when registering Documents or URLs.
|
- Set default language when registering Documents or URLs.
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
- In case of vulnerabilities.
|
- Security improvements to Docker images
|
||||||
|
|
||||||
## [1.0.14-alfa]
|
## [1.0.14-alfa]
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ x-common-variables: &common-variables
|
|||||||
MAIL_PORT: 465
|
MAIL_PORT: 465
|
||||||
REDIS_URL: redis
|
REDIS_URL: redis
|
||||||
REDIS_PORT: '6379'
|
REDIS_PORT: '6379'
|
||||||
|
FLOWER_USER: 'Felucia'
|
||||||
|
FLOWER_PASSWORD: 'Jungles'
|
||||||
OPENAI_API_KEY: 'sk-proj-8R0jWzwjL7PeoPyMhJTZT3BlbkFJLb6HfRB2Hr9cEVFWEhU7'
|
OPENAI_API_KEY: 'sk-proj-8R0jWzwjL7PeoPyMhJTZT3BlbkFJLb6HfRB2Hr9cEVFWEhU7'
|
||||||
GROQ_API_KEY: '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'
|
GROQ_API_KEY: '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'
|
||||||
ANTHROPIC_API_KEY: 'sk-ant-api03-c2TmkzbReeGhXBO5JxNH6BJNylRDonc9GmZd0eRbrvyekec2'
|
ANTHROPIC_API_KEY: 'sk-ant-api03-c2TmkzbReeGhXBO5JxNH6BJNylRDonc9GmZd0eRbrvyekec2'
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ When you change chunking of embedding information, you'll need to manually refre
|
|||||||
{{ render_field(field, disabled_fields, exclude_fields) }}
|
{{ render_field(field, disabled_fields, exclude_fields) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<button type="submit" class="btn btn-primary">Save Retriever</button>
|
<button type="submit" class="btn btn-primary">Save Catalog</button>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
from flask import Flask, jsonify
|
from flask import Flask, jsonify, request
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from flask_jwt_extended import verify_jwt_in_request, get_jwt_identity
|
||||||
|
|
||||||
from common.extensions import db, socketio, jwt, cors, session, simple_encryption, metrics
|
from common.extensions import db, socketio, jwt, cors, session, simple_encryption, metrics
|
||||||
from config.logging_config import LOGGING
|
from config.logging_config import LOGGING
|
||||||
from eveai_chat.socket_handlers import chat_handler
|
from eveai_chat.socket_handlers import chat_handler
|
||||||
from common.utils.cors_utils import create_cors_after_request
|
from common.utils.cors_utils import create_cors_after_request, get_allowed_origins
|
||||||
from common.utils.celery_utils import make_celery, init_celery
|
from common.utils.celery_utils import make_celery, init_celery
|
||||||
from config.config import get_config
|
from config.config import get_config
|
||||||
|
|
||||||
@@ -32,6 +34,32 @@ def create_app(config_file=None):
|
|||||||
app.celery = make_celery(app.name, app.config)
|
app.celery = make_celery(app.name, app.config)
|
||||||
init_celery(app.celery, app)
|
init_celery(app.celery, app)
|
||||||
|
|
||||||
|
@app.before_request
|
||||||
|
def check_cors():
|
||||||
|
app.logger.debug('Checking CORS')
|
||||||
|
if request.method == 'OPTIONS':
|
||||||
|
app.logger.debug("Handling OPTIONS request")
|
||||||
|
return '', 200 # Allow OPTIONS to pass through
|
||||||
|
|
||||||
|
origin = request.headers.get('Origin')
|
||||||
|
if not origin:
|
||||||
|
return # Not a CORS request
|
||||||
|
|
||||||
|
# Get tenant ID from request
|
||||||
|
if verify_jwt_in_request():
|
||||||
|
tenant_id = get_jwt_identity()
|
||||||
|
if not tenant_id:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Check if origin is allowed for this tenant
|
||||||
|
allowed_origins = get_allowed_origins(tenant_id)
|
||||||
|
|
||||||
|
if origin not in allowed_origins:
|
||||||
|
app.logger.warning(f'Origin {origin} not allowed for tenant {tenant_id}')
|
||||||
|
return {'error': 'Origin not allowed'}, 403
|
||||||
|
|
||||||
app.logger.info("EveAI Chat Server Started Successfully")
|
app.logger.info("EveAI Chat Server Started Successfully")
|
||||||
app.logger.info("-------------------------------------------------------------------------------------------------")
|
app.logger.info("-------------------------------------------------------------------------------------------------")
|
||||||
return app
|
return app
|
||||||
@@ -54,8 +82,17 @@ def register_extensions(app):
|
|||||||
metrics.init_app(app)
|
metrics.init_app(app)
|
||||||
|
|
||||||
# Cors setup
|
# Cors setup
|
||||||
cors.init_app(app, resources={r"/chat/*": {"origins": "*"}})
|
cors.init_app(app, resources={
|
||||||
app.after_request(create_cors_after_request('/chat'))
|
r"/*": { # Make sure this matches your setup
|
||||||
|
"origins": "*",
|
||||||
|
"methods": ["GET", "POST", "PUT", "OPTIONS"],
|
||||||
|
"allow_headers": ["Content-Type", "Authorization", "X-Requested-With"],
|
||||||
|
"expose_headers": ["Content-Length", "Content-Range"],
|
||||||
|
"supports_credentials": True,
|
||||||
|
"max_age": 1728000,
|
||||||
|
"allow_credentials": True
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
session.init_app(app)
|
session.init_app(app)
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ class EveAIChatWidget extends HTMLElement {
|
|||||||
console.log('Chat Widget Connected');
|
console.log('Chat Widget Connected');
|
||||||
this.innerHTML = this.getTemplate();
|
this.innerHTML = this.getTemplate();
|
||||||
this.setupElements()
|
this.setupElements()
|
||||||
this.populateLanguageDropdown()
|
|
||||||
this.addEventListeners()
|
this.addEventListeners()
|
||||||
|
|
||||||
if (this.areAllAttributesSet()) {
|
if (this.areAllAttributesSet()) {
|
||||||
@@ -194,7 +193,7 @@ class EveAIChatWidget extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.socket = io(this.serverUrl, {
|
this.socket = io(this.serverUrl, {
|
||||||
path: '/socket.io/',
|
path: '/chat/socket.io/',
|
||||||
transports: ['websocket'],
|
transports: ['websocket'],
|
||||||
query: { // Change from auth to query
|
query: { // Change from auth to query
|
||||||
token: this.sessionToken
|
token: this.sessionToken
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Plugin Name: EveAI Chat Widget
|
* Plugin Name: EveAI Chat Widget
|
||||||
* Description: Integrates the EveAI chat interface into your WordPress site.
|
* Description: Integrates the Ask Eve AI (Evie) chat interface into your WordPress site.
|
||||||
* Version: 2.0.16
|
* Version: 2.0.17
|
||||||
* Author: Your Company
|
* Author: AskEveAI.com
|
||||||
* Text Domain: eveai-chat
|
* Text Domain: eveai-chat
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
* Requires at least: 5.8
|
* Requires at least: 5.8
|
||||||
@@ -15,7 +15,7 @@ if (!defined('WPINC')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define plugin constants
|
// Define plugin constants
|
||||||
define('EVEAI_CHAT_VERSION', '2.0.16');
|
define('EVEAI_CHAT_VERSION', '2.0.17');
|
||||||
define('EVEAI_CHAT_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
define('EVEAI_CHAT_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||||
define('EVEAI_CHAT_PLUGIN_URL', plugin_dir_url(__FILE__));
|
define('EVEAI_CHAT_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ class Assets implements Loadable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function load_assets() {
|
private function load_assets() {
|
||||||
|
error_log('Starting to load EveAI assets');
|
||||||
// Enqueue all required scripts
|
// Enqueue all required scripts
|
||||||
wp_enqueue_script('socket-io');
|
wp_enqueue_script('socket-io');
|
||||||
wp_enqueue_script('marked');
|
wp_enqueue_script('marked');
|
||||||
@@ -93,6 +94,7 @@ class Assets implements Loadable {
|
|||||||
'nonce' => wp_create_nonce('wp_rest'),
|
'nonce' => wp_create_nonce('wp_rest'),
|
||||||
'settings' => $this->get_public_settings()
|
'settings' => $this->get_public_settings()
|
||||||
]);
|
]);
|
||||||
|
error_log('EveAI assets loaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_public_settings() {
|
private function get_public_settings() {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ class RESTController implements Loadable {
|
|||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
add_action('rest_api_init', [$this, 'register_routes']);
|
add_action('rest_api_init', [$this, 'register_routes']);
|
||||||
error_log('REST routes registered for EveAI Chat');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register_routes() {
|
public function register_routes() {
|
||||||
|
error_log('Attempting to register EveAI REST routes');
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
self::API_NAMESPACE,
|
self::API_NAMESPACE,
|
||||||
'/token',
|
'/token',
|
||||||
@@ -39,6 +39,7 @@ class RESTController implements Loadable {
|
|||||||
'permission_callback' => [$this, 'verify_request'],
|
'permission_callback' => [$this, 'verify_request'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
error_log('EveAI REST routes Registered');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verify_request(\WP_REST_Request $request): bool {
|
public function verify_request(\WP_REST_Request $request): bool {
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ http {
|
|||||||
|
|
||||||
location /chat/ {
|
location /chat/ {
|
||||||
proxy_pass http://eveai_chat:5002/;
|
proxy_pass http://eveai_chat:5002/;
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
@@ -84,6 +85,12 @@ http {
|
|||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
|
|
||||||
|
# Add CORS headers
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization' always;
|
||||||
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /admin/ {
|
location /admin/ {
|
||||||
|
|||||||
Reference in New Issue
Block a user