This commit is contained in:
mobin
2025-07-10 18:23:56 +00:00
commit a43f302265
383 changed files with 55982 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\AiJob;
use App\Models\ai;
use Illuminate\Support\Facades\Http;
class RunAiJob extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:run-ai-job';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$response = Http::withHeaders([
'Authorization' => 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjA2OWZlZGJiLTk2ZDctNGU4MC1iMDA0LWFmZDZjMmU4YmZkZiIsImxhc3RfcGFzc3dvcmRfY2hhbmdlIjoxNzUwNjYwODczLCJleHAiOjE3NTQ3NTcxMDR9.qAQF8XDOU8NRz5vSiFlQfnrj8dhGhJ5uvJqjblQWmr8',
'Cookie' => 'x-ap=eu-central-1; acw_tc=0a03e56c17521661095906021e3cacb270c127c80eb3a20489a465ab4beae1',
])->post('https://chat.qwen.ai/api/v2/chat/completions?chat_id=7ce2a60a-2b40-4ae8-8536-0cd346642de3', [
'stream' => false,
'incremental_output' => true,
'chat_id' => '7ce2a60a-2b40-4ae8-8536-0cd346642de3',
'chat_mode' => 'normal',
'model' => 'qwen3-235b-a22b',
'messages' => [
[
'role' => 'user',
'content' => 'یه جمله انگیزشی بده که خاص، کوبنده و غیرکلیشه‌ای باشه. نه مثل بقیه.',
'user_action' => 'chat',
'files' => [],
'timestamp' => 1752165316,
'models' => ['qwen3-235b-a22b'],
'chat_type' => 't2t',
'feature_config' => [
'thinking_enabled' => false,
'output_schema' => 'phase'
],
'extra' => [
'meta' => [
'subChatType' => 't2t'
]
],
'sub_chat_type' => 't2t',
'parent_id' => 'df0a0c91-53d5-4a04-b5da-b8ac53d6d821'
]
],
'timestamp' => 1752165316
]);
// Get the response
$responseData = $response->json();
$content = $responseData['data']['choices'][0]['message']['content'];
$ai = new ai(); // Or use your correct namespace
$ai->key = 'angizeh'; // Assuming you fixed 'kay' to 'key' in migration
$ai->prompt = 'فقط یک جمله کوتاه انگیزشی بگو';
$ai->response = $content;
$ai->save();
$this->info('AI Job dispatched successfully!');
}
}
+8
View File
@@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}
+70
View File
@@ -0,0 +1,70 @@
<?php
namespace App\Jobs;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use App\Models\ai as aiModel;
use Illuminate\Support\Facades\Http;
class AiJob implements ShouldQueue
{
use Queueable;
/**
* Create a new job instance.
*/
public function __construct()
{
//
}
/**
* Execute the job.
*/
public function handle(): void
{
$response = Http::withHeaders([
'Authorization' => 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjA2OWZlZGJiLTk2ZDctNGU4MC1iMDA0LWFmZDZjMmU4YmZkZiIsImxhc3RfcGFzc3dvcmRfY2hhbmdlIjoxNzUwNjYwODczLCJleHAiOjE3NTQ3NTcxMDR9.qAQF8XDOU8NRz5vSiFlQfnrj8dhGhJ5uvJqjblQWmr8',
'Cookie' => 'x-ap=eu-central-1; acw_tc=0a03e56c17521661095906021e3cacb270c127c80eb3a20489a465ab4beae1',
])->post('https://chat.qwen.ai/api/v2/chat/completions?chat_id=7ce2a60a-2b40-4ae8-8536-0cd346642de3', [
'stream' => false,
'incremental_output' => true,
'chat_id' => '7ce2a60a-2b40-4ae8-8536-0cd346642de3',
'chat_mode' => 'normal',
'model' => 'qwen3-235b-a22b',
'messages' => [
[
'role' => 'user',
'content' => 'فقط یک جمله کوتاه انگیزشی بگو',
'user_action' => 'chat',
'files' => [],
'timestamp' => 1752165316,
'models' => ['qwen3-235b-a22b'],
'chat_type' => 't2t',
'feature_config' => [
'thinking_enabled' => false,
'output_schema' => 'phase'
],
'extra' => [
'meta' => [
'subChatType' => 't2t'
]
],
'sub_chat_type' => 't2t',
'parent_id' => 'df0a0c91-53d5-4a04-b5da-b8ac53d6d821'
]
],
'timestamp' => 1752165316
]);
// Get the response
$responseData = $response->json();
$content = $responseData['data']['choices'][0]['message']['content'];
$ai = new aiModel(); // Or use your correct namespace
$ai->key = 'angizeh'; // Assuming you fixed 'kay' to 'key' in migration
$ai->prompt = 'فقط یک جمله کوتاه انگیزشی بگو';
$ai->response = $content;
$ai->save();
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Attendance extends Model
{
protected $fillable = [
'user_id',
'user_identity',
'latitude',
'longitude',
'latitude_exit',
'longitude_exit',
'ip_exit',
'latitude_office',
'longitude_office',
'distance',
'ip_address',
'entered_at',
'exited_at',
];
public function setEntryLocationAttribute($value)
{
$this->attributes['entry_location'] = DB::raw("ST_SetSRID(ST_Point({$value['lng']}, {$value['lat']}), 4326)");
}
public function setExitLocationAttribute($value)
{
$this->attributes['exit_location'] = DB::raw("ST_SetSRID(ST_Point({$value['lng']}, {$value['lat']}), 4326)");
}
public function setOfficeLocationAttribute($value)
{
$this->attributes['office_location'] = DB::raw("ST_SetSRID(ST_Point({$value['lng']}, {$value['lat']}), 4326)");
}
public function breaks()
{
return $this->hasMany(AttendanceBreak::class);
}
public $timestamps = true;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AttendanceBreak extends Model
{
protected $fillable = [
'attendance_id',
'break_start',
'break_end',
];
// رابطه به حضور
public function attendance()
{
return $this->belongsTo(Attendance::class);
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ai extends Model
{
//
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}